Skip to content

Commit bab2623

Browse files
npigginmpe
authored andcommitted
powerpc: Offline CPU in stop_this_cpu()
printk_safe_flush_on_panic() has special lock breaking code for the case where we panic()ed with the console lock held. It relies on panic IPI causing other CPUs to mark themselves offline. Do as most other architectures do. This effectively reverts commit de6e5d3 ("powerpc: smp_send_stop do not offline stopped CPUs"), unfortunately it may result in some false positive warnings, but the alternative is more situations where we can crash without getting messages out. Fixes: de6e5d3 ("powerpc: smp_send_stop do not offline stopped CPUs") Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20210623041245.865134-1-npiggin@gmail.com
1 parent f5f48e8 commit bab2623

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

‎arch/powerpc/kernel/smp.c‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,8 @@ static void nmi_stop_this_cpu(struct pt_regs *regs)
619619
/*
620620
* IRQs are already hard disabled by the smp_handle_nmi_ipi.
621621
*/
622+
set_cpu_online(smp_processor_id(), false);
623+
622624
spin_begin();
623625
while (1)
624626
spin_cpu_relax();
@@ -634,6 +636,15 @@ void smp_send_stop(void)
634636
static void stop_this_cpu(void *dummy)
635637
{
636638
hard_irq_disable();
639+
640+
/*
641+
* Offlining CPUs in stop_this_cpu can result in scheduler warnings,
642+
* (see commit de6e5d38417e), but printk_safe_flush_on_panic() wants
643+
* to know other CPUs are offline before it breaks locks to flush
644+
* printk buffers, in case we panic()ed while holding the lock.
645+
*/
646+
set_cpu_online(smp_processor_id(), false);
647+
637648
spin_begin();
638649
while (1)
639650
spin_cpu_relax();

0 commit comments

Comments
 (0)