x86/tlbflush: do not toggle the PGE CR4 bit unless necessary
authorRoger Pau Monné <roger.pau@citrix.com>
Wed, 11 Dec 2019 14:33:26 +0000 (15:33 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 11 Dec 2019 14:33:26 +0000 (15:33 +0100)
commitf562c6bb93a284033bf6f5af06287a71bc40a110
treeaf93b93b442a50955a964bddf31fd1974550fcea
parentd35cbee6e105723e7e1f9ecbb4bb51cb94ec6b47
x86/tlbflush: do not toggle the PGE CR4 bit unless necessary

When PCID is not available Xen does a full tlbflush by toggling the
PGE bit in CR4. This is not necessary if PGE is not enabled, since a
flush can be performed by writing to CR3 in that case.

Change the code in do_tlb_flush to only toggle the PGE bit in CR4 if
it's already enabled, otherwise do the tlb flush by writing to CR3.
This is relevant when running virtualized, since hypervisors don't
usually trap accesses to CR3 when using hardware assisted paging, but
do trap accesses to CR4 specially on AMD hardware, which makes such
accesses much more expensive.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
master commit: b5087a31efee7a4e34c958b88671ac6669501b09
master date: 2019-12-03 14:15:35 +0100
xen/arch/x86/flushtlb.c