[PATCH 1/2] Introduce add_taint variant that does not print warning.

From: Mahesh J Salgaonkar
Date: Mon Feb 20 2017 - 23:21:41 EST


From: Mahesh Salgaonkar <mahesh@xxxxxxxxxxxxxxxxxx>

Some interrupt handler's may not be happy to call printk and would lead to
unexpected behavior or kernel panic. e.g. machine_check_early() from MCE
handler on OPAL based system. Introduce add_taint variant that does not call
printk.

Signed-off-by: Mahesh Salgaonkar <mahesh@xxxxxxxxxxxxxxxxxx>
---
include/linux/kernel.h | 1 +
kernel/panic.c | 6 ++++++
2 files changed, 7 insertions(+)

diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index cb09238..799943e 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -480,6 +480,7 @@ enum lockdep_ok {
LOCKDEP_NOW_UNRELIABLE
};
extern void add_taint(unsigned flag, enum lockdep_ok);
+extern void add_taint_no_warn(unsigned flag, enum lockdep_ok);
extern int test_taint(unsigned flag);
extern unsigned long get_taint(void);
extern int root_mountflags;
diff --git a/kernel/panic.c b/kernel/panic.c
index 08aa88d..d344ea3 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -392,6 +392,12 @@ void add_taint(unsigned flag, enum lockdep_ok lockdep_ok)
}
EXPORT_SYMBOL(add_taint);

+void add_taint_no_warn(unsigned flag, enum lockdep_ok lockdep_ok)
+{
+ set_bit(flag, &tainted_mask);
+}
+EXPORT_SYMBOL(add_taint_no_warn);
+
static void spin_msec(int msecs)
{
int i;