• Eric DeVolder's avatar
    x86/crash: add x86 crash hotplug support · ea53ad9c
    Eric DeVolder authored
    When CPU or memory is hot un/plugged, or off/onlined, the crash
    elfcorehdr, which describes the CPUs and memory in the system, must also
    be updated.
    
    A new elfcorehdr is generated from the available CPUs and memory and
    replaces the existing elfcorehdr.  The segment containing the elfcorehdr
    is identified at run-time in crash_core:crash_handle_hotplug_event().
    
    No modifications to purgatory (see 'kexec: exclude elfcorehdr from the
    segment digest') or boot_params (as the elfcorehdr= capture kernel command
    line parameter pointer remains unchanged and correct) are needed, just
    elfcorehdr.
    
    For kexec_file_load(), the elfcorehdr segment size is based on NR_CPUS and
    CRASH_MAX_MEMORY_RANGES in order to accommodate a growing number of CPU
    and memory resources.
    
    For kexec_load(), the userspace kexec utility needs to size the elfcorehdr
    segment in the same/similar manner.
    
    To accommodate kexec_load() syscall in the absence of kexec_file_load()
    syscall support, prepare_elf_headers() and dependents are moved outside of
    CONFIG_KEXEC_FILE.
    
    [eric.devolder@oracle.com: correct unused function build error]
      Link: https://lkml.kernel.org/r/20230821182644.2143-1-eric.devolder@oracle.com
    Link: https://lkml.kernel.org/r/20230814214446.6659-6-eric.devolder@oracle.comSigned-off-by: default avatarEric DeVolder <eric.devolder@oracle.com>
    Reviewed-by: default avatarSourabh Jain <sourabhjain@linux.ibm.com>
    Acked-by: default avatarHari Bathini <hbathini@linux.ibm.com>
    Acked-by: default avatarBaoquan He <bhe@redhat.com>
    Cc: Akhil Raj <lf32.dev@gmail.com>
    Cc: Bjorn Helgaas <bhelgaas@google.com>
    Cc: Borislav Petkov (AMD) <bp@alien8.de>
    Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
    Cc: Dave Hansen <dave.hansen@linux.intel.com>
    Cc: Dave Young <dyoung@redhat.com>
    Cc: David Hildenbrand <david@redhat.com>
    Cc: Eric W. Biederman <ebiederm@xmission.com>
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Cc: "H. Peter Anvin" <hpa@zytor.com>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Jonathan Corbet <corbet@lwn.net>
    Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
    Cc: Mimi Zohar <zohar@linux.ibm.com>
    Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
    Cc: Oscar Salvador <osalvador@suse.de>
    Cc: "Rafael J. Wysocki" <rafael@kernel.org>
    Cc: Sean Christopherson <seanjc@google.com>
    Cc: Takashi Iwai <tiwai@suse.de>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Thomas Weißschuh <linux@weissschuh.net>
    Cc: Valentin Schneider <vschneid@redhat.com>
    Cc: Vivek Goyal <vgoyal@redhat.com>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    ea53ad9c
Kconfig 97.1 KB