Messages in this thread Patch in this message | | | From | Stephen Brennan <> | Subject | [PATCH v2 1/4] panic: Add panic_in_progress helper | Date | Wed, 26 Jan 2022 15:02:33 -0800 |
| |
This helper will be used in printk code to avoid deadlocks during panic().
Suggested-by: Petr Mladek <pmladek@suse.com> Signed-off-by: Stephen Brennan <stephen.s.brennan@oracle.com> ---
Notes: v2: Switch to static inline function
include/linux/panic.h | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/include/linux/panic.h b/include/linux/panic.h index f5844908a089..1022ec930d34 100644 --- a/include/linux/panic.h +++ b/include/linux/panic.h @@ -4,6 +4,7 @@ #include <linux/compiler_attributes.h> #include <linux/types.h> +#include <linux/atomic.h> struct pt_regs; @@ -45,6 +46,11 @@ extern bool crash_kexec_post_notifiers; extern atomic_t panic_cpu; #define PANIC_CPU_INVALID -1 +static inline bool panic_in_progress(void) +{ + return unlikely(atomic_read(&panic_cpu) != PANIC_CPU_INVALID); +} + /* * Only to be used by arch init code. If the user over-wrote the default * CONFIG_PANIC_TIMEOUT, honor it. -- 2.30.2
| |