Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Eric DeVolder <eric.devolder@oracle.com>
To: kexec@lists.infradead.org
Cc: boris.ostrovsky@oracle.com, eric.devolder@oracle.com
Subject: [PATCH v2 2/6] crashdump: introduce the hotplug command line options
Date: Wed,  3 May 2023 18:16:07 -0400	[thread overview]
Message-ID: <20230503221611.2119-3-eric.devolder@oracle.com> (raw)
In-Reply-To: <20230503221611.2119-1-eric.devolder@oracle.com>

Introducing the --hotplug and --elfcorehdrsz command line options,
which are used to indicate to the kernel that the kdump image
is setup to permit the kernel to directly modify the elfcorehdr in
response to CPU and memory hotplug and/or online/offline events.

This option is only meaningful for kexec_load() syscall. For the
kexec_file_load() syscall, this option is a no-op as the kernel
handles all aspects of loading the kdump image.

This change is just the command line processing portion; the handling
of hotplug is in the subsequent patches.

Signed-off-by: Eric DeVolder <eric.devolder@oracle.com>
---
 kexec/kexec.c | 15 +++++++++++++++
 kexec/kexec.h |  9 ++++++++-
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/kexec/kexec.c b/kexec/kexec.c
index 36bb2ad..4a64e53 100644
--- a/kexec/kexec.c
+++ b/kexec/kexec.c
@@ -58,6 +58,8 @@
 
 unsigned long long mem_min = 0;
 unsigned long long mem_max = ULONG_MAX;
+unsigned long elfcorehdrsz = 0;
+int do_hotplug = 0;
 static unsigned long kexec_flags = 0;
 /* Flags for kexec file (fd) based syscall */
 static unsigned long kexec_file_flags = 0;
@@ -1565,6 +1567,19 @@ int main(int argc, char *argv[])
 		case OPT_PRINT_CKR_SIZE:
 			print_crashkernel_region_size();
 			return 0;
+		case OPT_ELFCOREHDRSZ:
+			elfcorehdrsz = strtoul(optarg, &endptr, 0);
+			if (*endptr) {
+				fprintf(stderr,
+					"Bad option value in --elfcorehdrsz=%s\n",
+					optarg);
+				usage();
+				return 1;
+			}
+			break;
+		case OPT_HOTPLUG:
+			do_hotplug = 1;
+			break;
 		default:
 			break;
 		}
diff --git a/kexec/kexec.h b/kexec/kexec.h
index 0d820ad..fc24b67 100644
--- a/kexec/kexec.h
+++ b/kexec/kexec.h
@@ -231,7 +231,9 @@ extern int file_types;
 #define OPT_PRINT_CKR_SIZE	262
 #define OPT_LOAD_LIVE_UPDATE	263
 #define OPT_EXEC_LIVE_UPDATE	264
-#define OPT_MAX			265
+#define OPT_ELFCOREHDRSZ		265
+#define OPT_HOTPLUG		        266
+#define OPT_MAX		267
 #define KEXEC_OPTIONS \
 	{ "help",		0, 0, OPT_HELP }, \
 	{ "version",		0, 0, OPT_VERSION }, \
@@ -258,6 +260,8 @@ extern int file_types;
 	{ "debug",		0, 0, OPT_DEBUG }, \
 	{ "status",		0, 0, OPT_STATUS }, \
 	{ "print-ckr-size",     0, 0, OPT_PRINT_CKR_SIZE }, \
+	{ "elfcorehdrsz",		1, 0, OPT_ELFCOREHDRSZ }, \
+	{ "hotplug",		    0, 0, OPT_HOTPLUG }, \
 
 #define KEXEC_OPT_STR "h?vdfixyluet:pscaS"
 
@@ -295,6 +299,9 @@ extern int ifdown(void);
 extern char purgatory[];
 extern size_t purgatory_size;
 
+extern unsigned long elfcorehdrsz;
+extern int do_hotplug;
+
 #define BOOTLOADER "kexec"
 #define BOOTLOADER_VERSION PACKAGE_VERSION
 
-- 
2.31.1


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

  parent reply	other threads:[~2023-05-03 22:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-03 22:16 [PATCH v2 0/6] crashdump: Kernel handling of CPU and memory hot un/plug Eric DeVolder
2023-05-03 22:16 ` [PATCH v2 1/6] kexec: define KEXEC_UPDATE_ELFCOREHDR Eric DeVolder
2023-05-03 22:16 ` Eric DeVolder [this message]
2023-05-03 22:16 ` [PATCH v2 3/6] crashdump: setup hotplug support Eric DeVolder
2023-05-03 22:16 ` [PATCH v2 4/6] crashdump: exclude elfcorehdr segment from digest for hotplug Eric DeVolder
2023-05-03 22:16 ` [PATCH v2 5/6] crashdump/x86: identify elfcorehdr segment " Eric DeVolder
2023-05-03 22:16 ` [PATCH v2 6/6] crashdump/x86: set the elfcorehdr segment size " Eric DeVolder
2023-05-04  6:19 ` [PATCH v2 0/6] crashdump: Kernel handling of CPU and memory hot un/plug Hari Bathini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230503221611.2119-3-eric.devolder@oracle.com \
    --to=eric.devolder@oracle.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=kexec@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox