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

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

 



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

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;
+
+    }

    if (CRASHDEBUG(1))
        fprintf(fp, "SECTION_SIZE_BITS: %ld\n", machdep->section_size_bits);
--
2.39.0

Thanks,
Guanyou.Chen
From 4968c0923bf8554389902eeefd1557a41ad688b4 Mon Sep 17 00:00:00 2001
From: chenguanyou <chenguanyou@xxxxxxxxxx>
Date: Wed, 17 Apr 2024 17:46:44 +0800
Subject: [PATCH] arm64: section_size_bits compatible with macro definitions

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

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;
+
+    }
 
 	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