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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 22 Feb 2018 14:42:19 +0000 (15:42 +0100)
commitb973685e70c3b418ad46a03d6a9c81554c5c4ba2
tree7fcc3869c2baf2e2261ac988a0d380a0d3c1b95d
parent14d87b710338145e46940d0f751c5b7dd5b4c38f
powerpc/mm/radix: Split linear mapping on hot-unplug

commit 4dd5f8a99e791a8c6500e3592f3ce81ae7edcde1 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/mm/pgtable-radix.c