[PATCH] crash_core, vmcoreinfo: Append 'SECTION_SIZE_BITS' to vmcoreinfo

Pingfan Liu kernelfans at gmail.com
Tue Jun 8 17:16:46 PDT 2021


Correct mail address of Kazuhito

On Tue, Jun 8, 2021 at 6:34 PM Pingfan Liu <kernelfans at gmail.com> wrote:
>
> As mentioned in kernel commit 1d50e5d0c505 ("crash_core, vmcoreinfo:
> Append 'MAX_PHYSMEM_BITS' to vmcoreinfo"), SECTION_SIZE_BITS in the
> formula:
>     #define SECTIONS_SHIFT    (MAX_PHYSMEM_BITS - SECTION_SIZE_BITS)
>
> Besides SECTIONS_SHIFT, SECTION_SIZE_BITS is also used to calculate
> PAGES_PER_SECTION in makedumpfile just like kernel.
>
> Unfortunately, this arch-dependent macro SECTION_SIZE_BITS changes, e.g.
> recently in kernel commit f0b13ee23241 ("arm64/sparsemem: reduce
> SECTION_SIZE_BITS"). But user space wants a stable interface to get this
> info. Such info is impossible to be deduced from a crashdump vmcore.
> Hence append SECTION_SIZE_BITS to vmcoreinfo.
>
> Signed-off-by: Pingfan Liu <kernelfans at gmail.com>
> Cc: Bhupesh Sharma <bhupesh.sharma at linaro.org>
> Cc: Kazuhito Hagio <k-hagio at ab.jp.nec.com>
> Cc: Dave Young <dyoung at redhat.com>
> Cc: Baoquan He <bhe at redhat.com>
> Cc: Boris Petkov <bp at alien8.de>
> Cc: Ingo Molnar <mingo at kernel.org>
> Cc: Thomas Gleixner <tglx at linutronix.de>
> Cc: James Morse <james.morse at arm.com>
> Cc: Mark Rutland <mark.rutland at arm.com>
> Cc: Will Deacon <will at kernel.org>
> Cc: Catalin Marinas <catalin.marinas at arm.com>
> Cc: Michael Ellerman <mpe at ellerman.id.au>
> Cc: Paul Mackerras <paulus at samba.org>
> Cc: Benjamin Herrenschmidt <benh at kernel.crashing.org>
> Cc: Dave Anderson <anderson at redhat.com>
> Cc: linuxppc-dev at lists.ozlabs.org
> Cc: linux-kernel at vger.kernel.org
> Cc: kexec at lists.infradead.org
> Cc: x86 at kernel.org
> Cc: linux-arm-kernel at lists.infradead.org
> ---
>  kernel/crash_core.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/kernel/crash_core.c b/kernel/crash_core.c
> index 825284baaf46..684a6061a13a 100644
> --- a/kernel/crash_core.c
> +++ b/kernel/crash_core.c
> @@ -464,6 +464,7 @@ static int __init crash_save_vmcoreinfo_init(void)
>         VMCOREINFO_LENGTH(mem_section, NR_SECTION_ROOTS);
>         VMCOREINFO_STRUCT_SIZE(mem_section);
>         VMCOREINFO_OFFSET(mem_section, section_mem_map);
> +       VMCOREINFO_NUMBER(SECTION_SIZE_BITS);
>         VMCOREINFO_NUMBER(MAX_PHYSMEM_BITS);
>  #endif
>         VMCOREINFO_STRUCT_SIZE(page);
> --
> 2.29.2
>



More information about the kexec mailing list