Re: [PATCHv8 1/4] crash-utility/arm64: introduce a dedicated field to record the mem layout changes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, Pingfan.
Thank you for the update.
On Wed, Jun 9, 2021 at 9:51 AM Pingfan Liu <piliu@xxxxxxxxxx> wrote:
>
> At present, we have the following important changes for arm64 memory
> layout:
>
> -1. redesigned ARM64 kernel virtual memory layout and associated KASLR
>     support that was introduced in Linux 4.6. And NEW_VMEMMAP is used to
>     flag it.
> -2. memory layout flipped just right before introducing 52-bits kernel.
> -3. introducing of vabits_actual and phyvirt_offset in kernel
> -4. removing phyvirt_offset.
>
> These changes have effects on PTOV()/VTOP() formula. So introducing a
> dedicate field mmlayout_flags to record it.
>
> Among above, 2 and 3 are introduced closely, and are not distinguished
> in current implement. And this patch also keep this practice and use
> vabits_actual as a hint to flag mem flipped.
>
> Signed-off-by: Pingfan Liu <piliu@xxxxxxxxxx>
> Cc: HAGIO KAZUHITO <k-hagio-ab@xxxxxxx>
> Cc: Lianbo Jiang <lijiang@xxxxxxxxxx>
> Cc: Bhupesh Sharma <bhupesh.sharma@xxxxxxxxxx>
> To: crash-utility@xxxxxxxxxx
> ---
>  arm64.c | 11 +++++++++++
>  defs.h  |  3 +++
>  2 files changed, 14 insertions(+)
>
> diff --git a/arm64.c b/arm64.c
> index 8934961..98138b2 100644
> --- a/arm64.c
> +++ b/arm64.c
> @@ -560,6 +560,10 @@ arm64_dump_machdep_table(ulong arg)
>                 fprintf(fp, "%sMACHDEP_BT_TEXT", others++ ? "|" : "");
>         if (machdep->flags & NEW_VMEMMAP)
>                 fprintf(fp, "%sNEW_VMEMMAP", others++ ? "|" : "");
> +       if (machdep->flags & FLIPPED_VM)
> +               fprintf(fp, "%sFLIPPED_VM", others++ ? "|" : "");
> +       if (machdep->flags & HAS_PHYSVIRT_OFFSET)
> +               fprintf(fp, "%sHAS_PHYSVIRT_OFFSET", others++ ? "|" : "");
>         fprintf(fp, ")\n");
>
>         fprintf(fp, "              kvbase: %lx\n", machdep->kvbase);
> @@ -994,6 +998,7 @@ arm64_calc_physvirt_offset(void)
>                 if (READMEM(pc->mfd, &physvirt_offset, sizeof(physvirt_offset),
>                         sp->value, sp->value -
>                         machdep->machspec->kimage_voffset) > 0) {
> +                               machdep->flags |= HAS_PHYSVIRT_OFFSET;
>                                 ms->physvirt_offset = physvirt_offset;
>                 }
>         }
> @@ -3923,6 +3928,7 @@ arm64_calc_VA_BITS(void)
>         if (kernel_symbol_exists("vabits_actual")) {
>                 if (pc->flags & PROC_KCORE) {
>                         vabits_actual = symbol_value_from_proc_kallsyms("vabits_actual");
> +                       machdep->flags |= FLIPPED_VM;
>                         if ((vabits_actual != BADVAL) && (READMEM(pc->mfd, &value, sizeof(ulong),
>                             vabits_actual, KCORE_USE_VADDR) > 0)) {
>                                 if (CRASHDEBUG(1))
> @@ -3953,6 +3959,11 @@ arm64_calc_VA_BITS(void)
>                                 machdep->machspec->VA_BITS_ACTUAL = value;
>                                 machdep->machspec->VA_BITS = value;
>                                 machdep->machspec->VA_START = _VA_START(machdep->machspec->VA_BITS_ACTUAL);
> +                               /*
> +                                * The mm flip commit is introduced before 52-bits VA, which is before the
> +                                * commit to export NUMBER(TCR_EL1_T1SZ)
> +                                */
> +                               machdep->flags |= FLIPPED_VM;
>                         } else if (machdep->machspec->VA_BITS_ACTUAL) {
>                                 machdep->machspec->VA_BITS = machdep->machspec->VA_BITS_ACTUAL;
>                                 machdep->machspec->VA_START = _VA_START(machdep->machspec->VA_BITS_ACTUAL);
> diff --git a/defs.h b/defs.h
> index 396d61a..24d41e7 100644
> --- a/defs.h
> +++ b/defs.h
> @@ -3208,6 +3208,8 @@ typedef signed int s32;
>  #define NEW_VMEMMAP   (0x80)
>  #define VM_L4_4K      (0x100)
>  #define UNW_4_14      (0x200)
> +#define FLIPPED_VM    (0x400)
> +#define HAS_PHYSVIRT_OFFSET (0x800)
>
>  /*
>   * Get kimage_voffset from /dev/crash
> @@ -3290,6 +3292,7 @@ struct arm64_pt_regs {
>  struct machine_specific {
>         ulong flags;
>         ulong userspace_top;
> +       ulong mmlayout_flags;

The above variable should be removed, and the patch log also needs to
be updated.

Thanks.
Lianbo

>         ulong page_offset;
>         ulong vmalloc_start_addr;
>         ulong vmalloc_end;
> --
> 2.29.2
>

--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/crash-utility




[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux