OSDN Git Service

KVM: vmx: speed up MSR bitmap merge
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 13 Dec 2017 13:16:30 +0000 (14:16 +0100)
committerRadim Krčmář <rkrcmar@redhat.com>
Tue, 16 Jan 2018 15:52:52 +0000 (16:52 +0100)
commitc992384bde84fb2f0318bdb4f6c710605dd7a217
tree60f91e72baf56050435eccd642b4e04067e8bbb9
parent1f6e5b25643e539e55a4c7553e4be6562c88fb76
KVM: vmx: speed up MSR bitmap merge

The bulk of the MSR bitmap is either immutable, or can be copied from
the L1 bitmap.  By initializing it at VMXON time, and copying the mutable
parts one long at a time on vmentry (rather than one bit), about 4000
clock cycles (30%) can be saved on a nested VMLAUNCH/VMRESUME.

The resulting for loop only has four iterations, so it is cheap enough
to reinitialize the MSR write bitmaps on every iteration, and it makes
the code simpler.

Suggested-by: Jim Mattson <jmattson@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
arch/x86/kvm/vmx.c