Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

soc: xilinx: rename cpu_number1 to dummy_cpu_number

The per cpu variable cpu_number1 is passed to xlnx_event_handler as
argument "dev_id", but it is not used in this function. So drop the
initialization of this variable and rename it to dummy_cpu_number.
This patch is to fix the following call trace when the kernel option
CONFIG_DEBUG_ATOMIC_SLEEP is enabled:

BUG: sleeping function called from invalid context at include/linux/sched/mm.h:274
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 1, name: swapper/0
preempt_count: 1, expected: 0
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.1.0 #53
Hardware name: Xilinx Versal vmk180 Eval board rev1.1 (QSPI) (DT)
Call trace:
dump_backtrace+0xd0/0xe0
show_stack+0x18/0x40
dump_stack_lvl+0x7c/0xa0
dump_stack+0x18/0x34
__might_resched+0x10c/0x140
__might_sleep+0x4c/0xa0
__kmem_cache_alloc_node+0xf4/0x168
kmalloc_trace+0x28/0x38
__request_percpu_irq+0x74/0x138
xlnx_event_manager_probe+0xf8/0x298
platform_probe+0x68/0xd8

Fixes: daed80ed0758 ("soc: xilinx: Fix for call trace due to the usage of smp_processor_id()")
Signed-off-by: Jay Buddhabhatti <jay.buddhabhatti@amd.com>
Link: https://lore.kernel.org/r/20240408110610.15676-1-jay.buddhabhatti@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>

authored by

Jay Buddhabhatti and committed by
Michal Simek
4a95449d 56f45266

+4 -11
+4 -11
drivers/soc/xilinx/xlnx_event_manager.c
··· 3 3 * Xilinx Event Management Driver 4 4 * 5 5 * Copyright (C) 2021 Xilinx, Inc. 6 + * Copyright (C) 2024 Advanced Micro Devices, Inc. 6 7 * 7 8 * Abhyuday Godhasara <abhyuday.godhasara@xilinx.com> 8 9 */ ··· 20 19 #include <linux/platform_device.h> 21 20 #include <linux/slab.h> 22 21 23 - static DEFINE_PER_CPU_READ_MOSTLY(int, cpu_number1); 22 + static DEFINE_PER_CPU_READ_MOSTLY(int, dummy_cpu_number); 24 23 25 24 static int virq_sgi; 26 25 static int event_manager_availability = -EACCES; ··· 571 570 static int xlnx_event_init_sgi(struct platform_device *pdev) 572 571 { 573 572 int ret = 0; 574 - int cpu; 575 573 /* 576 574 * IRQ related structures are used for the following: 577 575 * for each SGI interrupt ensure its mapped by GIC IRQ domain ··· 607 607 sgi_fwspec.param[0] = sgi_num; 608 608 virq_sgi = irq_create_fwspec_mapping(&sgi_fwspec); 609 609 610 - cpu = get_cpu(); 611 - per_cpu(cpu_number1, cpu) = cpu; 612 610 ret = request_percpu_irq(virq_sgi, xlnx_event_handler, "xlnx_event_mgmt", 613 - &cpu_number1); 614 - put_cpu(); 611 + &dummy_cpu_number); 615 612 616 613 WARN_ON(ret); 617 614 if (ret) { ··· 624 627 625 628 static void xlnx_event_cleanup_sgi(struct platform_device *pdev) 626 629 { 627 - int cpu = smp_processor_id(); 628 - 629 - per_cpu(cpu_number1, cpu) = cpu; 630 - 631 630 cpuhp_remove_state(CPUHP_AP_ONLINE_DYN); 632 631 633 632 on_each_cpu(xlnx_disable_percpu_irq, NULL, 1); 634 633 635 634 irq_clear_status_flags(virq_sgi, IRQ_PER_CPU); 636 - free_percpu_irq(virq_sgi, &cpu_number1); 635 + free_percpu_irq(virq_sgi, &dummy_cpu_number); 637 636 irq_dispose_mapping(virq_sgi); 638 637 } 639 638