1 |
From 114e0a684753516ef4b71ccb55a8ebcfa8735edb Mon Sep 17 00:00:00 2001 |
2 |
From: Mark Rutland <mark.rutland@arm.com> |
3 |
Date: Mon, 30 Nov 2020 11:59:41 +0000 |
4 |
Subject: [PATCH 124/150] arm64: mark idle code as noinstr |
5 |
|
6 |
Core code disables RCU when calling arch_cpu_idle(), so it's not safe |
7 |
for arch_cpu_idle() or its calees to be instrumented, as the |
8 |
instrumentation callbacks may attempt to use RCU or other features which |
9 |
are unsafe to use in this context. |
10 |
|
11 |
Mark them noinstr to prevent issues. |
12 |
|
13 |
The use of local_irq_enable() in arch_cpu_idle() is similarly |
14 |
problematic, and the "sched/idle: Fix arch_cpu_idle() vs tracing" patch |
15 |
queued in the tip tree addresses that case. |
16 |
|
17 |
Reported-by: Marco Elver <elver@google.com> |
18 |
Signed-off-by: Mark Rutland <mark.rutland@arm.com> |
19 |
Cc: Catalin Marinas <catalin.marinas@arm.com> |
20 |
Cc: James Morse <james.morse@arm.com> |
21 |
Cc: Will Deacon <will@kernel.org> |
22 |
Link: https://lore.kernel.org/r/20201130115950.22492-3-mark.rutland@arm.com |
23 |
Signed-off-by: Will Deacon <will@kernel.org> |
24 |
--- |
25 |
arch/arm64/kernel/process.c | 8 ++++---- |
26 |
1 file changed, 4 insertions(+), 4 deletions(-) |
27 |
|
28 |
diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c |
29 |
index a47a40ec6ad9..0c65a91f8f53 100644 |
30 |
--- a/arch/arm64/kernel/process.c |
31 |
+++ b/arch/arm64/kernel/process.c |
32 |
@@ -72,13 +72,13 @@ EXPORT_SYMBOL_GPL(pm_power_off); |
33 |
|
34 |
void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd); |
35 |
|
36 |
-static void __cpu_do_idle(void) |
37 |
+static void noinstr __cpu_do_idle(void) |
38 |
{ |
39 |
dsb(sy); |
40 |
wfi(); |
41 |
} |
42 |
|
43 |
-static void __cpu_do_idle_irqprio(void) |
44 |
+static void noinstr __cpu_do_idle_irqprio(void) |
45 |
{ |
46 |
unsigned long pmr; |
47 |
unsigned long daif_bits; |
48 |
@@ -108,7 +108,7 @@ static void __cpu_do_idle_irqprio(void) |
49 |
* ensure that interrupts are not masked at the PMR (because the core will |
50 |
* not wake up if we block the wake up signal in the interrupt controller). |
51 |
*/ |
52 |
-void cpu_do_idle(void) |
53 |
+void noinstr cpu_do_idle(void) |
54 |
{ |
55 |
if (system_uses_irq_prio_masking()) |
56 |
__cpu_do_idle_irqprio(); |
57 |
@@ -119,7 +119,7 @@ void cpu_do_idle(void) |
58 |
/* |
59 |
* This is our default idle handler. |
60 |
*/ |
61 |
-void arch_cpu_idle(void) |
62 |
+void noinstr arch_cpu_idle(void) |
63 |
{ |
64 |
/* |
65 |
* This should do all the clock switching and wait for interrupt |
66 |
-- |
67 |
2.29.2 |
68 |
|