Re: [PATCH] arm64: mm: correct the start of physical address in linear map
From: Pavel Tatashin
Date: Sat Feb 13 2021 - 13:25:23 EST
> We're ignoring the portion from the linear mapping's start PA to the
> point of wraparound. Could the start and end of the hot plugged memory
> fall within this range and, as a result, the hot plug operation be
> incorrectly blocked?
Hi Tyler,
Thank you for looking at this fix. The maximum addressable PA's can be
seen in this function: id_aa64mmfr0_parange_to_phys_shift(). For
example for PA shift 32, the linear map must be able to cover any
physical addresses from 0 to "1 << 32". Therefore, 0 to __pa(PAGE_END
- 1); must include 0 to "1<<32".
The randomization of the linear map tries to hide where exactly within
the linear map the [0 to max_phys] addresses are located by changing
PHYS_OFFSET (linear map space is usually much bigger than PA space).
Therefore, the beginning or end of a linear map can actually convert
to completely bagus high PA addresses, but this is normal.
Thank you,
Pasha
>
> Tyler
>
> > +
> > /*
> > * Linear mapping region is the range [PAGE_OFFSET..(PAGE_END - 1)]
> > * accommodating both its ends but excluding PAGE_END. Max physical
> > * range which can be mapped inside this linear mapping range, must
> > * also be derived from its end points.
> > */
> > - return start >= __pa(_PAGE_OFFSET(vabits_actual)) &&
> > - (start + size - 1) <= __pa(PAGE_END - 1);
> > + return start >= start_linear_pa && (start + size - 1) <= end_linear_pa;
> > }
> >
> > int arch_add_memory(int nid, u64 start, u64 size,
> > --
> > 2.25.1
> >