Hi, Kazu.

On Thu, Mar 24, 2022 at 3:01 PM HAGIO KAZUHITO(萩尾 一仁) <k-hagio-ab@nec.com> wrote:
-----Original Message-----
> 1.) When I tested live system with "crash vmlinux /proc/kcore" in kernel v5.7,
>     I met the following crash issue:
>        ........................................
>        crash: seek error: kernel virtual address: ffff75e9fffff000  type: "pud page"
>        ........................................
>
> 2.) The root cause is the PTOV does not work correctly for some kernel,
>     and then arm64_vtop_4level_4k() does not work correctly too.
>
>     Why PTOV does not work?
>
>     Because the physvirt_offset does not get the correct value.
>
> 3.) This patch uses symbol_value_from_proc_kallsyms() to get the
>     virtual address of "physvirt_offset", and then uses
>     READMEM(,..,KCORE_USE_VADDR) to get the correct value of
>     "physvirt_offset".
>
>     And also updates the ms->phys_offset which is initialized with
>     a wrong value in kernel version [5.4, 5.10).
>
>     Also add more comments for arm64_calc_physvirt_offset().
>
> Signed-off-by: Huang Shijie <shijie@os.amperecomputing.com>
> ---
> v1 --> v2:
>       v1 tried to get the correct value for phys_offset,
>       and then get the physvirt_offset correctly.
>
>       v2 tried to get the physvirt_offset correctly,
>       and them update phys_offset correctly.
>
>       Tested this patch with kernel 5.7.

Thank you for the change.  The code looks good to me.

Acked-by: Kazuhito Hagio <k-hagio-ab@nec.com>

Lianbo, can we add the following with this?  it's missing in help -m.

Sure. This looks good, I will add the fix when merging, maybe today.
BTW: I am testing them today.

Thanks.
Lianbo

@@ -1065,6 +1065,7 @@ arm64_dump_machdep_table(ulong arg)
                fprintf(fp, "        kimage_voffset: %016lx\n", ms->kimage_voffset);
        }
        fprintf(fp, "           phys_offset: %lx\n", ms->phys_offset);
+       fprintf(fp, "       physvirt_offset: %lx\n", ms->physvirt_offset);
        fprintf(fp, "__exception_text_start: %lx\n", ms->__exception_text_start);
        fprintf(fp, "  __exception_text_end: %lx\n", ms->__exception_text_end);
        fprintf(fp, " __irqentry_text_start: %lx\n", ms->__irqentry_text_start);

Thanks,
Kazu