@@ -347,6 +347,29 @@ static bool panic_in_progress(void)
347
347
return unlikely (atomic_read (& panic_cpu ) != PANIC_CPU_INVALID );
348
348
}
349
349
350
+ /* Return true if a panic is in progress on the current CPU. */
351
+ bool this_cpu_in_panic (void )
352
+ {
353
+ /*
354
+ * We can use raw_smp_processor_id() here because it is impossible for
355
+ * the task to be migrated to the panic_cpu, or away from it. If
356
+ * panic_cpu has already been set, and we're not currently executing on
357
+ * that CPU, then we never will be.
358
+ */
359
+ return unlikely (atomic_read (& panic_cpu ) == raw_smp_processor_id ());
360
+ }
361
+
362
+ /*
363
+ * Return true if a panic is in progress on a remote CPU.
364
+ *
365
+ * On true, the local CPU should immediately release any printing resources
366
+ * that may be needed by the panic CPU.
367
+ */
368
+ bool other_cpu_in_panic (void )
369
+ {
370
+ return (panic_in_progress () && !this_cpu_in_panic ());
371
+ }
372
+
350
373
/*
351
374
* This is used for debugging the mess that is the VT code by
352
375
* keeping track if we have the console semaphore held. It's
@@ -2592,26 +2615,6 @@ static int console_cpu_notify(unsigned int cpu)
2592
2615
return 0 ;
2593
2616
}
2594
2617
2595
- /*
2596
- * Return true if a panic is in progress on a remote CPU.
2597
- *
2598
- * On true, the local CPU should immediately release any printing resources
2599
- * that may be needed by the panic CPU.
2600
- */
2601
- bool other_cpu_in_panic (void )
2602
- {
2603
- if (!panic_in_progress ())
2604
- return false;
2605
-
2606
- /*
2607
- * We can use raw_smp_processor_id() here because it is impossible for
2608
- * the task to be migrated to the panic_cpu, or away from it. If
2609
- * panic_cpu has already been set, and we're not currently executing on
2610
- * that CPU, then we never will be.
2611
- */
2612
- return atomic_read (& panic_cpu ) != raw_smp_processor_id ();
2613
- }
2614
-
2615
2618
/**
2616
2619
* console_lock - block the console subsystem from printing
2617
2620
*
0 commit comments