Skip to contentSkip to conversation

KVM: VMX: Use proper slot index for kvm_set_shared_msr

PATCH In review Jan Kiszka 2 participants 3 messages Oct 29, 2009 – Nov 1, 2009

Subsystems (3)
lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 KVM: VMX: Use proper slot index for kvm_set_shared_msr

We were missing one indirection here to translate from vmx-local to x86 slot indices, and this caused subtle host crashes.

---

IOW: Win7 boots for me again.

 arch/x86/kvm/vmx.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
arch/x86/kvm/vmx.c +2 -1
index a1976c9..6b818c0 100644
@@ -660,7 +660,8 @@ static void vmx_save_host_state(struct kvm_vcpu *vcpu)
 	}
 #endif
 	for (i = 0; i < vmx->save_nmsrs; ++i)
-		kvm_set_shared_msr(i, vmx->guest_msrs[i].data);
+		kvm_set_shared_msr(vmx->guest_msrs[i].index,
+				   vmx->guest_msrs[i].data);
 }
 
 static void __vmx_load_host_state(struct vcpu_vmx *vmx)
#1 lore raw
Quoted 4 lines · Jan Kiszka

We were missing one indirection here to translate from vmx-local to x86 slot indices, and this caused subtle host crashes.

Ahh, good catch. How did it work?

Quoted 23 lines

---

IOW: Win7 boots for me again.

  arch/x86/kvm/vmx.c |    3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)
arch/x86/kvm/vmx.c +2 -1
index a1976c9..6b818c0 100644
@@ -660,7 +660,8 @@ static void vmx_save_host_state(struct kvm_vcpu *vcpu)
  	}
  #endif
  	for (i = 0; i<  vmx->save_nmsrs; ++i)
-		kvm_set_shared_msr(i, vmx->guest_msrs[i].data);
+		kvm_set_shared_msr(vmx->guest_msrs[i].index,
+				   vmx->guest_msrs[i].data);
  }
 
  static void __vmx_load_host_state(struct vcpu_vmx *vmx)
Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
#2 lore raw
Quoted 6 lines · Avi Kivity
Quoted 3 lines · Jan Kiszka

We were missing one indirection here to translate from vmx-local to x86 slot indices, and this caused subtle host crashes.

Ahh, good catch. How did it work?

And, of course, applied. Thanks.

Signature · 1 line
error compiling committee.c: too many arguments to function