Skip to contentSkip to conversation

soc: fsl: dpio: instead smp_processor_id with raw_smp_processor_id

PATCH In review [email protected] 2 participants 2 messages Oct 19, 2021 – Oct 20, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 soc: fsl: dpio: instead smp_processor_id with raw_smp_processor_id

From: Meng Li <[email protected]>

When enable debug kernel configs,there will be calltrace as below:

BUG: using smp_processor_id() in preemptible [00000000] code: swapper/0/1
caller is debug_smp_processor_id+0x20/0x30
CPU: 6 PID: 1 Comm: swapper/0 Not tainted 5.10.63-yocto-standard #1
Hardware name: NXP Layerscape LX2160ARDB (DT)
Call trace:
 dump_backtrace+0x0/0x1a0
 show_stack+0x24/0x30
 dump_stack+0xf0/0x13c
 check_preemption_disabled+0x100/0x110
 debug_smp_processor_id+0x20/0x30
 dpaa2_io_query_fq_count+0xdc/0x154
 dpaa2_eth_stop+0x144/0x314
 __dev_close_many+0xdc/0x160
 __dev_change_flags+0xe8/0x220
 dev_change_flags+0x30/0x70
 ic_close_devs+0x50/0x78
 ip_auto_config+0xed0/0xf10
 do_one_initcall+0xac/0x460
 kernel_init_freeable+0x30c/0x378
 kernel_init+0x20/0x128
 ret_from_fork+0x10/0x38

Based on comment in the context, it doesn't matter whether preemption is disable or not. So, instead smp_processor_id() with raw_smp_processor_id() to avoid above call trace.

v2:
Remove the preempt_disable/enable() protection, instead smp_processor_id with raw_smp_processor_id.

Fixes c89105c9b390 ("staging: fsl-mc: Move DPIO from staging to drivers/soc/fsl")
---
 drivers/soc/fsl/dpio/dpio-service.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/fsl/dpio/dpio-service.c +1 -1
index 19f47ea9dab0..3050a534d42c 100644
@@ -59,7 +59,7 @@ static inline struct dpaa2_io *service_select_by_cpu(struct dpaa2_io *d,
 	 * potentially being migrated away.
 	 */
 	if (cpu < 0)
-		cpu = smp_processor_id();
+		cpu = raw_smp_processor_id();
 
 	/* If a specific cpu was requested, pick it up immediately */
 	return dpio_by_cpu[cpu];
Signature · 1 line
2.17.1
#1 lore raw
Quoted 27 lines · On Mon, Oct 18, 2021 at 9:46 PM <[email protected]> wrote:

From: Meng Li <[email protected]>

When enable debug kernel configs,there will be calltrace as below:

BUG: using smp_processor_id() in preemptible [00000000] code: swapper/0/1
caller is debug_smp_processor_id+0x20/0x30
CPU: 6 PID: 1 Comm: swapper/0 Not tainted 5.10.63-yocto-standard #1
Hardware name: NXP Layerscape LX2160ARDB (DT)
Call trace:
 dump_backtrace+0x0/0x1a0
 show_stack+0x24/0x30
 dump_stack+0xf0/0x13c
 check_preemption_disabled+0x100/0x110
 debug_smp_processor_id+0x20/0x30
 dpaa2_io_query_fq_count+0xdc/0x154
 dpaa2_eth_stop+0x144/0x314
 __dev_close_many+0xdc/0x160
 __dev_change_flags+0xe8/0x220
 dev_change_flags+0x30/0x70
 ic_close_devs+0x50/0x78
 ip_auto_config+0xed0/0xf10
 do_one_initcall+0xac/0x460
 kernel_init_freeable+0x30c/0x378
 kernel_init+0x20/0x128
 ret_from_fork+0x10/0x38
Quoted 2 lines

Based on comment in the context, it doesn't matter whether preemption is disable or not. So, instead smp_processor_id()

s/instead/replace/g

Quoted 5 lines

with raw_smp_processor_id() to avoid above call trace.

v2:
Remove the preempt_disable/enable() protection, instead smp_processor_id with raw_smp_processor_id.

The revision history information should go after the "---" below.

Quoted 4 lines
Fixes c89105c9b390 ("staging: fsl-mc: Move DPIO from staging to drivers/soc/fsl")

I helped to fix the issues I mentioned. Applied for fix. Thanks.

Quoted 20 lines
---
 drivers/soc/fsl/dpio/dpio-service.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/fsl/dpio/dpio-service.c +1 -2
index 19f47ea9dab0..3050a534d42c 100644
@@ -59,7 +59,7 @@ static inline struct dpaa2_io *service_select_by_cpu(struct dpaa2_io *d,
         * potentially being migrated away.
         */
        if (cpu < 0)
-               cpu = smp_processor_id();
+               cpu = raw_smp_processor_id();
 
        /* If a specific cpu was requested, pick it up immediately */
        return dpio_by_cpu[cpu];
--

2.17.1