Linux SNPS ARC Archive mirror
 help / color / mirror / Atom feed
From: Nikolay Agishev <Nikolay.Agishev@synopsys.com>
To: linux-snps-arc@lists.infradead.org
Cc: vgupta@kernel.org, peterz@infradead.org,
	Nikolay Agishev <Nikolay.Agishev@synopsys.com>
Subject: [PATCH] Fix backtrace message from arc_pmu_device_probe()
Date: Tue,  4 Apr 2023 14:45:48 +0400	[thread overview]
Message-ID: <20230404104548.388019-1-agishev@synopsys.com> (raw)

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@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


_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

             reply	other threads:[~2023-04-04 10:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-04 10:45 Nikolay Agishev [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-05-25 14:06 [PATCH] Fix backtrace message from arc_pmu_device_probe() Nikolay Agishev

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=20230404104548.388019-1-agishev@synopsys.com \
    --to=nikolay.agishev@synopsys.com \
    --cc=linux-snps-arc@lists.infradead.org \
    --cc=peterz@infradead.org \
    --cc=vgupta@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).