|
|
412566 |
From 5c4f786450ea61b87d4db0092288df83dd5cb454 Mon Sep 17 00:00:00 2001
|
|
|
412566 |
From: Qi Zheng <zhengqi.arch@bytedance.com>
|
|
|
412566 |
Date: Tue, 21 Dec 2021 15:40:31 +0800
|
|
|
412566 |
Subject: [PATCH 01/11] Fix pvops Xen detection for arm machine
|
|
|
412566 |
|
|
|
412566 |
Since the xen_start_info on the arm/arm64 platform points to a static
|
|
|
412566 |
variable '_xen_start_info'(see its definition as below), which makes
|
|
|
412566 |
that the address of xen_start_info will never be null.
|
|
|
412566 |
|
|
|
412566 |
arch/arm/xen/enlighten.c:40:static struct start_info _xen_start_info;
|
|
|
412566 |
arch/arm/xen/enlighten.c:41:struct start_info *xen_start_info = &_xen_start_info;
|
|
|
412566 |
arch/arm/xen/enlighten.c:42:EXPORT_SYMBOL(xen_start_info);
|
|
|
412566 |
|
|
|
412566 |
As a result, the is_pvops_xen() in commit 4badc6229c69 ("Fix pvops
|
|
|
412566 |
Xen detection for kernels >= v4.20") always returns TRUE because it
|
|
|
412566 |
can always read out the non-null address of xen_start_info, finally
|
|
|
412566 |
the following error will be reported on arm/arm64 platform(non-Xen
|
|
|
412566 |
environment) because p2m_mid_missing and xen_p2m_addr are not defined:
|
|
|
412566 |
|
|
|
412566 |
crash: cannot resolve "p2m_top"
|
|
|
412566 |
|
|
|
412566 |
For the arm/arm64 platform, fix it by using xen_vcpu_info instead of
|
|
|
412566 |
xen_start_info to detect Xen dumps.
|
|
|
412566 |
|
|
|
412566 |
In addition, also explicitly narrow the scope of the xen_start_info
|
|
|
412566 |
check to x86 with the machine_type(), there is no need to check it on
|
|
|
412566 |
other architectures.
|
|
|
412566 |
|
|
|
412566 |
Fixes: 4badc6229c69 ("Fix pvops Xen detection for kernels >= v4.20")
|
|
|
412566 |
Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com>
|
|
|
412566 |
Acked-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
|
|
412566 |
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
|
|
|
412566 |
---
|
|
|
412566 |
kernel.c | 20 +++++++++++++++-----
|
|
|
412566 |
1 file changed, 15 insertions(+), 5 deletions(-)
|
|
|
412566 |
|
|
|
412566 |
diff --git a/kernel.c b/kernel.c
|
|
|
412566 |
index 8ae9e0c169ff..a637dd0eb8f8 100644
|
|
|
412566 |
--- a/kernel.c
|
|
|
412566 |
+++ b/kernel.c
|
|
|
412566 |
@@ -10754,11 +10754,21 @@ is_pvops_xen(void)
|
|
|
412566 |
STREQ(sym, "paravirt_patch_default")))
|
|
|
412566 |
return TRUE;
|
|
|
412566 |
|
|
|
412566 |
- if (symbol_exists("xen_start_info") &&
|
|
|
412566 |
- readmem(symbol_value("xen_start_info"), KVADDR, &addr,
|
|
|
412566 |
- sizeof(void *), "xen_start_info", RETURN_ON_ERROR) &&
|
|
|
412566 |
- addr != 0)
|
|
|
412566 |
- return TRUE;
|
|
|
412566 |
+ if (machine_type("X86") || machine_type("X86_64")) {
|
|
|
412566 |
+ if (symbol_exists("xen_start_info") &&
|
|
|
412566 |
+ readmem(symbol_value("xen_start_info"), KVADDR, &addr,
|
|
|
412566 |
+ sizeof(void *), "xen_start_info", RETURN_ON_ERROR) &&
|
|
|
412566 |
+ addr != 0)
|
|
|
412566 |
+ return TRUE;
|
|
|
412566 |
+ }
|
|
|
412566 |
+
|
|
|
412566 |
+ if (machine_type("ARM") || machine_type("ARM64")) {
|
|
|
412566 |
+ if (symbol_exists("xen_vcpu_info") &&
|
|
|
412566 |
+ readmem(symbol_value("xen_vcpu_info"), KVADDR, &addr,
|
|
|
412566 |
+ sizeof(void *), "xen_vcpu_info", RETURN_ON_ERROR) &&
|
|
|
412566 |
+ addr != 0)
|
|
|
412566 |
+ return TRUE;
|
|
|
412566 |
+ }
|
|
|
412566 |
|
|
|
412566 |
return FALSE;
|
|
|
412566 |
}
|
|
|
412566 |
--
|
|
|
412566 |
2.20.1
|
|
|
412566 |
|