Hi guanyou

是的,crash工具加载MTK平台K419版本vmcore出现的问题。
看起来MTKlk阶段向vmcoreinfo写入"NUMBER(TCR_EL1_T1SZ)=25\n"导致的,而不是从在kernel通过读取tcr_el1获取TCR_EL1_T1SZ的值

 

Thanks

 

 

发件人: 陈冠有 <chenguanyou@xiaomi.com>
发送时间: 2024715 13:58
收件人: qiwu.chen(陈启武) <qiwu.chen@transsion.com>; devel@lists.crash-utility.osci.io
主题: 答复: [External Mail][Crash-utility] [PATCH] arm64: fix regression for the determination of VA_BITS and section_size_bits

 

你通常不会收到来自 chenguanyou@xiaomi.com 的电子邮件。了解这一点为什么很重要


发件人: qiwu.chen@transsion.com <qiwu.chen@transsion.com>
发送时间: 2024714 13:29:20
收件人: devel@lists.crash-utility.osci.io
主题: [External Mail][Crash-utility] [PATCH] arm64: fix regression for the determination of VA_BITS and section_size_bits

 

[外部邮件] 此邮件来源于小米公司外部,请谨慎处理。若对邮件安全性存疑,请将邮件转发给misec@xiaomi.com进行反馈

1. The commit f02c8e87 will cause a regression issue for the determination of VA_BITS
on Linux 4.19 and earlier kernels, the crash session fails during initialization with
the error message due to get a wrong vabits_actual:
vmcoreinfo : vabits_actual: 27
crash: invalid kernel virtual address: ffffffa890a41318  type: "kernel_config_data"
WARNING: cannot read kernel_config_data
crash: invalid kernel virtual address: ffffffa89106db50  type: "possible"
WARNING: cannot read cpu_possible_map
crash: invalid kernel virtual address: ffffffa89106db48  type: "present"
WARNING: cannot read cpu_present_map
crash: invalid kernel virtual address: ffffffa89106db40  type: "online"
WARNING: cannot read cpu_online_map
crash: invalid kernel virtual address: ffffffa89106db58  type: "active"
WARNING: cannot read cpu_active_map
crash: invalid kernel virtual address: ffffffa89143cb80  type: "shadow_timekeeper xtime_sec"
crash: invalid kernel virtual address: ffffffa89107b76c  type: "init_uts_ns"
WARNING: invalid linux_banner pointer: ffffffa890a30018
crash: vmlinux and SYS_COREDUMP do not match!

Fix it by remove arm64_set_va_bits_by_tcr() if vabits_actual is missing.

2. The commit 568c6f04 will cause a regression issue for the determination of section_size_bits
on Linux 5.12 and earlier kernels. The section_size_bits compatible with linux upstream and
android GKI changes should be:
Before android-12-GKI or Linux 5.12:
        SECTION_SIZE_BITS = 30

After android-12-gki:
    SECTION_SIZE_BITS = 27 when defined 4K_PAGES or 16K_PAGES.
    SECTION_SIZE_BITS = 29 when defined 64K_PAGES.

Fixes: f02c8e87 ("arm64: use TCR_EL1_T1SZ to get the correct info if vabits_actual is missing")
Fixes: 568c6f04 ("arm64: section_size_bits compatible with macro definitions")
Signed-off-by: qiwu.chen <qiwu.chen@transsion.com>
---
 arm64.c | 37 ++++++++++++++++++-------------------
 1 file changed, 18 insertions(+), 19 deletions(-)

diff --git a/arm64.c b/arm64.c
index b3040d7..176c465 100644
--- a/arm64.c
+++ b/arm64.c
@@ -1613,8 +1613,15 @@ arm64_get_section_size_bits(void)
 {
        int ret;
        char *string;
+       bool is_ikconfig_avail;

-       if (THIS_KERNEL_VERSION >= LINUX(5,12,0)) {
+       if (arm64_get_vmcoreinfo(&machdep->section_size_bits, "NUMBER(SECTION_SIZE_BITS)", NUM_DEC))
+               goto exit;
+
+       is_ikconfig_avail = kt->ikconfig_flags & IKCONFIG_AVAIL ? TRUE : FALSE;
+       /* The commit reduce section size for arm64 sparsemem is introduced on linux-v5.12 and android-12-GKI */
+       if (THIS_KERNEL_VERSION >= LINUX(5,12,0) || (is_ikconfig_avail &&
+               get_kernel_config("CONFIG_ANDROID_KABI_RESERVE", NULL) == IKCONFIG_Y)) {
                if (machdep->pagesize == 65536)
                        machdep->section_size_bits = _SECTION_SIZE_BITS_5_12_64K;
                else
@@ -1622,24 +1629,18 @@ arm64_get_section_size_bits(void)
        } else
                machdep->section_size_bits = _SECTION_SIZE_BITS;

-       if (arm64_get_vmcoreinfo(&machdep->section_size_bits, "NUMBER(SECTION_SIZE_BITS)", NUM_DEC)) {
-               /* nothing */
-       } 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)
-                               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;
-               else if ((ret = get_kernel_config("CONFIG_ARM64_64K_PAGES", NULL)) == IKCONFIG_Y)
-                       machdep->section_size_bits = _SECTION_SIZE_BITS_5_12_64K;
+       /* section_size_bits for arm64 vendor special case */
+       if (is_ikconfig_avail && get_kernel_config("CONFIG_MEMORY_HOTPLUG", NULL) == IKCONFIG_Y) {
+               if (get_kernel_config("CONFIG_HOTPLUG_SIZE_BITS", &string) == IKCONFIG_STR)
+                       machdep->section_size_bits = atol(string);
        }

-       if (CRASHDEBUG(1))
-               fprintf(fp, "SECTION_SIZE_BITS: %ld\n", machdep->section_size_bits);
+exit:
+       if (machdep->section_size_bits) {
+               if (CRASHDEBUG(1))
+                       fprintf(fp, "SECTION_SIZE_BITS: %ld\n", machdep->section_size_bits);
+       } else
+               error(FATAL, "cannot determine SECTION_SIZE_BITS\n");
 }

 /*
@@ -4733,8 +4734,6 @@ arm64_calc_VA_BITS(void)
                 */
                machdep->flags |= FLIPPED_VM;
                return;
-       } else if (arm64_set_va_bits_by_tcr()) {
-               return;
        } else if (machdep->machspec->VA_BITS_ACTUAL) {
                machdep->machspec->VA_BITS = machdep->machspec->VA_BITS_ACTUAL;
                machdep->machspec->VA_START = _VA_START(machdep->machspec->VA_BITS_ACTUAL);
--
2.25.1
--
Crash-utility mailing list -- devel@lists.crash-utility.osci.io
To unsubscribe send an email to devel-leave@lists.crash-utility.osci.io
https://${domain_name}/admin/lists/devel.lists.crash-utility.osci.io/
Contribution Guidelines: https://github.com/crash-utility/crash/wiki

#/******本邮件及其附件含有小米公司的保密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本邮件! This e-mail and its attachments contain confidential information from XIAOMI, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!******/#