On Thu, Nov 4, 2021 at 4:49 PM <crash-utility-request@redhat.com> wrote:
Date: Thu, 4 Nov 2021 08:47:57 +0000
From: HAGIO KAZUHITO(?????)     <k-hagio-ab@nec.com>
To: "er.ankurbansal@gmail.com" <er.ankurbansal@gmail.com>
Cc: "Discussion list for crash utility usage,   maintenance and
        development" <crash-utility@redhat.com>
Subject: Re: [Crash-utility] [PATCH] arm64 : Update the
        section_size_bits       for     latest kernel
Message-ID:
        <TYYPR01MB67775E90F3F2EF285ACF5E86DD8D9@TYYPR01MB6777.jpnprd01.prod.outlook.com>

Content-Type: text/plain; charset="iso-2022-jp"

Hi Ankur,

Thanks for the patch.

-----Original Message-----
> correct the section_size_bits for kernel version >= 5.12
> becuase of linux upstream change
> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=f0b13ee23241846f6f6cd0d
> 119a8ac8059416ec4
> (arm64/sparsemem: reduce SECTION_SIZE_BITS)
>
> Change-Id: I31b66fbfe421a02aa9f370ce7a615fbc70efcf2f
> ---
>  arm64.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/arm64.c b/arm64.c
> index 3dcbcc6..4a207fc 100644
> --- a/arm64.c
> +++ b/arm64.c
> @@ -1123,9 +1123,15 @@ arm64_get_section_size_bits(void)
>               free(string);
>       } else if (kt->ikconfig_flags & IKCONFIG_AVAIL) {
>               if ((ret = get_kernel_config("CONFIG_MEMORY_HOTPLUG", NULL)) == IKCONFIG_Y) {
> -                     if ((ret = get_kernel_config("CONFIG_HOTPLUG_SIZE_BITS", &string)) == IKCONFIG_STR)
> +                     if (THIS_KERNEL_VERSION >= LINUX(5,12,0)){
> +                             if((ret = get_kernel_config("CONFIG_ARM64_64K_PAGES", NULL)) == IKCONFIG_Y)
> +                                     machdep->section_size_bits = 29;
> +                             else
> +                                     machdep->section_size_bits = 27;
> +                     }
> +                     else if ((ret = get_kernel_config("CONFIG_HOTPLUG_SIZE_BITS", &string)) ==
> IKCONFIG_STR)

Considering dumpfiles without vmcoreinfo and IKCONFIG too, it will be better
to switch the default value of section_size_bits.  We can use machdep->pagesize
here, so how about this?

-       machdep->section_size_bits = _SECTION_SIZE_BITS;
+       if (THIS_KERNEL_VERSION >= LINUX(5,12,0)) {
+               if (machdep->pagesize == 65536)
+                       machdep->section_size_bits = 29;
+               else
+                       machdep->section_size_bits = 27;
+       } else
+               machdep->section_size_bits = _SECTION_SIZE_BITS;

 
This change covers more scenarios and looks good to me. Could you please update this patch? Ankur and Kazu.

Thanks.
Lianbo