[Crash-utility] [PATH v4 2/2] arm64: add 4-level translation

Dave Anderson anderson at redhat.com
Wed Jun 1 14:32:56 UTC 2016



----- Original Message -----
> On Tue, May 31, 2016 at 03:30:44PM -0400, Dave Anderson wrote:
> > 
> > This patch looks good -- if it wasn't layered on top of the KASLR patch,
> > I would check it into github.
> 
> This patch is almost independent from KASLR support, except that
> adding new flags, VM_L4_4K and NEW_VMEMMAP, is conflicting.
> 
> When you merge it, please make a change.
> 
> -Takahiro AKASHI

OK, I see that now.  But upon further inspection, I've got another question
about this piece:

 + * 4-levels / 4K pages
 + * 48-bit VA
 + */
 +#define PTRS_PER_PGD_L4_4K   ((1UL) << (48 - 39))
 +#define PTRS_PER_PUD_L4_4K   (512)
 +#define PTRS_PER_PMD_L4_4K   (512)
 +#define PTRS_PER_PTE_L4_4K   (512)
 +#define PGDIR_SHIFT_L4_4K    (39)
 +#define PGDIR_SIZE_L4_4K     ((1UL) << PGDIR_SHIFT_L4_4K)
 +#define PGDIR_MASK_L4_4K     (~(PGDIR_SIZE_L4_4K-1))
 +#define PUD_SHIFT_L4_4K      (30)
 +#define PUD_SIZE_L4_4K       ((1UL) << PUD_SHIFT_L4_4K)
 +#define PUD_MASK_L4_4K       (~(PUD_SIZE_L4_4K-1))
 +#define PMD_SHIFT_L4_4K      (21)
 +#define PMD_SIZE_L4_4K       (1UL << PMD_SHIFT_L4_4K)
 +#define PMD_MASK_L4_4K       (~(PMD_SIZE_L4_4K-1))
 +
 +#define PGDIR_SIZE      (1UL << ((48 - 39) + 3))
 +#define PGDIR_MASK      (~(PGDIR_SIZE - 1))
 +#define PGDIR_OFFSET(X) (((ulong)(X)) & (PGDIR_SIZE - 1))
 +

You have defined PGDIR_SIZE_L4_4K and PGDIR_MASK_L4_4K, but they
are not used in arm64.c:

  $ grep -e PGDIR_SIZE_L4_4K -e PGDIR_MASK_L4_4K arm64.c
  $

Instead you define PGDIR_SIZE and PGDIR_MASK without the _L4_4K qualifiers,
and use them and PGDIR_OFFSET() in arm64.c.

Preferably convention should be followed such that the _L4_4K versions would
be used, but I see that PGDIR_SIZE_L4_4K is not equal to PGDIR_SIZE, and that
PGDIR_MASK_L4_4K is not equal to PGDIR_MASK.  What's going on there?

Dave





More information about the Crash-utility mailing list