mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mostafa Saleh <smostafa@google.com>
To: linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org,  linux-kernel@vger.kernel.org
Cc: krzk@kernel.org, alim.akhtar@samsung.com,
	"Mostafa Saleh" <smostafa@google.com>,
	"Peter Griffin" <peter.griffin@linaro.org>,
	"André Draszik" <andre.draszik@linaro.org>
Subject: [PATCH] soc: samsung: exynos-pmu: Fix for CONFIG_DEBUG_PREEMPT
Date: Fri,  5 Sep 2025 16:24:46 +0000	[thread overview]
Message-ID: <20250905162446.88987-1-smostafa@google.com> (raw)

Booting the kernel on Pixel-6 with `CONFIG_DEBUG_PREEMPT` prints the
following WARN:

[    0.784187][    T1] BUG: using smp_processor_id() in preemptible [00000000] code: swapper/0/1
[    0.784328][    T1] caller is debug_smp_processor_id+0x20/0x30
[    0.784433][    T1] CPU: 6 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.17.0-rc4-gd69eb204c255 #1 PREEMPT
[    0.784439][    T1] Hardware name: Oriole (DT)
[    0.784441][    T1] Call trace:
[    0.784443][    T1]  show_stack+0x34/0xa0 (C)
[    0.784453][    T1]  dump_stack_lvl+0x7c/0xb0
[    0.784460][    T1]  dump_stack+0x18/0x24
[    0.784464][    T1]  check_preemption_disabled+0xf8/0x100
[    0.784470][    T1]  debug_smp_processor_id+0x20/0x30
[    0.784476][    T1]  gs101_cpuhp_pmu_online+0x40/0x108
[    0.784483][    T1]  cpuhp_invoke_callback+0x188/0x2d8
[    0.784490][    T1]  cpuhp_issue_call+0xec/0x240
[    0.784494][    T1]  __cpuhp_setup_state_cpuslocked+0x140/0x2c0
[    0.784499][    T1]  __cpuhp_setup_state+0x58/0x88
[    0.784504][    T1]  exynos_pmu_probe+0x2a4/0x380
[    0.784508][    T1]  platform_probe+0x64/0xd0
[    0.784516][    T1]  really_probe+0xd0/0x3b0
[    0.784520][    T1]  __driver_probe_device+0x8c/0x170
[    0.784524][    T1]  driver_probe_device+0x44/0x140
[    0.784528][    T1]  __device_attach_driver+0xd8/0x180
[    0.784532][    T1]  bus_for_each_drv+0x90/0xf8
[    0.784536][    T1]  __device_attach+0xa8/0x1d0
[    0.784540][    T1]  device_initial_probe+0x1c/0x30
[    0.784544][    T1]  bus_probe_device+0xb4/0xc0
[    0.784547][    T1]  device_add+0x4d0/0x700
[    0.784550][    T1]  of_device_add+0x4c/0x78
[    0.784556][    T1]  of_platform_device_create_pdata+0x9c/0x148
[    0.784560][    T1]  of_platform_bus_create+0x1d0/0x370
[    0.784563][    T1]  of_platform_bus_create+0x234/0x370
[    0.784567][    T1]  of_platform_populate+0x84/0x178
[    0.784571][    T1]  of_platform_default_populate_init+0xf0/0x120
[    0.784579][    T1]  do_one_initcall+0x68/0x2d0
[    0.784585][    T1]  kernel_init_freeable+0x2d8/0x358
[    0.784589][    T1]  kernel_init+0x28/0x168
[    0.784595][    T1]  ret_from_fork+0x10/0x20

As this value is only read once, it doesn't require to be stable, so
just use "raw_smp_processor_id" instead.

Cc: Peter Griffin <peter.griffin@linaro.org>
Cc: André Draszik <andre.draszik@linaro.org>

Signed-off-by: Mostafa Saleh <smostafa@google.com>
---
 drivers/soc/samsung/exynos-pmu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/soc/samsung/exynos-pmu.c b/drivers/soc/samsung/exynos-pmu.c
index a77288f49d24..338f4758a089 100644
--- a/drivers/soc/samsung/exynos-pmu.c
+++ b/drivers/soc/samsung/exynos-pmu.c
@@ -338,7 +338,7 @@ EXPORT_SYMBOL_GPL(exynos_get_pmu_regmap_by_phandle);
 
 static int gs101_cpuhp_pmu_online(unsigned int cpu)
 {
-	unsigned int cpuhint = smp_processor_id();
+	unsigned int cpuhint = raw_smp_processor_id();
 	u32 reg, mask;
 
 	/* clear cpu inform hint */
@@ -361,7 +361,7 @@ static int gs101_cpuhp_pmu_online(unsigned int cpu)
 static int gs101_cpuhp_pmu_offline(unsigned int cpu)
 {
 	u32 reg, mask;
-	unsigned int cpuhint = smp_processor_id();
+	unsigned int cpuhint = raw_smp_processor_id();
 
 	/* set cpu inform hint */
 	regmap_write(pmu_context->pmureg, GS101_CPU_INFORM(cpuhint),
-- 
2.51.0.355.g5224444f11-goog


             reply	other threads:[~2025-09-05 16:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-05 16:24 Mostafa Saleh [this message]
2025-09-05 17:09 ` Krzysztof Kozlowski
2025-09-05 17:43   ` Mostafa Saleh
2025-09-06  7:07     ` Krzysztof Kozlowski
2025-09-09 10:15       ` Will Deacon
2025-09-09 15:43         ` Krzysztof Kozlowski
2025-09-09 15:50           ` Krzysztof Kozlowski
2025-09-09 17:03           ` Will Deacon
2025-09-09 17:49             ` Krzysztof Kozlowski
2025-09-09 11:14 ` Peter Griffin
2025-09-09 19:03   ` Mostafa Saleh

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=20250905162446.88987-1-smostafa@google.com \
    --to=smostafa@google.com \
    --cc=alim.akhtar@samsung.com \
    --cc=andre.draszik@linaro.org \
    --cc=krzk@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=peter.griffin@linaro.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

all inboxes | Powered by JetHome®