Facing issue with va to pa conversion in arm64/makedumpfile
HAGIO KAZUHITO(萩尾 一仁)
k-hagio-ab at nec.com
Wed Nov 18 19:26:23 EST 2020
Hi Akshay,
(Cc Bhupesh)
-----Original Message-----
> Hi Pratyush/ Kazuhito ,
>
> While attempting to create dumpfile on arm64, I was face issues with
> virtual address to physical address conversion when kalsr is enable.
> Linux kernel version is 5.4.42 stable kernel.
It seems that it would be due to the flipped VA space at 5.4 arm64 kernel.
Bhupesh has been addressing this for us, but not merged yet.
How does it work with this patch?
http://lists.infradead.org/pipermail/kexec/2020-September/021336.html
(Its 1/3 and 2/3 patches were already merged, so I think the 3/3 patch
can be applied on top of the latest makedumpfile.)
Thanks,
Kazu
>
> The following patch seems to add patch to enable kalsr support :
>
> [PATCH 10/10] arm64: fix memory layout as per changes in v4.6 kernel
>
> https://sourceforge.net/p/makedumpfile/code/ci/b6fe70c7ffef9affb540412407702b15d4a196e9
>
>
> static unsigned long long
> +__pa(unsigned long vaddr)
> +{
> + if (kimage_voffset == NOT_FOUND_NUMBER ||
> + (vaddr >= PAGE_OFFSET))
> + return (vaddr - PAGE_OFFSET + info->phys_base);
> + else
> + return (vaddr - kimage_voffset);
> +}
>
>
> I see that even when kimage_voffset is available , it calculates pa
> using PAGE_OFFSET.
> But as KALSR is enabled it should ideally use kimage_voffset.
>
> Not sure what is the significance of the check (vaddr >= PAGE_OFFSET) if
> kimage_voffset is available.
>
> i think this should be something like
>
> + if (kimage_voffset == NOT_FOUND_NUMBER) && (vaddr >=
> PAGE_OFFSET))
> + return (vaddr - PAGE_OFFSET + info->phys_base);
> + else
> + return (vaddr - kimage_voffset);
>
>
>
> Because we want to check vaddr is greater than PAGE_OFFSET when we are
> considering linear mapping without kaslr seed.
>
> Or may be we should have a separate check which will error out all vaddr
> less than PAGE_OFFSET and kimage_voffset.
>
> + if (vaddr < PAGE_OFFSET)
> + return -EINVAL;
> + if (kimage_voffset == NOT_FOUND_NUMBER)
> + return (vaddr - PAGE_OFFSET + info->phys_base);
> + else
> + return (vaddr - kimage_voffset);
>
> --
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora
> Forum,
> a Linux Foundation Collaborative Project
>
> _______________________________________________
> kexec mailing list
> kexec at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec
More information about the kexec
mailing list