Skip to content

Commit a7c2bb8

Browse files
dvhartozbenh
authored andcommitted
powerpc: Re-enable preemption before cpu_die()
start_secondary() is called shortly after _start and also via cpu_idle()->cpu_die()->pseries_mach_cpu_die() start_secondary() expects a preempt_count() of 0. pseries_mach_cpu_die() is called via the cpu_idle() routine with preemption disabled, resulting in the following repeating message during rapid cpu offline/online tests with CONFIG_PREEMPT=y: BUG: scheduling while atomic: swapper/0/0x00000002 Modules linked in: autofs4 binfmt_misc dm_mirror dm_region_hash dm_log [last unloaded: scsi_wait_scan] Call Trace: [c00000010e7079c0] [c0000000000133ec] .show_stack+0xd8/0x218 (unreliable) [c00000010e707aa0] [c0000000006a47f0] .dump_stack+0x28/0x3c [c00000010e707b20] [c00000000006e7a4] .__schedule_bug+0x7c/0x9c [c00000010e707bb0] [c000000000699d9c] .schedule+0x104/0x800 [c00000010e707cd0] [c000000000015b24] .cpu_idle+0x1c4/0x1d8 [c00000010e707d70] [c0000000006aa1b4] .start_secondary+0x398/0x3d4 [c00000010e707e30] [c000000000008278] .start_secondary_resume+0x10/0x14 Move the cpu_die() call inside the existing preemption enabled block of cpu_idle(). This is safe as the idle task is affined to a single CPU so the debug_smp_processor_id() tests (from cpu_should_die()) won't trigger as we are in a "migration disabled" region. Signed-off-by: Darren Hart <[email protected]> Acked-by: Will Schmidt <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Nathan Fontenot <[email protected]> Cc: Robert Jennings <[email protected]> Cc: Brian King <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
1 parent da9bef6 commit a7c2bb8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/powerpc/kernel/idle.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ void cpu_idle(void)
9494
HMT_medium();
9595
ppc64_runlatch_on();
9696
tick_nohz_restart_sched_tick();
97+
preempt_enable_no_resched();
9798
if (cpu_should_die())
9899
cpu_die();
99-
preempt_enable_no_resched();
100100
schedule();
101101
preempt_disable();
102102
}

0 commit comments

Comments
 (0)