Skip to contentSkip to conversation

KVM: emulator: do not needlesly sync registers from emulator ctxt to vcpu

PATCH Applied Gleb Natapov 2 participants 2 messages Mar 31, 2011 – Apr 14, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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
index e820c63..f68bacc 100644
@@ -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.

#1 lore raw
Quoted 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

---
v1->v2
- rebased onto see emulation patchset.

Applied, thanks.