[Crash-utility] [PATCH] arm64 : Update the section_size_bits for latest kernel

HAGIO KAZUHITO(萩尾 一仁) k-hagio-ab at nec.com
Thu Nov 4 08:47:57 UTC 2021


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;

Thanks,
Kazu





More information about the Crash-utility mailing list