KVM: emulator: do not needlesly sync registers from emulator ctxt to vcpu
PATCH v2 1/1 KVM: emulator: do not needlesly sync registers from emulator ctxt to vcpu
Currently we sync registers back and forth before/after exiting to userspace for IO, but during IO device model shouldn't need to read/write the registers, so we can as well skip those sync points. The only exaception is broken vmware backdor interface. The new code sync registers content during IO only if registers are read from/written to by userspace in the middle of the IO operation and this almost never happens in practise.
---
v1->v2
- rebased onto see emulation patchset.
arch/x86/include/asm/kvm_host.h +2 -0
@@ -370,6 +370,8 @@ struct kvm_vcpu_arch {/* emulate context */ struct x86_emulate_ctxt emulate_ctxt; +bool emulate_regs_need_sync_to_vcpu; +bool emulate_regs_need_sync_from_vcpu;gpa_t time;struct pvclock_vcpu_time_info hv_clock;
arch/x86/kvm/x86.c +38 -9
90 lines not on this page · raw message
--
Gleb.
Marcelo Tosatti
AppliedQuoted 8 lines · Gleb Natapov
Currently we sync registers back and forth before/after exiting to userspace for IO, but during IO device model shouldn't need to read/write the registers, so we can as well skip those sync points. The only exaception is broken vmware backdor interface. The new code sync registers content during IO only if registers are read from/written to by userspace in the middle of the IO operation and this almost never happens in practise.
Quoted 4 lines
Signed-off-by Gleb Natapov <[email protected]>---
v1->v2
- rebased onto see emulation patchset.
Applied, thanks.