代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/kexec-tools 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 893ef61ca2b1e857b950654c1bb57f3624df5dc5 Mon Sep 17 00:00:00 2001
From: snoweay <snoweay@163.com>
Date: Wed, 12 Aug 2020 07:53:13 -0400
Subject: [PATCH] kexec: Add quick kexec support
Add quick kexec option -q and flags.
In normal kexec, relocating kernel may cost 5 ~ 10 seconds, to
copy all segments from vmalloced memory to kernel boot memory,
because of disabled mmu.
We introduce quick kexec to save time of copying memory as above,
just like kdump(kexec on crash), by using reserved memory.
We also add this support in syscall kexec_load of linux kernel
through flags of KEXEC_QUICK.
Add KEXEC_FLAGS_MAX to avoid conflicting with KEXEC_LIVE_UPDATE.
---
kexec/kexec-syscall.h | 2 ++
kexec/kexec-xen.h | 2 +-
kexec/kexec.c | 10 ++++++++++
kexec/kexec.h | 4 +++-
4 files changed, 16 insertions(+), 2 deletion(-)
diff --git a/kexec/kexec-syscall.h b/kexec/kexec-syscall.h
index bea29d4..5f22353 100644
--- a/kexec/kexec-syscall.h
+++ b/kexec/kexec-syscall.h
@@ -109,6 +109,8 @@ static inline long kexec_file_load(int kernel_fd, int initrd_fd,
#define KEXEC_ON_CRASH 0x00000001
#define KEXEC_PRESERVE_CONTEXT 0x00000002
+#define KEXEC_QUICK 0x00000004
+#define KEXEC_FLAGS_MAX 0x00000010
#define KEXEC_ARCH_MASK 0xffff0000
/* Flags for kexec file based system call */
diff --git a/kexec/kexec-xen.h b/kexec/kexec-xen.h
index 70fb576..d417c90 100644
--- a/kexec/kexec-xen.h
+++ b/kexec/kexec-xen.h
@@ -79,7 +79,7 @@ extern int __xc_interface_close(xc_interface *xch);
#endif
#ifndef KEXEC_LIVE_UPDATE
-#define KEXEC_LIVE_UPDATE 0x00000004
+#define KEXEC_LIVE_UPDATE KEXEC_FLAGS_MAX
#endif
int xen_get_kexec_range(int range, uint64_t *start, uint64_t *end);
diff --git a/kexec/kexec.c b/kexec/kexec.c
index f63b36b..5b8beca 100644
--- a/kexec/kexec.c
+++ b/kexec/kexec.c
@@ -1009,6 +1009,7 @@ void usage(void)
" -l, --load Load the new kernel into the\n"
" current kernel.\n"
" -p, --load-panic Load the new kernel for use on panic.\n"
+ " -q, --load-quick Load the new kernel to quick kexec\n"
" -u, --unload Unload the current kexec target kernel.\n"
" If capture kernel is being unloaded\n"
" specify -p with -u.\n"
@@ -1340,6 +1341,7 @@ int main(int argc, char *argv[])
int has_opt_load = 0;
int do_load = 1;
int do_exec = 0;
+ int do_quick = 0;
int do_load_jump_back_helper = 0;
int do_shutdown = 1;
int do_sync = 1, skip_sync = 0;
@@ -1460,6 +1462,14 @@ int main(int argc, char *argv[])
kexec_file_flags |= KEXEC_FILE_ON_CRASH;
kexec_flags = KEXEC_ON_CRASH;
break;
+ case OPT_QUICK:
+ do_load = 1;
+ do_exec = 0;
+ do_shutdown = 0;
+ do_quick = 1;
+ kexec_flags = KEXEC_QUICK;
+ skip_checks = 1;
+ break;
case OPT_MEM_MIN:
mem_min = strtoul(optarg, &endptr, 0);
if (*endptr) {
diff --git a/kexec/kexec.h b/kexec/kexec.h
index 595dd68..9cbc77f 100644
--- a/kexec/kexec.h
+++ b/kexec/kexec.h
@@ -218,6 +218,7 @@ extern int file_types;
#define OPT_UNLOAD 'u'
#define OPT_TYPE 't'
#define OPT_PANIC 'p'
+#define OPT_QUICK 'q'
#define OPT_KEXEC_FILE_SYSCALL 's'
#define OPT_KEXEC_SYSCALL 'c'
#define OPT_KEXEC_SYSCALL_AUTO 'a'
@@ -249,6 +250,7 @@ extern int file_types;
{ "entry", 1, 0, OPT_ENTRY }, \
{ "type", 1, 0, OPT_TYPE }, \
{ "load-panic", 0, 0, OPT_PANIC }, \
+ { "load-quick", 0, 0, OPT_QUICK }, \
{ "mem-min", 1, 0, OPT_MEM_MIN }, \
{ "mem-max", 1, 0, OPT_MEM_MAX }, \
{ "reuseinitrd", 0, 0, OPT_REUSE_INITRD }, \
@@ -259,7 +261,7 @@ extern int file_types;
{ "status", 0, 0, OPT_STATUS }, \
{ "print-ckr-size", 0, 0, OPT_PRINT_CKR_SIZE }, \
-#define KEXEC_OPT_STR "h?vdfixyluet:pscaS"
+#define KEXEC_OPT_STR "h?vdfixyluet:pqscaS"
extern void dbgprint_mem_range(const char *prefix, struct memory_range *mr, int nr_mr);
extern void die(const char *fmt, ...)
--
2.30.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。