x86/hap: improve hypervisor assisted guest TLB flush
authorRoger Pau Monné <roger.pau@citrix.com>
Tue, 10 Mar 2020 14:30:27 +0000 (15:30 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 10 Mar 2020 14:30:27 +0000 (15:30 +0100)
commitc9495bd7dff587ce770b2318037d6a1d0511bd72
tree46dc847823eb18cb0ac0f2f4ab05dfbd9de08bca
parent920d5f31883c9c4c4e8092a693572fe01b6f7270
x86/hap: improve hypervisor assisted guest TLB flush

The current implementation of the hypervisor assisted flush for HAP is
extremely inefficient.

First of all there's no need to call paging_update_cr3, as the only
relevant part of that function when doing a flush is the ASID vCPU
flush, so just call that function directly.

Since hvm_asid_flush_vcpu is protected against concurrent callers by
using atomic operations there's no need anymore to pause the affected
vCPUs.

Finally the global TLB flush performed by flush_tlb_mask is also not
necessary, since we only want to flush the guest TLB state it's enough
to trigger a vmexit on the pCPUs currently holding any vCPU state, as
such vmexit will already perform an ASID/VPID update, and thus clear
the guest TLB.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Wei Liu <wl@xen.org>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/mm/hap/hap.c