[PATCH] Fix backtrace message from arc_pmu_device_probe()

Nikolay Agishev Nikolay.Agishev at synopsys.com
Wed May 25 07:06:55 PDT 2022


this_cpu_ptr() call causes backtrace with CONFIG_DEBUG_PREEMPT=y
because it required non-preemptive mode.

Stack Trace:
  arc_unwind_core+0xe8/0x118
  dump_stack_lvl+0x2c/0x40
  check_preemption_disabled+0xb4/0xb8
  arc_pmu_device_probe+0x336/0x3c8
  platform_probe+0x30/0x80
  really_probe.part.0+0x8c/0x248
  driver_probe_device+0x86/0x1e8
  __driver_attach+0x8a/0x144
  bus_for_each_dev+0x38/0x64
  bus_add_driver+0x112/0x178
  driver_register+0x4c/0xdc
  do_one_initcall+0x30/0x110
  kernel_init_freeable+0x14a/0x1b0

Suggested fix turns off preemption for the routine call.

Signed-off-by: Nikolay Agishev <agishev at synopsys.com>
---
 arch/arc/kernel/perf_event.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arc/kernel/perf_event.c b/arch/arc/kernel/perf_event.c
index adff957962da..10bbdc2dab01 100644
--- a/arch/arc/kernel/perf_event.c
+++ b/arch/arc/kernel/perf_event.c
@@ -806,10 +806,14 @@ static int arc_pmu_device_probe(struct platform_device *pdev)
 
 			arc_pmu->irq = irq;
 
+			get_cpu_ptr(&arc_pmu_cpu);
+
 			/* intc map function ensures irq_set_percpu_devid() called */
 			ret = request_percpu_irq(irq, arc_pmu_intr, "ARC perf counters",
 						 this_cpu_ptr(&arc_pmu_cpu));
 
+			put_cpu_ptr(&arc_pmu_cpu);
+
 			if (!ret)
 				on_each_cpu(arc_cpu_pmu_irq_init, &irq, 1);
 			else
-- 
2.35.1




More information about the linux-snps-arc mailing list