[Crash-utility] Re: [PATCH] arm64: section_size_bits compatible with macro definitions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, Guanyou

Thank you for the patch.

On 4/17/24 19:55, devel-request@xxxxxxxxxxxxxxxxxxxxxxxxxxx wrote:
Date: Wed, 17 Apr 2024 19:55:40 +0800
From: Guanyou Chen<chenguanyou9338@xxxxxxxxx>
Subject:  [PATCH] arm64: section_size_bits compatible
	with macro definitions
To:k-hagio-ab@xxxxxxx,devel@xxxxxxxxxxxxxxxxxxxxxxxxxxx,      Lianbo
	<lijiang@xxxxxxxxxx>
Message-ID:
	<CAHS3RMXw5Ya44Nc+fFQqXdwYvHcDnq1RG7-zPpbqTOPoCb0YUw@xxxxxxxxxxxxxx>
Content-Type: multipart/mixed; boundary="000000000000492e3b0616498933"

--000000000000492e3b0616498933
Content-Type: multipart/alternative; boundary="000000000000492e390616498931"

--000000000000492e390616498931
Content-Type: text/plain; charset="UTF-8"

Hi Kazu,

Compatible with google android GKI changes,
SECTION_SIZE_BITS = 27 when defined 4K_PAGES or 16K_PAGES.
SECTION_SIZE_BITS = 29 when defined 64K_PAGES.

Link:
https://lore.kernel.org/lkml/15cf9a2359197fee0168f820c5c904650d07939e.1610146597.git.sudaraja@xxxxxxxxxxxxxx
Link:
https://lore.kernel.org/all/43843c5e092bfe3ec4c41e3c8c78a7ee35b69bb0.1611206601.git.sudaraja@xxxxxxxxxxxxxx

See:
https://cs.android.com/android/_/android/kernel/common/+/673e9ab6b64f981159aeff3b65675bb7dbedecd8
Before android-12-gki:
     crash> help -m | grep section_size_bits
        section_size_bits: 30

The first PFN error, the physical address should be 0x40000000.
     crash> kmem -p
           PAGE        PHYSICAL      MAPPING       INDEX CNT FLAGS
     ffffffff06e00000 200000000 ffffff80edf4fa12 ffffffff070f3640  1
4000000000002000 private

After android-12-gki:
     crash> help -m | grep section
        section_size_bits: 27

     crash> kmem -p
           PAGE        PHYSICAL      MAPPING       INDEX CNT FLAGS
     fffffffeffe00000  40000000                0        0  1 1000 reserved

The macro SECTION_SIZE_BITS has changed since kernel version 5.12, see:

kernel commit: f0b13ee23241 ("arm64/sparsemem: reduce SECTION_SIZE_BITS")

crash commit: 8246dce99dd2 ("arm64: Update SECTION_SIZE_BITS for kernels >= 5.12")


And later kernel exported the SECTION_SIZE_BITS in kernel version v5.13-rc7~20^2~10:

kernel commit: 4f5aecdff25f ("crash_core, vmcoreinfo: append 'SECTION_SIZE_BITS' to vmcoreinfo")


Crash-utility also reads the value from vmcoreinfo as below:

        if (arm64_get_vmcoreinfo(&machdep->section_size_bits, "NUMBER(SECTION_SIZE_BITS)", NUM_DEC))

So I'm wondering if this issue occurs on older kernels(e.g. 5.12 or earlier), and probably introduced some latest kernel patches(such as kernel commit f0b13ee23241) to the old kernel. Just want to confirm this.


Signed-off-by: chenguanyou<chenguanyou@xxxxxxxxxx>
---
  arm64.c | 11 ++++++++++-
  1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/arm64.c b/arm64.c
index e36c723..50e22ea 100644
--- a/arm64.c
+++ b/arm64.c
@@ -1629,7 +1629,16 @@ arm64_get_section_size_bits(void)
             if ((ret = get_kernel_config("CONFIG_HOTPLUG_SIZE_BITS",
&string)) == IKCONFIG_STR)
                 machdep->section_size_bits = atol(string);
         }
-   }
+
+       // arm64: reduce section size for sparsemem
+       if ((ret = get_kernel_config("CONFIG_ARM64_4K_PAGES", NULL)) ==
IKCONFIG_Y
+               || (ret = get_kernel_config("CONFIG_ARM64_16K_PAGES",
NULL)) == IKCONFIG_Y)
+           machdep->section_size_bits = _SECTION_SIZE_BITS_5_12;
+       // arm64/sparsemem: reduce SECTION_SIZE_BITS
+       else if ((ret = get_kernel_config("CONFIG_ARM64_64K_PAGES", NULL))
== IKCONFIG_Y)
+           machdep->section_size_bits = _SECTION_SIZE_BITS_5_12_64K;
+
+    }

The IKCONFIG may not be set for many distributions, but this looks like it works well in your cases.


Thanks.

Lianbo

     if (CRASHDEBUG(1))
         fprintf(fp, "SECTION_SIZE_BITS: %ld\n", machdep->section_size_bits);
-- 2.39.0
--
Crash-utility mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxxxxxx
https://${domain_name}/admin/lists/devel.lists.crash-utility.osci.io/
Contribution Guidelines: https://github.com/crash-utility/crash/wiki




[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux