Skip to contentSkip to conversation

svm: Avoid VINTR injection during NMI shadow

PATCH In review Wei Wang2 2 participants 3 messages May 7, 2010

lore
Share & tools
lore

Wei Wang2

author
#0 lore raw

PATCH 1/1 svm: Avoid VINTR injection during NMI shadow

Hi,
I had observed that if xen injects and intercepts VINTR during NMI shadow, and if the xen injects NMI into guest at a very hight frequency, guest vcpu will hang. Attached patch avoids VINTR injection when guest is handling a NMI.

Thanks,

Wei

--
Legal Information:
Advanced Micro Devices GmbH
Karl-Hammerschmidt-Str. 34
85609 Dornach b. München

Geschäftsführer: Andrew Bowd, Thomas M. McCoy, Giuliano Meroni
Sitz: Dornach, Gemeinde Aschheim, Landkreis München Registergericht München, HRB Nr. 43632

xen/arch/x86/hvm/svm/intr.c +4 -0
diff -r e6f751ed8e38 xen/arch/x86/hvm/svm/intr.c
@@ -92,6 +92,10 @@ static void enable_intr_window(struct vc
      * track 'NMI blocking' from NMI injection until IRET. This can be done
      * quite easily in software by intercepting the unblocking IRET.
      */
+
+    if ( vmcb->general1_intercepts & GENERAL1_INTERCEPT_IRET )
+        return;
+
     intr = vmcb->vintr;
     intr.fields.irq     = 1;
     intr.fields.vector  = 0;

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

#1 lore raw

I think the if statement should be:
if ((vmcb->general1_intercepts & GENERAL1_INTERCEPT_IRET) &&

     (intack.source == hvm_intsrc_nmi))
     return;

Which I think deals properly and specifically with this hang problem.

What do you think?

-- Keir

Quoted 19 lines · On 07/05/2010 15:41, "Wei Wang2" <[email protected]> wrote:

Hi,
I had observed that if xen injects and intercepts VINTR during NMI shadow, and if the xen injects NMI into guest at a very hight frequency, guest vcpu will hang. Attached patch avoids VINTR injection when guest is handling a NMI.

Thanks,

Wei

--
Legal Information:
Advanced Micro Devices GmbH
Karl-Hammerschmidt-Str. 34
85609 Dornach b. München

Geschäftsführer: Andrew Bowd, Thomas M. McCoy, Giuliano Meroni
Sitz: Dornach, Gemeinde Aschheim, Landkreis München Registergericht München, HRB Nr. 43632

author
#2 lore raw

Totally agree, you are are right only NMI injection should be avoid. I have tested that the new condition works well. Thanks. Wei

Quoted 32 lines · On Friday 07 May 2010 18:56:32 Keir Fraser wrote:

I think the if statement should be:
if ((vmcb->general1_intercepts & GENERAL1_INTERCEPT_IRET) &&

     (intack.source == hvm_intsrc_nmi))
     return;

Which I think deals properly and specifically with this hang problem.

What do you think?

-- Keir

Quoted 20 lines · On 07/05/2010 15:41, "Wei Wang2" <[email protected]> wrote:

Hi,
I had observed that if xen injects and intercepts VINTR during NMI shadow, and if the xen injects NMI into guest at a very hight frequency, guest vcpu will hang. Attached patch avoids VINTR injection when guest is handling a NMI.

Thanks,

Wei

--
Legal Information:
Advanced Micro Devices GmbH
Karl-Hammerschmidt-Str. 34
85609 Dornach b. München

Geschäftsführer: Andrew Bowd, Thomas M. McCoy, Giuliano Meroni
Sitz: Dornach, Gemeinde Aschheim, Landkreis München Registergericht München, HRB Nr. 43632