hc
2024-05-10 61598093bbdd283a7edc367d900f223070ead8d2
kernel/kernel/kexec_internal.h
....@@ -13,7 +13,22 @@
1313 int kimage_is_destination_range(struct kimage *image,
1414 unsigned long start, unsigned long end);
1515
16
-extern struct mutex kexec_mutex;
16
+int machine_kexec_post_load(struct kimage *image);
17
+
18
+/*
19
+ * Whatever is used to serialize accesses to the kexec_crash_image needs to be
20
+ * NMI safe, as __crash_kexec() can happen during nmi_panic(), so here we use a
21
+ * "simple" atomic variable that is acquired with a cmpxchg().
22
+ */
23
+extern atomic_t __kexec_lock;
24
+static inline bool kexec_trylock(void)
25
+{
26
+ return atomic_cmpxchg_acquire(&__kexec_lock, 0, 1) == 0;
27
+}
28
+static inline void kexec_unlock(void)
29
+{
30
+ atomic_set_release(&__kexec_lock, 0);
31
+}
1732
1833 #ifdef CONFIG_KEXEC_FILE
1934 #include <linux/purgatory.h>