On 2022/12/08 13:25, 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 if VA_BITS <= 48. Add a fallback option to initialize VA_BITS
 based on the user supplied machdep option.
 
 Tested ramdumps loading in both 6.0 and 5.15 kernels.
 
 Signed-off-by: Pavankumar Kondeti <quic_pkondeti(a)quicinc.com>
 
This looks good to me.
Acked-by: Kazuhito Hagio <k-hagio-ab(a)nec.com>
This is a memo about vabits_actual for future reference...
if VA_BITS <= 48:
ramdump (no vmcoreinfo)
         ver < 5.4  ... use old calculation
5.4  <= ver < 5.19 ... require "-m vabits_actual=N"
5.19 <= ver        ... require "-m vabits_actual=N" <-- this patch adds
vmcore (with vmcoreinfo)
         ver < 5.4  ... use old calculation
5.4  <= ver < 5.9  ... guess from NUMBER(VA_BITS) or "-m vabits_actual"
5.9  <= ver        ... use NUMBER(TCR_EL1_T1SZ)
/proc/kcore
         ver < 5.4  ... use old calculation
5.4  <= ver < 5.19 ... read vabits_actual
5.19 <= ver        ... use NUMBER(TCR_EL1_T1SZ)
# maybe bugs here :)
Thanks,
Kazu
> ---
>   arm64.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/arm64.c b/arm64.c
> index c3e26a3..7125458 100644
> --- a/arm64.c
> +++ b/arm64.c
> @@ -4671,6 +4671,10 @@ arm64_calc_VA_BITS(void)
>   		return;
>   	} else if (arm64_set_va_bits_by_tcr()) {
>   		return;
> +	} 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);
> +		return;
>   	}
>   
>   	if (!(sp = symbol_search("swapper_pg_dir")) &&