[bug report] soc: xilinx: Fix for call trace due to the usage of smp_processor_id()

Jain, Ronak ronak.jain at amd.com
Tue Feb 27 02:10:45 PST 2024


Hi Dan,

> -----Original Message-----
> From: Buddhabhatti, Jay <jay.buddhabhatti at amd.com>
> Sent: Tuesday, February 27, 2024 3:25 PM
> To: Dan Carpenter <dan.carpenter at linaro.org>;
> haribabu.gattem at xilinx.com; Jain, Ronak <ronak.jain at amd.com>
> Cc: Simek, Michal <michal.simek at amd.com>; linux-arm-
> kernel at lists.infradead.org
> Subject: RE: [bug report] soc: xilinx: Fix for call trace due to the usage of
> smp_processor_id()
> 
> + at Jain, Ronak
> 
> > -----Original Message-----
> > From: Dan Carpenter <dan.carpenter at linaro.org>
> > Sent: Thursday, February 1, 2024 5:50 PM
> > To: haribabu.gattem at xilinx.com
> > Cc: Buddhabhatti, Jay <jay.buddhabhatti at amd.com>; Simek, Michal
> > <michal.simek at amd.com>; linux-arm-kernel at lists.infradead.org
> > Subject: [bug report] soc: xilinx: Fix for call trace due to the usage of
> > smp_processor_id()
> >
> > Hello HariBabu Gattem,
> >
> > The patch daed80ed0758: "soc: xilinx: Fix for call trace due to the usage of
> > smp_processor_id()" from Oct 26, 2023 (linux-next), leads to the following
> > Smatch static checker warning:
> >
> > 	kernel/irq/manage.c:2614 __request_percpu_irq()
> > 	warn: sleeping in atomic context
> >
> > drivers/soc/xilinx/xlnx_event_manager.c
> >    610          cpu = get_cpu();
> >                 ^^^^^^^^^^^^^^^
> > The patch adds get_cpu() which disables preemption.
> >
> >    611          per_cpu(cpu_number1, cpu) = cpu;
> >    612          ret = request_percpu_irq(virq_sgi, xlnx_event_handler,
> > "xlnx_event_mgmt",
> >                       ^^^^^^^^^^^^^^^^^^
> > request_percpu_irq() does a sleeping allocation so it's a sleeping in atomic
> bug.
> >
> >    613                                   &cpu_number1);
> >    614          put_cpu();
> >

I am working on this issue, and I tried to reproduce the issue but I couldn't. First, I tried enabling the below config flags for kernel preemption and then ran the smatch command but didn't get the warning you were mentioning.

The configs I enabled,
CONFIG_DEBUG_ATOMIC_SLEEP=y
CONFIG_PREEMPT_RT=y
CONFIG_PREEMPT=y
CONFIG_PREEMPT_COUNT=y
CONFIG_PREEMPTION=y
CONFIG_PREEMPT_RCU=y
CONFIG_DEBUG_PREEMPT=y

The smatch command I ran,
~/smatch/smatch_scripts/kchecker --spammy drivers/soc/xilinx/xlnx_event_manager.c
~/smatch/smatch_scripts/kchecker --spammy kernel/irq/manage.c
make ARCH=arm64 CHECK="~/smatch/smatch -p=kernel" C=2 drivers/soc/xilinx/xlnx_event_manager.o

Could you please help me with the config you used for this issue and would be good if you could share the complete steps(the smatch commands) to reproduce the issue.

Thanks,
Ronak
> > regards,
> > dan carpenter



More information about the linux-arm-kernel mailing list