From: Michal Simek <michal.simek@amd.com>
To: Jay Buddhabhatti <jay.buddhabhatti@amd.com>
Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] soc: xilinx: rename cpu_number1 to dummy_cpu_number
Date: Mon, 3 Jun 2024 13:01:35 +0200 [thread overview]
Message-ID: <1b1efb67-1cf5-458b-a37a-835c7d89b03a@amd.com> (raw)
In-Reply-To: <20240408110610.15676-1-jay.buddhabhatti@amd.com>
On 4/8/24 13:06, Jay Buddhabhatti wrote:
> 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>
> ---
> drivers/soc/xilinx/xlnx_event_manager.c | 15 ++++-----------
> 1 file changed, 4 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/soc/xilinx/xlnx_event_manager.c b/drivers/soc/xilinx/xlnx_event_manager.c
> index 253299e4214d..366018f6a0ee 100644
> --- a/drivers/soc/xilinx/xlnx_event_manager.c
> +++ b/drivers/soc/xilinx/xlnx_event_manager.c
> @@ -3,6 +3,7 @@
> * Xilinx Event Management Driver
> *
> * Copyright (C) 2021 Xilinx, Inc.
> + * Copyright (C) 2024 Advanced Micro Devices, Inc.
> *
> * Abhyuday Godhasara <abhyuday.godhasara@xilinx.com>
> */
> @@ -19,7 +20,7 @@
> #include <linux/platform_device.h>
> #include <linux/slab.h>
>
> -static DEFINE_PER_CPU_READ_MOSTLY(int, cpu_number1);
> +static DEFINE_PER_CPU_READ_MOSTLY(int, dummy_cpu_number);
>
> static int virq_sgi;
> static int event_manager_availability = -EACCES;
> @@ -570,7 +571,6 @@ static void xlnx_disable_percpu_irq(void *data)
> static int xlnx_event_init_sgi(struct platform_device *pdev)
> {
> int ret = 0;
> - int cpu;
> /*
> * IRQ related structures are used for the following:
> * for each SGI interrupt ensure its mapped by GIC IRQ domain
> @@ -607,11 +607,8 @@ static int xlnx_event_init_sgi(struct platform_device *pdev)
> sgi_fwspec.param[0] = sgi_num;
> virq_sgi = irq_create_fwspec_mapping(&sgi_fwspec);
>
> - cpu = get_cpu();
> - per_cpu(cpu_number1, cpu) = cpu;
> ret = request_percpu_irq(virq_sgi, xlnx_event_handler, "xlnx_event_mgmt",
> - &cpu_number1);
> - put_cpu();
> + &dummy_cpu_number);
>
> WARN_ON(ret);
> if (ret) {
> @@ -627,16 +624,12 @@ static int xlnx_event_init_sgi(struct platform_device *pdev)
>
> static void xlnx_event_cleanup_sgi(struct platform_device *pdev)
> {
> - int cpu = smp_processor_id();
> -
> - per_cpu(cpu_number1, cpu) = cpu;
> -
> cpuhp_remove_state(CPUHP_AP_ONLINE_DYN);
>
> on_each_cpu(xlnx_disable_percpu_irq, NULL, 1);
>
> irq_clear_status_flags(virq_sgi, IRQ_PER_CPU);
> - free_percpu_irq(virq_sgi, &cpu_number1);
> + free_percpu_irq(virq_sgi, &dummy_cpu_number);
> irq_dispose_mapping(virq_sgi);
> }
>
Applied.
M
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2024-06-03 11:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-08 11:06 [PATCH] soc: xilinx: rename cpu_number1 to dummy_cpu_number Jay Buddhabhatti
2024-06-03 11:01 ` Michal Simek [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1b1efb67-1cf5-458b-a37a-835c7d89b03a@amd.com \
--to=michal.simek@amd.com \
--cc=jay.buddhabhatti@amd.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox