[RFC][PATCHv2 6/8] kexec: switch to printk.emergency mode in unsafe places
From: Sergey Senozhatsky
Date: Wed Mar 29 2017 - 05:29:50 EST
Switch to printk emergency mode in kernel_kexec(), this
lets us to immediately flush pending kernel message to
the console and to avoid potentially unsafe calls into
the scheduler.
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@xxxxxxxxx>
---
kernel/kexec_core.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
index bfe62d5b3872..5684ba36ec15 100644
--- a/kernel/kexec_core.c
+++ b/kernel/kexec_core.c
@@ -1496,6 +1496,8 @@ int kernel_kexec(void)
goto Unlock;
}
+ printk_emergency_begin();
+
#ifdef CONFIG_KEXEC_JUMP
if (kexec_image->preserve_context) {
lock_system_sleep();
@@ -1565,6 +1567,8 @@ int kernel_kexec(void)
}
#endif
+ printk_emergency_end();
+
Unlock:
mutex_unlock(&kexec_mutex);
return error;
--
2.12.2