Skip to content

Commit 114e0a6

Browse files
mrutland-armwilldeacon
authored andcommitted
arm64: mark idle code as noinstr
Core code disables RCU when calling arch_cpu_idle(), so it's not safe for arch_cpu_idle() or its calees to be instrumented, as the instrumentation callbacks may attempt to use RCU or other features which are unsafe to use in this context. Mark them noinstr to prevent issues. The use of local_irq_enable() in arch_cpu_idle() is similarly problematic, and the "sched/idle: Fix arch_cpu_idle() vs tracing" patch queued in the tip tree addresses that case. Reported-by: Marco Elver <[email protected]> Signed-off-by: Mark Rutland <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: James Morse <[email protected]> Cc: Will Deacon <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent ca1314d commit 114e0a6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

arch/arm64/kernel/process.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,13 @@ EXPORT_SYMBOL_GPL(pm_power_off);
7272

7373
void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd);
7474

75-
static void __cpu_do_idle(void)
75+
static void noinstr __cpu_do_idle(void)
7676
{
7777
dsb(sy);
7878
wfi();
7979
}
8080

81-
static void __cpu_do_idle_irqprio(void)
81+
static void noinstr __cpu_do_idle_irqprio(void)
8282
{
8383
unsigned long pmr;
8484
unsigned long daif_bits;
@@ -108,7 +108,7 @@ static void __cpu_do_idle_irqprio(void)
108108
* ensure that interrupts are not masked at the PMR (because the core will
109109
* not wake up if we block the wake up signal in the interrupt controller).
110110
*/
111-
void cpu_do_idle(void)
111+
void noinstr cpu_do_idle(void)
112112
{
113113
if (system_uses_irq_prio_masking())
114114
__cpu_do_idle_irqprio();
@@ -119,7 +119,7 @@ void cpu_do_idle(void)
119119
/*
120120
* This is our default idle handler.
121121
*/
122-
void arch_cpu_idle(void)
122+
void noinstr arch_cpu_idle(void)
123123
{
124124
/*
125125
* This should do all the clock switching and wait for interrupt

0 commit comments

Comments
 (0)