Skip to contentSkip to conversation

KVM: Add VT-x machine check support v2

PATCH In review Andi Kleen 3 participants 5 messages Jun 5, 2009 – Jun 7, 2009

Subsystems (3)
lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

PATCH 1/1 KVM: Add VT-x machine check support v2

sorry took a bit longer to do this, had some trouble with my test rig. This addresses the preemptible kernel problem discussed earlier. I tried to not add more vmcb reads, so I'm caching the exit_reason in memory over callbacks.

Note I'm on offline for some time, if there further issues please contact Ying Huang (cc'ed)

-Andi

---

KVM: Add VT-x machine check support v2

VT-x needs an explicit MC vector intercept to handle machine checks in the hyper visor.

It also has a special option to catch machine checks that happen during VT entry.

Do these interceptions and forward them to the Linux machine check handler. Make it always look like user space is interrupted because the machine check handler treats kernel/user space differently.

Thanks to Huang Ying and Jiang Yunhong for help and testing.

v2: Handle machine checks still in interrupt off context to avoid problems on preemptible kernels.

---
 arch/x86/include/asm/kvm_host.h |    2 +
 arch/x86/include/asm/vmx.h      |    1 
 arch/x86/kvm/vmx.c              |   41 +++++++++++++++++++++++++++++++++++++---
 3 files changed, 41 insertions(+), 3 deletions(-)
arch/x86/include/asm/vmx.h +1 -0
Index: linux/arch/x86/include/asm/vmx.h
===================================================================
@@ -247,6 +247,7 @@
 #define EXIT_REASON_MSR_READ            31
 #define EXIT_REASON_MSR_WRITE           32
 #define EXIT_REASON_MWAIT_INSTRUCTION   36
+#define EXIT_REASON_MCE_DURING_VMENTRY	 41
 #define EXIT_REASON_TPR_BELOW_THRESHOLD 43
 #define EXIT_REASON_APIC_ACCESS         44
 #define EXIT_REASON_EPT_VIOLATION       48
arch/x86/kvm/vmx.c +38 -3

89 lines not on this page · raw message

arch/x86/include/asm/kvm_host.h +2 -0
Index: linux/arch/x86/include/asm/kvm_host.h
===================================================================
@@ -371,6 +371,8 @@
 	unsigned long dr6;
 	unsigned long dr7;
 	unsigned long eff_db[KVM_NR_DB_REGS];
+
+	u32 exit_reason;
 };
 
 struct kvm_mem_alias {
#1 lore raw
Quoted 11 lines · Andi Kleen

KVM: Add VT-x machine check support v2

VT-x needs an explicit MC vector intercept to handle machine checks in the hyper visor.

It also has a special option to catch machine checks that happen during VT entry.

Do these interceptions and forward them to the Linux machine check handler. Make it always look like user space is interrupted because the machine check handler treats kernel/user space differently.

Quoted 10 lines

Thanks to Huang Ying and Jiang Yunhong for help and testing.

v2: Handle machine checks still in interrupt off context to avoid problems on preemptible kernels.

Only applies with -C0. What tree was this generated against?

Please diff and test against latest kvm.git.

arch/x86/include/asm/kvm_host.h line 377

Quoted 11 lines

===================================================================

arch/x86/include/asm/kvm_host.h +2 -0
@@ -371,6 +371,8 @@
 	unsigned long dr6;
 	unsigned long dr7;
 	unsigned long eff_db[KVM_NR_DB_REGS];
+
+	u32 exit_reason;
 };
 

This should be in 'struct vcpu_vmx' (vmx.c), as it's vmx specific.

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
author
#2 lore raw
Quoted 8 lines · Avi Kivity
Quoted 6 lines

v2: Handle machine checks still in interrupt off context to avoid problems on preemptible kernels.

Only applies with -C0. What tree was this generated against?

2.6.30-rc7

Quoted 1 line

Please diff and test against latest kvm.git.

Sorry can't do neither for the next two weeks.

-Andi

Signature · 1 line
[email protected] -- Speaking for myself only.
#3 lore raw
Quoted 5 lines · Andi Kleen
Quoted 3 lines · Avi Kivity
Quoted 3 lines

v2: Handle machine checks still in interrupt off context to avoid problems on preemptible kernels.

Quoted 10 lines
Quoted 6 lines
Quoted 4 lines

Only applies with -C0. What tree was this generated against?

2.6.30-rc7

Please use kvm.git, which is maybe 150 patches ahead.

Quoted 5 lines
Quoted 2 lines

Please diff and test against latest kvm.git.

Sorry can't do neither for the next two weeks.

Ying?

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
#4 lore raw
In reply to Andi Kleen
Quoted 8 lines · Andi Kleen
Quoted 7 lines · Avi Kivity
Quoted 6 lines

v2: Handle machine checks still in interrupt off context to avoid problems on preemptible kernels.

Quoted 7 lines
Quoted 1 line

Only applies with -C0. What tree was this generated against?

2.6.30-rc7

Quoted 1 line

Please diff and test against latest kvm.git.

Sorry can't do neither for the next two weeks.

I will do this.

Best Regards,
Huang Ying