arm64: Add page tables additively when paging hotplug memory
Currently during hotplug paging, we swap the PGD with temporary pgdir,
add page-table entries for the new memory block at swapper_pg_dir, and
then replace ttbr1 with the modified swapper_pg_dir. This approach has
a flaw wherein during modifying swapper_pg_dir, the TTBR1_EL1 of other
live CPUs are still pointing to this pgdir, which is unsafe and might
cause random MMU faults. Also, while modifying in process, other CPUs
might also be altering the swapper which leads to corrupted pgdir.
Such swapping and replacing of pgdir is not needed since adding new
kernel page-tables is strictly additive and non-conflicting, and should
be safe to add new entries/pointers to the swapper_pg_dir in live.
Hence, stick to additive approach rather than swap-replace approach.
One such example issue with the current approach is hitting Instruction
Abort, 1st Level Translation Fault. This happens when current CPU is doing
cpu_replace_ttbr1() while other CPUs are utilizing the swapper pgdir:
[2.080940] Unable to handle kernel paging request at virtual address 813ad334
[2.081137] Mem abort info:
[2.081247] Exception class = IABT (current EL), IL = 32 bits
[2.081400] SET = 0, FnV = 0
[2.081512] EA = 0, S1PTW = 0
[2.081628] [00000000813ad334] user address but active_mm is swapper
[2.081794] Internal error: Oops: 86000005 [#1] PREEMPT SMP
[2.081929] Modules linked in:
[2.082037] CPU: 1 PID: 1 Comm: swapper/0 Tainted: G S
The additive approach would solve such an issue since paging a new memory
block is just adding a new pointer to the PGD in live.
Change-Id: Ie7a87ad52b85e6b1370b0f244025a43a0541e3f6
Signed-off-by:
Sudarshan Rajagopalan <sudaraja@codeaurora.org>
Loading
Please register or sign in to comment