Hi Lianbo, Ankur,

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

I've updated, does this work well?

--
>From 9d6fca4d951f8bbb8c83078339e092da2d2fb0e0 Mon Sep 17 00:00:00 2001
From: Kazuhito Hagio <[email protected]>
Date: Thu, 11 Nov 2021 15:20:52 +0900
Subject: [PATCH] arm64: Update SECTION_SIZE_BITS for kernels >= 5.12

Update the default SECTION_SIZE_BITS value for arm64 Linux 5.12
and later kernels that contain kernel commit f0b13ee23241
("arm64/sparsemem: reduce SECTION_SIZE_BITS").

Reported-by: Ankur Bansal <[email protected]>
Signed-off-by: Kazuhito Hagio <[email protected]>
---
 arm64.c | 8 +++++++-
 defs.h  | 4 +++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/arm64.c b/arm64.c
index 3dcbcc642fda..94681d1a37db 100644
--- a/arm64.c
+++ b/arm64.c
@@ -1116,7 +1116,13 @@ arm64_get_section_size_bits(void)
        int ret;
        char *string;
 
-       machdep->section_size_bits = _SECTION_SIZE_BITS;
+       if (THIS_KERNEL_VERSION >= LINUX(5,12,0)) {
+               if (machdep->pagesize == 65536)
+                       machdep->section_size_bits = 
_SECTION_SIZE_BITS_5_12_64K;
+               else
+                       machdep->section_size_bits = _SECTION_SIZE_BITS_5_12;
+       } else
+               machdep->section_size_bits = _SECTION_SIZE_BITS;
 
        if ((string = pc->read_vmcoreinfo("NUMBER(SECTION_SIZE_BITS)"))) {
                machdep->section_size_bits = atol(string);
diff --git a/defs.h b/defs.h
index 971005596506..a2f30853a4b1 100644
--- a/defs.h
+++ b/defs.h
@@ -3261,7 +3261,9 @@ typedef signed int s32;
 #define ARM64_STACK_SIZE   (16384)
 #define ARM64_IRQ_STACK_SIZE   ARM64_STACK_SIZE
 
-#define _SECTION_SIZE_BITS      30
+#define _SECTION_SIZE_BITS           30
+#define _SECTION_SIZE_BITS_5_12      27
+#define _SECTION_SIZE_BITS_5_12_64K  29
 #define _MAX_PHYSMEM_BITS       40
 #define _MAX_PHYSMEM_BITS_3_17  48
 #define _MAX_PHYSMEM_BITS_52    52
-- 
2.27.0


--
Crash-utility mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/crash-utility

Reply via email to