-----Original Message-----
Hi Lianbo,
Thanks for your review.
Cc Kazu, do you prefer to send out V9 immediately? Or wait for a days?
I'm asking Bhupesh whether he can review, but you don't need to update
this immediately, I think. It's ok after some more review.
Thanks,
Kazu
Thanks,
Pingfan
On Sun, Jun 13, 2021 at 12:39 PM lijiang <lijiang(a)redhat.com> wrote:
>
> Hi, Pingfan.
> Thank you for the update.
> On Wed, Jun 9, 2021 at 9:51 AM Pingfan Liu <piliu(a)redhat.com> 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(a)redhat.com>
> > Cc: HAGIO KAZUHITO <k-hagio-ab(a)nec.com>
> > Cc: Lianbo Jiang <lijiang(a)redhat.com>
> > Cc: Bhupesh Sharma <bhupesh.sharma(a)linaro.org>
> > To: crash-utility(a)redhat.com
> > ---
> > 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
> >
>