<div dir="ltr"><div>This change looks good to me.</div><div>Acked-by: Lianbo Jiang <<a href="mailto:lijiang@redhat.com">lijiang@redhat.com</a>></div><div><br></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Oct 25, 2021 at 4:58 PM <<a href="mailto:crash-utility-request@redhat.com">crash-utility-request@redhat.com</a>> wrote:</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
From: Kazuhito Hagio <<a href="mailto:k-hagio-ab@nec.com" target="_blank">k-hagio-ab@nec.com</a>><br>
Date: Mon, 25 Oct 2021 16:53:26 +0900<br>
Subject: [PATCH] arm64: Use VA_BITS for page_offset calculation<br>
<br>
Commit 167d37e347fe ("arm64: assign page_offset with VA_BITS kernel<br>
configuration value") changed the page_offset calculation from<br>
using VA_BITS_ACTUAL to CONFIG_ARM64_VA_BITS.  This caused an error<br>
for ramdumps without vmcoreinfo like this:<br>
<br>
  crash: vmlinux and /var/tmp/ramdump_elf_XUtCMT do not match!<br>
<br>
Set the vmcoreinfo value to VA_BITS if available, and use VA_BITS<br>
for page_offset calculation instead.<br>
<br>
Also remove ARM64_FLIP_PAGE_OFFSET_ACTUAL because it's not used<br>
actually.<br>
<br>
Reported-by: Ankur Bansal <<a href="mailto:er.ankurbansal@gmail.com" target="_blank">er.ankurbansal@gmail.com</a>><br>
Signed-off-by: Kazuhito Hagio <<a href="mailto:k-hagio-ab@nec.com" target="_blank">k-hagio-ab@nec.com</a>><br>
---<br>
 arm64.c | 5 ++++-<br>
 defs.h  | 4 +---<br>
 2 files changed, 5 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/arm64.c b/arm64.c<br>
index 7069312671cf..3dcbcc642fda 100644<br>
--- a/arm64.c<br>
+++ b/arm64.c<br>
@@ -404,7 +404,7 @@ arm64_init(int when)<br>
                                fprintf(fp, "CONFIG_ARM64_VA_BITS: %ld\n", ms->CONFIG_ARM64_VA_BITS);<br>
                                fprintf(fp, "      VA_BITS_ACTUAL: %ld\n", ms->VA_BITS_ACTUAL);<br>
                                fprintf(fp, "(calculated) VA_BITS: %ld\n", ms->VA_BITS);<br>
-                               fprintf(fp, " PAGE_OFFSET: %lx\n", ARM64_FLIP_PAGE_OFFSET_ACTUAL);<br>
+                               fprintf(fp, " PAGE_OFFSET: %lx\n", ARM64_FLIP_PAGE_OFFSET);<br>
                                fprintf(fp, "    VA_START: %lx\n", ms->VA_START);<br>
                                fprintf(fp, "     modules: %lx - %lx\n", ms->modules_vaddr, ms->modules_end);<br>
                                fprintf(fp, "     vmalloc: %lx - %lx\n", ms->vmalloc_start_addr, ms->vmalloc_end);<br>
@@ -4031,6 +4031,9 @@ arm64_calc_VA_BITS(void)<br>
                                error(FATAL, "cannot determine VA_BITS_ACTUAL\n");<br>
                }<br>
<br>
+               if (machdep->machspec->CONFIG_ARM64_VA_BITS)<br>
+                       machdep->machspec->VA_BITS = machdep->machspec->CONFIG_ARM64_VA_BITS;<br>
+<br>
                /*<br>
                 * The mm flip commit is introduced before 52-bits VA, which is before the<br>
                 * commit to export NUMBER(TCR_EL1_T1SZ)<br>
diff --git a/defs.h b/defs.h<br>
index 8b356d5e8959..971005596506 100644<br>
--- a/defs.h<br>
+++ b/defs.h<br>
@@ -3238,9 +3238,7 @@ typedef signed int s32;<br>
 #define ARM64_PAGE_OFFSET    ((0xffffffffffffffffUL) \<br>
                                        << (machdep->machspec->VA_BITS - 1))<br>
 /* kernels >= v5.4 the kernel VA space is flipped */<br>
-#define ARM64_FLIP_PAGE_OFFSET (-(1UL) << machdep->machspec->CONFIG_ARM64_VA_BITS)<br>
-#define ARM64_FLIP_PAGE_OFFSET_ACTUAL ((0xffffffffffffffffUL) \<br>
-                                       - ((1UL) << machdep->machspec->VA_BITS_ACTUAL) + 1)<br>
+#define ARM64_FLIP_PAGE_OFFSET (-(1UL) << machdep->machspec->VA_BITS)<br>
<br>
 #define ARM64_USERSPACE_TOP  ((1UL) << machdep->machspec->VA_BITS)<br>
 #define ARM64_USERSPACE_TOP_ACTUAL  ((1UL) << machdep->machspec->VA_BITS_ACTUAL)<br>
-- <br>
2.27.0<br></blockquote></div></div>