On Mon, Jun 28, 2021 at 06:31:44AM +0000, HAGIO KAZUHITO(萩尾 一仁) wrote:
> -----Original Message-----
> Renaming, so it is better to reflect the flip layout of kernel VA, which
> is introduced by kernel commit 14c127c957c1 ("arm64: mm: Flip kernel VA
space")
>
> 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 | 10 ++++++----
> defs.h | 3 ++-
> 2 files changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/arm64.c b/arm64.c
> index b3b3242..72958be 100644
> --- a/arm64.c
> +++ b/arm64.c
> @@ -221,10 +221,12 @@ arm64_init(int when)
> arm64_calc_VA_BITS();
> arm64_calc_KERNELPACMASK();
> ms = machdep->machspec;
> +
> + /* vabits_actual introduced after mm flip, so it should be flipped layout */
> if (ms->VA_BITS_ACTUAL) {
> - ms->page_offset = ARM64_PAGE_OFFSET_ACTUAL;
> - machdep->identity_map_base = ARM64_PAGE_OFFSET_ACTUAL;
> - machdep->kvbase = ARM64_PAGE_OFFSET_ACTUAL;
> + ms->page_offset = ARM64_FLIP_PAGE_OFFSET_ACTUAL;
> + machdep->identity_map_base = ARM64_FLIP_PAGE_OFFSET_ACTUAL;
> + machdep->kvbase = ARM64_FLIP_PAGE_OFFSET_ACTUAL;
> ms->userspace_top = ARM64_USERSPACE_TOP_ACTUAL;
> } else {
> ms->page_offset = ARM64_PAGE_OFFSET;
> @@ -405,7 +407,7 @@ arm64_init(int when)
> fprintf(fp, "CONFIG_ARM64_VA_BITS: %ld\n",
ms->CONFIG_ARM64_VA_BITS);
> fprintf(fp, " VA_BITS_ACTUAL: %ld\n", ms->VA_BITS_ACTUAL);
> fprintf(fp, "(calculated) VA_BITS: %ld\n", ms->VA_BITS);
> - fprintf(fp, " PAGE_OFFSET: %lx\n", ARM64_PAGE_OFFSET_ACTUAL);
> + fprintf(fp, " PAGE_OFFSET: %lx\n", ARM64_FLIP_PAGE_OFFSET_ACTUAL);
> fprintf(fp, " VA_START: %lx\n", ms->VA_START);
> fprintf(fp, " modules: %lx - %lx\n", ms->modules_vaddr,
ms->modules_end);
> fprintf(fp, " vmalloc: %lx - %lx\n", ms->vmalloc_start_addr,
> ms->vmalloc_end);
> diff --git a/defs.h b/defs.h
> index 786186a..bc3dead 100644
> --- a/defs.h
> +++ b/defs.h
> @@ -3232,7 +3232,8 @@ typedef signed int s32;
>
> #define ARM64_PAGE_OFFSET ((0xffffffffffffffffUL) \
> << (machdep->machspec->VA_BITS - 1))
> -#define ARM64_PAGE_OFFSET_ACTUAL ((0xffffffffffffffffUL) \
> +/* kernels > v5.4 the kernel VA space is flipped */
Nitpicking: kernels >= 5.4
Adopt.
Thanks