powerpc/mm/radix: Split linear mapping on hot-unplug
authorBalbir Singh <bsingharora@gmail.com>
Wed, 7 Feb 2018 06:35:51 +0000 (17:35 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 8 Feb 2018 12:56:11 +0000 (23:56 +1100)
commit4dd5f8a99e791a8c6500e3592f3ce81ae7edcde1
treed81242a8d88ac881c8cd503239f44f60cf42f258
parenteeb715c3e995fbdda0cc05e61216c6c5609bce66
powerpc/mm/radix: Split linear mapping on hot-unplug

This patch splits the linear mapping if the hot-unplug range is
smaller than the mapping size. The code detects if the mapping needs
to be split into a smaller size and if so, uses the stop machine
infrastructure to clear the existing mapping and then remap the
remaining range using a smaller page size.

The code will skip any region of the mapping that overlaps with kernel
text and warn about it once. We don't want to remove a mapping where
the kernel text and the LMB we intend to remove overlap in the same
TLB mapping as it may affect the currently executing code.

I've tested these changes under a kvm guest with 2 vcpus, from a split
mapping point of view, some of the caveats mentioned above applied to
the testing I did.

Fixes: 4b5d62ca17a1 ("powerpc/mm: add radix__remove_section_mapping()")
Signed-off-by: Balbir Singh <bsingharora@gmail.com>
[mpe: Tweak change log to match updated behaviour]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/mm/pgtable-radix.c