Skip to contentSkip to conversation

Fix machine check intercept correctly

PATCH In review Christoph Egger 3 participants 4 messages Oct 1, 2007 – Oct 2, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix machine check intercept correctly

Hi!

Attached patch fixes machine check interception
for HVM guests.

Keir: Please apply this patch to xen-staging *and* to Xen 3.1.1

Signature · 12 lines
AMD Saxony, Dresden, Germany
Operating System Research Center

Legal Information:
AMD Saxony Limited Liability Company & Co. KG
Sitz (Geschäftsanschrift):
   Wilschdorfer Landstr. 101, 01109 Dresden, Deutschland
Registergericht Dresden: HRA 4896
vertretungsberechtigter Komplementär:
   AMD Saxony LLC (Sitz Wilmington, Delaware, USA)
Geschäftsführer der AMD Saxony LLC:
   Dr. Hans-R. Deppe, Thomas McCoy
xen/arch/x86/hvm/svm/svm.c +0 -1
diff -r 5c7afb32df99 xen/arch/x86/hvm/svm/svm.c
@@ -2166,7 +2166,6 @@ asmlinkage void svm_vmexit_handler(struc
 
     case VMEXIT_EXCEPTION_MC:
         HVMTRACE_0D(MCE, v);
-        do_machine_check(regs);
         break;
 
     case VMEXIT_VINTR:
xen/arch/x86/hvm/svm/vmcb.c +1 -0
diff -r 5c7afb32df99 xen/arch/x86/hvm/svm/vmcb.c
@@ -252,6 +252,7 @@ static int construct_vmcb(struct vcpu *v
     {
         vmcb->exception_intercepts = HVM_TRAP_MASK | (1U << TRAP_page_fault);
     }
+    vmcb->exception_intercepts |= 1U << TRAP_machine_check;
 
     return 0;
 }

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 6 lines · Christoph Egger

Hi!

Attached patch fixes machine check interception
for HVM guests.

Keir: Please apply this patch to xen-staging *and* to Xen 3.1.1

First chunk (adding TRAP_machine_check to exception intercepts) is not needed as that bit is already in HVM_TRAP_MASK. Also why remove the invocation of do_machine_check()? That is the function that actually handles the #MC.

-- Keir

#2 lore raw

In theory the MCE that occurs in SVM partition, will be held pending until the VMEXIT occurs, and then released when the STGI instruction is executed, rendering any VMEXIT code non-useful. Same as the NMI handling. I might be missing something here, but the do_machine_check() will be executed in the context of the hv trap handlers immediately after STGI instruction, so we don't want to call it twice in the vmexit handler code. (?)
tom

Quoted 34 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Keir Fraser
Sent: Monday, October 01, 2007 11:11 AM
To: Egger, Christoph; [email protected]
Subject: Re: [Xen-devel] [PATCH][HVM][SVM] Fix machine check intercept correctly

Quoted 5 lines · Christoph Egger

Hi!

Attached patch fixes machine check interception for HVM guests.

Keir: Please apply this patch to xen-staging *and* to Xen 3.1.1

First chunk (adding TRAP_machine_check to exception intercepts) is not needed as that bit is already in HVM_TRAP_MASK. Also why remove the invocation of do_machine_check()? That is the function that actually handles the #MC.

-- Keir

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#3 lore raw

The documentation is unclear on what happens to #MC. Certainly it is held pending if GIF==0, but the manual does not explicitly say that #MC is held pending on vmexit. Is it possible to inject a #MC, to test what happens? That would be very handy, otherwise the code path basically gets no testing. :-)

-- Keir

Quoted 45 lines · Thomas

In theory the MCE that occurs in SVM partition, will be held pending until the VMEXIT occurs, and then released when the STGI instruction is executed, rendering any VMEXIT code non-useful. Same as the NMI handling. I might be missing something here, but the do_machine_check() will be executed in the context of the hv trap handlers immediately after STGI instruction, so we don't want to call it twice in the vmexit handler code. (?)
tom

Quoted 34 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Keir Fraser
Sent: Monday, October 01, 2007 11:11 AM
To: Egger, Christoph; [email protected]
Subject: Re: [Xen-devel] [PATCH][HVM][SVM] Fix machine check intercept correctly

Quoted 5 lines · Christoph Egger

Hi!

Attached patch fixes machine check interception for HVM guests.

Keir: Please apply this patch to xen-staging *and* to Xen 3.1.1

First chunk (adding TRAP_machine_check to exception intercepts) is not needed as that bit is already in HVM_TRAP_MASK. Also why remove the invocation of do_machine_check()? That is the function that actually handles the #MC.

-- Keir

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel