lkml.org 
[lkml]   [2017]   [Mar]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC][PATCHv2 7/8] printk: add printk emergency_mode parameter
Date
This param permits user-space to forcibly on/off printk emergency
mode via /sys/module/printk/parameters/emergency_mode node.

We have annotated sections in the kernel that switch printk to
emergency, but there might be places/cases when user space would
want to have printk operate in emergency mode all the time.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
---
kernel/printk/printk.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 1927b5cb5cbe..0d96839bb450 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -455,7 +455,7 @@ static struct task_struct *printk_kthread __read_mostly;
static atomic_t printk_emergency __read_mostly;
/*
* Disable printk_kthread permanently. Unlike `oops_in_progress'
- * it doesn't go back to 0.
+ * it doesn't go back to 0 (unless enforced by user-space).
*/
static bool printk_kthread_disabled __read_mostly;

@@ -483,6 +483,24 @@ void printk_emergency_end(void)
atomic_dec(&printk_emergency);
}

+static int printk_kthread_disabled_set(const char *val,
+ const struct kernel_param *kp)
+{
+ return param_set_bool(val, kp);
+}
+
+static const struct kernel_param_ops printk_kthread_disabled_ops = {
+ .set = printk_kthread_disabled_set,
+ .get = param_get_bool,
+};
+
+module_param_cb(emergency_mode,
+ &printk_kthread_disabled_ops,
+ &printk_kthread_disabled,
+ 0644);
+MODULE_PARM_DESC(emergency_mode,
+ "don't offload message printing to printk kthread");
+
/* Return log buffer address */
char *log_buf_addr_get(void)
{
--
2.12.2
\
 
 \ /
  Last update: 2017-03-29 11:30    [W:0.197 / U:0.280 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site