[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1454243623-15109-2-git-send-email-sergey.senozhatsky@gmail.com>
Date: Sun, 31 Jan 2016 21:33:42 +0900
From: Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
To: Peter Hurley <peter@...leysoftware.com>
Cc: Byungchul Park <byungchul.park@....com>, akpm@...ux-foundation.org,
mingo@...nel.org, linux-kernel@...r.kernel.org,
akinobu.mita@...il.com, jack@...e.cz,
torvalds@...ux-foundation.org,
Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>
Subject: [PATCH 2/3] printk: introduce reset_console_drivers()
Console driver(-s) can be in any state when CPU stop IPI
arrives from panic() issued on another CPU, so
console_flush_on_panic()->console_unlock() can call
con->write() callback on a locked console driver.
Introduce reset_console_drivers() that attempts to reset()
every console in via a console driver specific ->reset()
call.
Invoke reset_console_drivers() from console_reset_on_panic().
WARNING
=======
console_reset_on_panic() needs to be fixed.
Not-Yet-Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@...il.com>
---
include/linux/console.h | 1 +
kernel/printk/printk.c | 10 ++++++++++
2 files changed, 11 insertions(+)
diff --git a/include/linux/console.h b/include/linux/console.h
index 6edc2ea..f745ffe 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -125,6 +125,7 @@ struct console {
void (*unblank)(void);
int (*setup)(struct console *, char *);
int (*match)(struct console *, char *name, int idx, char *options);
+ void (*reset)(struct console *);
short flags;
short index;
int cflag;
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 34642f7..e245f9f 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -1462,6 +1462,15 @@ static void call_console_drivers(int level,
}
}
+static void reset_console_drivers(void)
+{
+ struct console *con;
+
+ for_each_console(con)
+ if ((con->flags & CON_ENABLED) && con->reset)
+ con->reset(con);
+}
+
/*
* Zap console related locks when oopsing.
* To leave time for slow consoles to print a full oops,
@@ -2397,6 +2406,7 @@ void console_flush_on_panic(void)
void console_reset_on_panic(void)
{
zap_locks();
+ reset_console_drivers();
}
/*
--
2.7.0
Powered by blists - more mailing lists