Skip to contentSkip to conversation

svm_set_idt() - don't store/get idt to/from LDT save

PATCH In review Leonard Norrgard 2 participants 2 messages Jan 19, 2007 – Jan 23, 2007 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 svm_set_idt() - don't store/get idt to/from LDT save

On AMD processors, executing "shutdown -r now" in a Linux guest actually reboots the host. While investigating that, I noticed this likely typo. This patch isn't in itself the complete fix the host reboot, so be prepared if you test the shutdown command in a Linux guest.

Note: "shutdown -h now" works perfectly and closes the kvm window as expected.

PS. When I first installed this patch, "shutdown -r now" _didn't_ reboot the _host_ for about 10 times, instead the guest OOPSed in slightly different situations. Currently I don't see guest OOPSes, but host reboots.

trunk/kernel/svm.c 2007-01-19 15:42:18.000000000 +0200 renamed from trunk/kernel/svm.c 2007-01-14 17:29:39.000000000 +0200 +4 -4
@@ -680,14 +680,14 @@
 
 static void svm_get_idt(struct kvm_vcpu *vcpu, struct descriptor_table *dt)
 {
-    dt->limit = vcpu->svm->vmcb->save.ldtr.limit;
-    dt->base = vcpu->svm->vmcb->save.ldtr.base;
+    dt->limit = vcpu->svm->vmcb->save.idtr.limit;
+    dt->base = vcpu->svm->vmcb->save.idtr.base;
 }
 
 static void svm_set_idt(struct kvm_vcpu *vcpu, struct descriptor_table *dt)
 {
-    vcpu->svm->vmcb->save.ldtr.limit = dt->limit;
-    vcpu->svm->vmcb->save.ldtr.base = dt->base ;
+    vcpu->svm->vmcb->save.idtr.limit = dt->limit;
+    vcpu->svm->vmcb->save.idtr.base = dt->base ;
 }
 
 static void svm_get_gdt(struct kvm_vcpu *vcpu, struct descriptor_table *dt)

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

#1 lore raw

Re: [PATCH] svm_set_idt() - don't store/get idt to/from LDTsave

I've committed this patch.
In addition to the reboot problem, it fixes savevm/loadvm/migration on AMD machines. Thanks,
Uri.

-----Original Message-----
From: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org on behalf of Leonard Norrgard
Sent: Fri 19/01/2007 16:49
To: [email protected]
Subject: [kvm-devel] [PATCH] svm_set_idt() - don't store/get idt to/from LDTsave

On AMD processors, executing "shutdown -r now" in a Linux guest actually reboots the host. While investigating that, I noticed this likely typo. This patch isn't in itself the complete fix the host reboot, so be prepared if you test the shutdown command in a Linux guest.

Note: "shutdown -h now" works perfectly and closes the kvm window as expected.

PS. When I first installed this patch, "shutdown -r now" _didn't_ reboot the _host_ for about 10 times, instead the guest OOPSed in slightly different situations. Currently I don't see guest OOPSes, but host reboots.

trunk/kernel/svm.c 2007-01-19 15:42:18.000000000 +0200 renamed from trunk/kernel/svm.c 2007-01-14 17:29:39.000000000 +0200 +4 -4
@@ -680,14 +680,14 @@
 
 static void svm_get_idt(struct kvm_vcpu *vcpu, struct descriptor_table *dt)
 {
-    dt->limit = vcpu->svm->vmcb->save.ldtr.limit;
-    dt->base = vcpu->svm->vmcb->save.ldtr.base;
+    dt->limit = vcpu->svm->vmcb->save.idtr.limit;
+    dt->base = vcpu->svm->vmcb->save.idtr.base;
 }
 
 static void svm_set_idt(struct kvm_vcpu *vcpu, struct descriptor_table *dt)
 {
-    vcpu->svm->vmcb->save.ldtr.limit = dt->limit;
-    vcpu->svm->vmcb->save.ldtr.base = dt->base ;
+    vcpu->svm->vmcb->save.idtr.limit = dt->limit;
+    vcpu->svm->vmcb->save.idtr.base = dt->base ;
 }
 
 static void svm_get_gdt(struct kvm_vcpu *vcpu, struct descriptor_table *dt)

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
kvm-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel