Thanks for the patch.
On 2022/12/06 19:00, Pavankumar Kondeti wrote:
After the commit 0d9b1ffefabe ("arm64: mm: make vabits_actual
a build time constant if possible") introduced in v5.19
Linux kernel, the crash will not find vabits_actual symbol.
"if VA_BITS <= 48" ?
Add a fallback option to initialize VA_BITS based on the
user supplied machdep options.
Tested ramdumps loading in both 6.0 and 5.15 kernels.
What if kernels < 5.4? For such old kernels without vabits_actual
introduced, probably we should not set VA_BITS_ACTUAL..
Thanks,
Kazu
>
> Signed-off-by: Pavankumar Kondeti <quic_pkondeti(a)quicinc.com>
> ---
> arm64.c | 33 +++++++++++++++++++++++++--------
> 1 file changed, 25 insertions(+), 8 deletions(-)
>
> diff --git a/arm64.c b/arm64.c
> index c3e26a3..9d5d0bd 100644
> --- a/arm64.c
> +++ b/arm64.c
> @@ -4588,6 +4588,27 @@ arm64_IS_VMALLOC_ADDR(ulong vaddr)
>
> /* Return TRUE if we succeed, return FALSE on failure. */
> static int
> +arm64_set_va_bits_fallback(void)
> +{
> + 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);
> + return TRUE;
> + }
> +
> + if (machdep->machspec->CONFIG_ARM64_VA_BITS) {
> + /* guess */
> + machdep->machspec->VA_BITS_ACTUAL =
machdep->machspec->CONFIG_ARM64_VA_BITS;
> + machdep->machspec->VA_BITS =
machdep->machspec->CONFIG_ARM64_VA_BITS;
> + machdep->machspec->VA_START =
_VA_START(machdep->machspec->VA_BITS_ACTUAL);
> + return TRUE;
> + }
> +
> + return FALSE;
> +}
> +
> +/* Return TRUE if we succeed, return FALSE on failure. */
> +static int
> arm64_set_va_bits_by_tcr(void)
> {
> ulong value;
> @@ -4648,14 +4669,8 @@ arm64_calc_VA_BITS(void)
> else {
> if (arm64_set_va_bits_by_tcr()) {
> /* nothing */
> - } 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);
> - } else if (machdep->machspec->CONFIG_ARM64_VA_BITS) {
> - /* guess */
> - machdep->machspec->VA_BITS_ACTUAL =
machdep->machspec->CONFIG_ARM64_VA_BITS;
> - machdep->machspec->VA_BITS =
machdep->machspec->CONFIG_ARM64_VA_BITS;
> - machdep->machspec->VA_START =
_VA_START(machdep->machspec->VA_BITS_ACTUAL);
> + } else if (arm64_set_va_bits_fallback()) {
> + /* nothing */
> } else
> error(FATAL, "cannot determine VA_BITS_ACTUAL\n");
> }
> @@ -4671,6 +4686,8 @@ arm64_calc_VA_BITS(void)
> return;
> } else if (arm64_set_va_bits_by_tcr()) {
> return;
> + } else if (arm64_set_va_bits_fallback()) {
> + return;
> }
>
> if (!(sp = symbol_search("swapper_pg_dir")) &&