Hi,

thanks for the patch.

> -----Original Message-----
> Subject: [Crash-utility] [PATCH RFC] arm64: fix vtop command when handling 
> PUD mapping 

I think probably this issue will appear not only with vtop command, so
I would suggest "arm64: handle 1GB block for VM_L4_4K" like the patch
fixing a similar issue for VM_L3_4K:

commit c25234e3573a7a0744430e922146ee362
Author: Johan Erlandsson <[email protected]>
Date:   Thu Mar 11 08:54:30 2021 +0000

    arm64: handle 1GB block for VM_L3_4K


Otherwise, the patch looks good to me.  With the change above:

Acked-by: Kazuhito Hagio <[email protected]>

Thanks,
Kazu

> When arm64 is configed with PAGE_SIZE=4k and 4 level
> translation, the pagetable of all pages may be created
> with block mapping or contiguous mapping as much as
> possible, likes disable CONFIG_RODATA_FULL_DEFAULT_ENABLED.
> But now, vtop command can not handle pud mapping well, and
> just shows a seek error:
> 
> crash> vtop ffff00184a800000
> VIRTUAL           PHYSICAL
> ffff00184a800000  188a800000
> 
> PAGE DIRECTORY: ffff8000110aa000
>    PGD: ffff8000110aa000 => 203fff9003
>    PUD: ffff001fffff9308 => 68001880000705
>    PMD: ffff0018400002a0 => ffff8000103b4fd0
> vtop: seek error: kernel virtual address: ffff7fffd03b4000  type: "page table"
> 
> This patch fixes it, and shows as following:
> 
> crash> vtop ffff00184a800000
> VIRTUAL           PHYSICAL
> ffff00184a800000  188a800000
> 
> PAGE DIRECTORY: ffff8000110aa000
>    PGD: ffff8000110aa000 => 203fff9003
>    PUD: ffff001fffff9308 => 68001880000705
>   PAGE: 1880000000  (1GB)
> 
>      PTE         PHYSICAL   FLAGS
> 68001880000705  1880000000  (VALID|SHARED|AF|PXN|UXN)
> 
>       PAGE         PHYSICAL      MAPPING       INDEX CNT FLAGS
> fffffe00610a0000 188a800000                0        0  0 77fffe0000000000
> 
> Signed-off-by: Rongwei Wang <[email protected]>
> ---
>  arm64.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/arm64.c b/arm64.c
> index 2177c52..65f6cdf 100644
> --- a/arm64.c
> +++ b/arm64.c
> @@ -1999,6 +1999,16 @@ arm64_vtop_4level_4k(ulong pgd, ulong vaddr, 
> physaddr_t *paddr, int verbose)
>       if (!pud_val)
>               goto no_page;
> 
> +     if ((pud_val & PUD_TYPE_MASK) == PUD_TYPE_SECT) {
> +             ulong sectionbase = (pud_val & SECTION_PAGE_MASK_1GB) & 
> PHYS_MASK;
> +             if (verbose) {
> +                     fprintf(fp, "  PAGE: %lx  (1GB)\n\n", sectionbase);
> +                     arm64_translate_pte(pud_val, 0, 0);
> +             }
> +             *paddr = sectionbase + (vaddr & ~SECTION_PAGE_MASK_1GB);
> +             return TRUE;
> +     }
> +
>       pmd_base = (ulong *)PTOV(pud_val & PHYS_MASK & (s32)machdep->pagemask);
>       FILL_PMD(pmd_base, KVADDR, PTRS_PER_PMD_L4_4K * sizeof(ulong));
>       pmd_ptr = pmd_base + (((vaddr) >> PMD_SHIFT_L4_4K) & 
> (PTRS_PER_PMD_L4_4K - 1));
> --
> 2.27.0
> 
> --
> Crash-utility mailing list
> [email protected]
> https://listman.redhat.com/mailman/listinfo/crash-utility
> Contribution Guidelines: https://github.com/crash-utility/crash/wiki

--
Crash-utility mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/crash-utility
Contribution Guidelines: https://github.com/crash-utility/crash/wiki

Reply via email to