[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220126230236.750229-2-stephen.s.brennan@oracle.com>
Date: Wed, 26 Jan 2022 15:02:33 -0800
From: Stephen Brennan <stephen.s.brennan@...cle.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Arnd Bergmann <arnd@...db.de>,
Steven Rostedt <rostedt@...dmis.org>,
Stephen Brennan <stephen.s.brennan@...cle.com>,
Sebastian Reichel <sre@...nel.org>,
Sergey Senozhatsky <senozhatsky@...omium.org>,
John Ogness <john.ogness@...utronix.de>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Luis Chamberlain <mcgrof@...nel.org>,
linux-kernel@...r.kernel.org, Petr Mladek <pmladek@...e.com>
Subject: [PATCH v2 1/4] panic: Add panic_in_progress helper
This helper will be used in printk code to avoid deadlocks during
panic().
Suggested-by: Petr Mladek <pmladek@...e.com>
Signed-off-by: Stephen Brennan <stephen.s.brennan@...cle.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
Powered by blists - more mailing lists