[Crash-utility] [PATCH] arm64 : assign page_offset and kvbase based on VA_BITS passed

HAGIO KAZUHITO(萩尾 一仁) k-hagio-ab at nec.com
Thu Oct 14 03:17:20 UTC 2021


Hi Ankur,

-----Original Message-----
> 	>> assign page_offset and kvbase based on VA_BITS passed
> 	>>
> 
> 	>Thank you for the patch, Ankur.
> 	>Can you help to describe the reason in detail? And what happened?
> 
> 
> 
> Hi Lianbo, Raw ramdump without vmcoreinfo doesn't work here.
> read_vmcoreinfo("NUMBER(BA_BITS)") will not work on raw ramdump.
> getting below error
> 
> crash_64: vmlinux and /var/tmp/ramdump_elf_XUtCMT do not match!
> Usage:
> crash [OPTION]... NAMELIST MEMORY-IMAGE[@address <https://github.com/address> ] (dumpfile form)
> crash [OPTION]... [NAMELIST] (live system form)
> Enter "crash_64 -h" for details.
> 
> Recent change https://github.com/crash-utility/crash/commit/167d37e347fe35c6f7db826e8539e192c4375564 is
> causing this issue, before this change VA_BITS_ACTUAL was used which is passed from cmd line.

ok, I see, but I'm not sure why your patch uses the (pc->flags2 & SNAP) condition.
The calculation used VA_BITS_ACTUAL (== VA_BITS for ramdump) before the change,
so how about the following patch?

diff --git a/arm64.c b/arm64.c
index 7069312671cf..da78acbb013f 100644
--- a/arm64.c
+++ b/arm64.c
@@ -4031,6 +4031,9 @@ arm64_calc_VA_BITS(void)
 				error(FATAL, "cannot determine VA_BITS_ACTUAL\n");
 		}
 
+		if (!machdep->machspec->CONFIG_ARM64_VA_BITS) /* guess */
+			machdep->machspec->CONFIG_ARM64_VA_BITS = machedp->machspec->VA_BITS;
+
 		/*
 		 * The mm flip commit is introduced before 52-bits VA, which is before the
 		 * commit to export NUMBER(TCR_EL1_T1SZ)

Thanks,
Kazu


> 
> 
> 3987 static void
> 3988 arm64_calc_VA_BITS(void)
> 3989 {
> 3990     int bitval;
> 3991     struct syment *sp;
> 3992     ulong vabits_actual, value;
> 3993     char *string;
> 3994
> 3995     if ((string = pc->read_vmcoreinfo("NUMBER(VA_BITS)"))) {
> 3996         value = atol(string);
> 3997         free(string);
> 3998         machdep->machspec->CONFIG_ARM64_VA_BITS = value;
> 3999     }
> 
> 
> 
> 
> 	>Thanks.
> 	>Lianbo
> 
> 	>> Change-Id: I525f3c7fd91e1f06e909c2f4c1749c44c068baea
> 	>> Signed-off-by: Ankur Bansal <er.ankurbansal at gmail.com <mailto:er.ankurbansal at gmail.com> >
> 	>> ---
> 	>> arm64.c | 15 +++++++++++----
> 	>> 1 file changed, 11 insertions(+), 4 deletions(-)
> 	>>
> 	>> diff --git a/arm64.c b/arm64.c
> 	>> index 7069312..2dc77f7 100644
> 	>> --- a/arm64.c
> 	>> +++ b/arm64.c
> 	>> @@ -220,10 +220,17 @@ arm64_init(int when)
> 	>>
> 	>>                 /* vabits_actual introduced after mm flip, so it should be flipped layout */
> 	>>                 if (ms->VA_BITS_ACTUAL) {
> 	>> -                       ms->page_offset = ARM64_FLIP_PAGE_OFFSET;
> 	>> -                       /* useless on arm64 */
> 	>> -                       machdep->identity_map_base = ARM64_FLIP_PAGE_OFFSET;
> 	>> -                       machdep->kvbase = ARM64_FLIP_PAGE_OFFSET;
> 	>> +                       if ((pc->flags2 & SNAP)) {
> 	>> +                               ms->page_offset = ARM64_FLIP_PAGE_OFFSET;
> 	>> +                               /* useless on arm64 */
> 	>> +                               machdep->identity_map_base = ARM64_FLIP_PAGE_OFFSET;
> 	>> +                               machdep->kvbase = ARM64_FLIP_PAGE_OFFSET;
> 	>> +                       }
> 	>> +                       else{
> 	>> +                               ms->page_offset = ARM64_FLIP_PAGE_OFFSET_ACTUAL;
> 	>> +                               machdep->identity_map_base = ARM64_FLIP_PAGE_OFFSET_ACTUAL;
> 	>> +                               machdep->kvbase = ARM64_FLIP_PAGE_OFFSET_ACTUAL;
> 	>> +                       }
> 	>>                         ms->userspace_top = ARM64_USERSPACE_TOP_ACTUAL;
> 	>>                 } else {
> 	>>                         ms->page_offset = ARM64_PAGE_OFFSET;
> 	>> --
> 	>> 2.7.4
> 
> 
> 
> 	------------------------------
> 
> 	--
> 	Crash-utility mailing list
> 	Crash-utility at redhat.com <mailto:Crash-utility at redhat.com>
> 	https://listman.redhat.com/mailman/listinfo/crash-utility
> 
> 	End of Crash-utility Digest, Vol 192, Issue 28
> 	**********************************************
> 
> 
> 





More information about the Crash-utility mailing list