From: Eric DeVolder <eric.devolder@oracle.com>
To: kexec@lists.infradead.org
Subject: [PATCH v3 5/6] crash hp: kexec_file changes for crash hotplug support
Date: Mon, 10 Jan 2022 14:57:26 -0500 [thread overview]
Message-ID: <20220110195727.1682-6-eric.devolder@oracle.com> (raw)
In-Reply-To: <20220110195727.1682-1-eric.devolder@oracle.com>
Two important changes to note:
The kexec_calculate_store_digests() changed to specifically EXCLUDE
the elfcorehdr segment from its list of segments to check.
This is an important change as it allows, in a hotplug environment,
for the elfcorehdr segment (which contains the list of CPUs and
memory regions) to change dynamically without the need to update
purgatory (with the hash/digests of the segments it checks) as well.
The crash_prepare_elf64_headers() changed to look for the offline'd
CPU and exclude it. This due to the fact that the offline'd CPU is
still in the for_each_present_cpu() list at this point in time on
the cpu hotplug handler path.
Signed-off-by: Eric DeVolder <eric.devolder@oracle.com>
---
kernel/kexec_file.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
index 8347fc158d2b..339995d42169 100644
--- a/kernel/kexec_file.c
+++ b/kernel/kexec_file.c
@@ -765,6 +765,12 @@ static int kexec_calculate_store_digests(struct kimage *image)
for (j = i = 0; i < image->nr_segments; i++) {
struct kexec_segment *ksegment;
+#ifdef CONFIG_CRASH_HOTPLUG
+ /* This segment excluded to allow future changes via hotplug */
+ if (image->elf_index_valid && (j == image->elf_index))
+ continue;
+#endif
+
ksegment = &image->segment[i];
/*
* Skip purgatory as it will be modified once we put digest
@@ -1260,8 +1266,8 @@ int crash_exclude_mem_range(struct crash_mem *mem,
return 0;
}
-int crash_prepare_elf64_headers(struct crash_mem *mem, int kernel_map,
- void **addr, unsigned long *sz)
+int crash_prepare_elf64_headers(struct kimage *image, struct crash_mem *mem,
+ int kernel_map, void **addr, unsigned long *sz)
{
Elf64_Ehdr *ehdr;
Elf64_Phdr *phdr;
@@ -1308,6 +1314,11 @@ int crash_prepare_elf64_headers(struct crash_mem *mem, int kernel_map,
/* Prepare one phdr of type PT_NOTE for each present CPU */
for_each_present_cpu(cpu) {
+#ifdef CONFIG_CRASH_HOTPLUG
+ /* Skip the soon-to-be offlined cpu */
+ if (image->hotplug_event && (cpu == image->offlinecpu))
+ continue;
+#endif
phdr->p_type = PT_NOTE;
notes_addr = per_cpu_ptr_to_phys(per_cpu_ptr(crash_notes, cpu));
phdr->p_offset = phdr->p_paddr = notes_addr;
--
2.27.0
next prev parent reply other threads:[~2022-01-10 19:57 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-10 19:57 [PATCH v3 0/6] crash: Kernel handling of CPU and memory hot un/plug Eric DeVolder
2022-01-10 19:57 ` [PATCH v3 1/6] crash: fix minor typo/bug in debug message Eric DeVolder
2022-01-10 19:57 ` [PATCH v3 2/6] crash hp: Introduce CRASH_HOTPLUG configuration options Eric DeVolder
2022-01-10 19:57 ` [PATCH v3 3/6] crash hp: definitions and prototype changes Eric DeVolder
2022-01-19 8:26 ` Baoquan He
2022-01-21 13:48 ` Eric DeVolder
2022-01-26 8:03 ` Baoquan He
2022-01-10 19:57 ` [PATCH v3 4/6] crash hp: generic crash hotplug support infrastructure Eric DeVolder
2022-01-10 19:57 ` Eric DeVolder [this message]
2022-01-10 19:57 ` [PATCH v3 6/6] crash hp: Add x86 crash hotplug support Eric DeVolder
2022-01-19 10:23 ` Baoquan He
2022-01-21 14:06 ` Eric DeVolder
2022-01-26 9:12 ` Baoquan He
2022-01-26 17:32 ` Eric DeVolder
2022-01-27 7:51 ` Baoquan He
2022-01-27 6:51 ` [PATCH v3 0/6] crash: Kernel handling of CPU and memory hot un/plug Baoquan He
2022-02-09 20:01 ` Eric DeVolder
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=20220110195727.1682-6-eric.devolder@oracle.com \
--to=eric.devolder@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;
as well as URLs for NNTP newsgroup(s).