提交 865d69ce 编写于 作者: J Jason A. Donenfeld 提交者: Zheng Zengkai

um: add "noreboot" command line option for PANIC_TIMEOUT=-1 setups

stable inclusion
from stable-v5.10.138
commit 9a6178c225e9037013afa603005b322fda760d8c
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I60QFD

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=9a6178c225e9037013afa603005b322fda760d8c

--------------------------------

[ Upstream commit dda520d0 ]

QEMU has a -no-reboot option, which halts instead of reboots when the
guest asks to reboot. This is invaluable when used with
CONFIG_PANIC_TIMEOUT=-1 (and panic_on_warn), because it allows panics
and warnings to be caught immediately in CI. Implement this in UML too,
by way of a basic setup param.
Signed-off-by: NJason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: NRichard Weinberger <richard@nod.at>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Reviewed-by: NWei Li <liwei391@huawei.com>
上级 acd0ce81
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
*/ */
#include <stdlib.h> #include <stdlib.h>
#include <stdbool.h>
#include <unistd.h> #include <unistd.h>
#include <sched.h> #include <sched.h>
#include <errno.h> #include <errno.h>
...@@ -644,10 +645,24 @@ void halt_skas(void) ...@@ -644,10 +645,24 @@ void halt_skas(void)
UML_LONGJMP(&initial_jmpbuf, INIT_JMP_HALT); UML_LONGJMP(&initial_jmpbuf, INIT_JMP_HALT);
} }
static bool noreboot;
static int __init noreboot_cmd_param(char *str, int *add)
{
noreboot = true;
return 0;
}
__uml_setup("noreboot", noreboot_cmd_param,
"noreboot\n"
" Rather than rebooting, exit always, akin to QEMU's -no-reboot option.\n"
" This is useful if you're using CONFIG_PANIC_TIMEOUT in order to catch\n"
" crashes in CI\n");
void reboot_skas(void) void reboot_skas(void)
{ {
block_signals_trace(); block_signals_trace();
UML_LONGJMP(&initial_jmpbuf, INIT_JMP_REBOOT); UML_LONGJMP(&initial_jmpbuf, noreboot ? INIT_JMP_HALT : INIT_JMP_REBOOT);
} }
void __switch_mm(struct mm_id *mm_idp) void __switch_mm(struct mm_id *mm_idp)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册