@@ -124,6 +124,16 @@ static inline void cpu_panic_kernel(void)
cpu_park_loop();
}
+/*
+ * If a secondary CPU fails to come online, (e.g. due to mismatched features),
+ * it will try to call cpu_die(). If this fails, it updates
+ * cpus_stuck_in_kernel and sits in cpu_park_loop().
+ *
+ * Kexec checks this counter and refuses to load/kexec if it is non-zero, as
+ * cpu_park_loop() would be overwritten releasing the parked cpus.
+ */
+bool cpus_are_stuck_in_kernel(void);
+
#endif /* ifndef __ASSEMBLY__ */
#endif /* ifndef __ASM_SMP_H */
@@ -909,3 +909,8 @@ int setup_profiling_timer(unsigned int multiplier)
{
return -EINVAL;
}
+
+bool cpus_are_stuck_in_kernel(void)
+{
+ return !!cpus_stuck_in_kernel;
+}