From df8f6bcc81f04cabd5b73b305732d2a5e49708d9 Mon Sep 17 00:00:00 2001 From: Tao Huang Date: Tue, 14 Nov 2017 15:02:57 +0800 Subject: [PATCH] pstore/console: ignore log level When printk to pstore console, we ignore log level. So /sys/fs/pstore/console-ramoops-0 should keep full kernel log. Change-Id: I87ea3418741c117523a9e872ae7ace4dac0cd9d3 Signed-off-by: Tao Huang --- fs/pstore/platform.c | 4 ++++ include/linux/console.h | 3 +++ kernel/printk/printk.c | 7 +++++++ 3 files changed, 14 insertions(+) diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c index 40a0fe0a4e05..97526024c962 100644 --- a/fs/pstore/platform.c +++ b/fs/pstore/platform.c @@ -403,7 +403,11 @@ static void pstore_console_write(struct console *con, const char *s, unsigned c) static struct console pstore_console = { .name = "pstore", .write = pstore_console_write, +#ifdef CON_PSTORE + .flags = CON_PRINTBUFFER | CON_ENABLED | CON_ANYTIME | CON_PSTORE, +#else .flags = CON_PRINTBUFFER | CON_ENABLED | CON_ANYTIME, +#endif .index = -1, }; diff --git a/include/linux/console.h b/include/linux/console.h index ea731af2451e..67cc09b887de 100644 --- a/include/linux/console.h +++ b/include/linux/console.h @@ -116,6 +116,9 @@ static inline int con_debug_leave(void) #define CON_ANYTIME (16) /* Safe to call when cpu is offline */ #define CON_BRL (32) /* Used for a braille device */ #define CON_EXTENDED (64) /* Use the extended output format a la /dev/kmsg */ +#if defined(CONFIG_ARCH_ROCKCHIP) && defined(CONFIG_PSTORE_CONSOLE) +#define CON_PSTORE (128) /* Print to pstore console anyway */ +#endif struct console { char name[16]; diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index b4573b55b435..f30a876531f0 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -1442,12 +1442,19 @@ static void call_console_drivers(int level, trace_console_rcuidle(text, len); +#ifndef CON_PSTORE if (level >= console_loglevel && !ignore_loglevel) return; +#endif if (!console_drivers) return; for_each_console(con) { +#ifdef CON_PSTORE + if (!(con->flags & CON_PSTORE) && + level >= console_loglevel && !ignore_loglevel) + continue; +#endif if (exclusive_console && con != exclusive_console) continue; if (!(con->flags & CON_ENABLED))