diff options
author | Mathias Krause <minipli@grsecurity.net> | 2023-05-12 15:20:21 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-05-17 14:01:51 +0200 |
commit | 65c29d39419cc55e808f849c83e78e8cc55949b4 (patch) | |
tree | 7ce329387e66c4ebcc880c60bbce698ddd529af0 /arch/s390 | |
parent | b1b91f9704fde41ec222fa7ee06dfc3a7b0cebd3 (diff) | |
download | linux-stable-65c29d39419cc55e808f849c83e78e8cc55949b4.tar.gz linux-stable-65c29d39419cc55e808f849c83e78e8cc55949b4.tar.bz2 linux-stable-65c29d39419cc55e808f849c83e78e8cc55949b4.zip |
KVM: x86: Do not unload MMU roots when only toggling CR0.WP with TDP enabled
[ Upstream commit 01b31714bd90be2784f7145bf93b7f78f3d081e1 ]
There is no need to unload the MMU roots with TDP enabled when only
CR0.WP has changed -- the paging structures are still valid, only the
permission bitmap needs to be updated.
One heavy user of toggling CR0.WP is grsecurity's KERNEXEC feature to
implement kernel W^X.
The optimization brings a huge performance gain for this case as the
following micro-benchmark running 'ssdd 10 50000' from rt-tests[1] on a
grsecurity L1 VM shows (runtime in seconds, lower is better):
legacy TDP shadow
kvm-x86/next@d8708b 8.43s 9.45s 70.3s
+patch 5.39s 5.63s 70.2s
For legacy MMU this is ~36% faster, for TDP MMU even ~40% faster. Also
TDP and legacy MMU now both have a similar runtime which vanishes the
need to disable TDP MMU for grsecurity.
Shadow MMU sees no measurable difference and is still slow, as expected.
[1] https://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git
Signed-off-by: Mathias Krause <minipli@grsecurity.net>
Link: https://lore.kernel.org/r/20230322013731.102955-3-minipli@grsecurity.net
Co-developed-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Mathias Krause <minipli@grsecurity.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'arch/s390')
0 files changed, 0 insertions, 0 deletions