Messages in this thread Patch in this message | | | Date | Wed, 28 Sep 2022 18:38:53 +0200 | From | Borislav Petkov <> | Subject | Re: [PATCH v12 7/7] x86/crash: Add x86 crash hotplug support |
| |
On Wed, Sep 28, 2022 at 06:07:24PM +0200, Borislav Petkov wrote: > #if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_MEMORY_HOTPLUG) > /* Ensure elfcorehdr segment large enough for hotplug changes */ > @@ -407,9 +408,8 @@ int crash_load_segments(struct kimage *image) > image->elf_headers_sz = kbuf.memsz; > image->elfcorehdr_index = image->nr_segments; > image->elfcorehdr_index_valid = true;
And that ifdeffery above can be made more readable too:
diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c index a526c893abe8..7aab6e942761 100644 --- a/arch/x86/kernel/crash.c +++ b/arch/x86/kernel/crash.c @@ -399,16 +399,15 @@ int crash_load_segments(struct kimage *image) image->elf_headers_sz = kbuf.bufsz; kbuf.memsz = kbuf.bufsz; -#if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_MEMORY_HOTPLUG) /* Ensure elfcorehdr segment large enough for hotplug changes */ - kbuf.memsz = - (CONFIG_NR_CPUS_DEFAULT + CONFIG_CRASH_MAX_MEMORY_RANGES) * - sizeof(Elf64_Phdr); - /* Mark as usable to crash kernel, else crash kernel fails on boot */ - image->elf_headers_sz = kbuf.memsz; - image->elfcorehdr_index = image->nr_segments; - image->elfcorehdr_index_valid = true; -#endif + if (IS_ENABLED(CONFIG_CRASH_MAX_MEMORY_RANGES)) { + kbuf.memsz = (CONFIG_NR_CPUS_DEFAULT + CONFIG_CRASH_MAX_MEMORY_RANGES) * sizeof(Elf64_Phdr); + + /* Mark as usable to crash kernel, else crash kernel fails on boot */ + image->elf_headers_sz = kbuf.memsz; + image->elfcorehdr_index = image->nr_segments; + image->elfcorehdr_index_valid = true; + } kbuf.buf_align = ELF_CORE_HEADER_ALIGN; kbuf.mem = KEXEC_BUF_MEM_UNKNOWN; -- Regards/Gruss, Boris.
https://people.kernel.org/tglx/notes-about-netiquette
| |