Skip to contentSkip to conversation

Fix "hda lost interrupt issue" on PAE host

PATCH In review Jiang, Yunhong 2 participants 2 messages Apr 20, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix "hda lost interrupt issue" on PAE host

Hi, Keir

This patch fix the "hda lost interrupt" issue when create vmx guest on PAE host.

Thanks

Yunhong Jiang

xen/arch/x86/hvm/vmx/io.c +26 -2
diff -r 6a8292235ef5 xen/arch/x86/hvm/vmx/io.c
@@ -154,6 +154,9 @@
     struct hvm_domain *plat=&v->domain->arch.hvm_domain;
     struct hvm_virpit *vpit = &plat->vpit;
     struct hvm_virpic *pic= &plat->vpic;
+    unsigned int idtv_info_field;
+    unsigned long inst_len;
+    int    has_ext_irq;
 
     if ( v->vcpu_id == 0 )
         hvm_pic_assist(v);
@@ -163,8 +166,29 @@
         pic_set_irq(pic, 0, 1);
     }
 
-    if ( !cpu_has_pending_irq(v) ) return;
-
+    has_ext_irq = cpu_has_pending_irq(v);
+    __vmread(IDT_VECTORING_INFO_FIELD, &idtv_info_field);
+    if (idtv_info_field & INTR_INFO_VALID_MASK) {
+        __vmwrite(VM_ENTRY_INTR_INFO_FIELD, idtv_info_field);
+
+        __vmread(VM_EXIT_INSTRUCTION_LEN, &inst_len);
+        if (inst_len >= 1 && inst_len <= 15)
+            __vmwrite(VM_ENTRY_INSTRUCTION_LEN, inst_len);
+
+        if (idtv_info_field & 0x800) { /* valid error code */
+            unsigned long error_code;
+            __vmread(IDT_VECTORING_ERROR_CODE, &error_code);
+            __vmwrite(VM_ENTRY_EXCEPTION_ERROR_CODE, error_code);
+        }
+        if ( has_ext_irq )
+            enable_irq_window(v);
+
+        HVM_DBG_LOG(DBG_LEVEL_1, "idtv_info_field=%x", idtv_info_field);
+
+        return;
+    }
+
+    if ( !has_ext_irq ) return;
     if ( is_interruptibility_state() ) {    /* pre-cleared for emulated instruction */
         enable_irq_window(v);
         HVM_DBG_LOG(DBG_LEVEL_1, "interruptibility");
xen/arch/x86/hvm/vmx/vmx.c +1 -18
diff -r 6a8292235ef5 xen/arch/x86/hvm/vmx/vmx.c
@@ -2039,7 +2039,7 @@
 
 asmlinkage void vmx_vmexit_handler(struct cpu_user_regs regs)
 {
-    unsigned int exit_reason, idtv_info_field;
+    unsigned int exit_reason;
     unsigned long exit_qualification, eip, inst_len = 0;
     struct vcpu *v = current;
     int error;
@@ -2048,23 +2048,6 @@
         __hvm_bug(&regs);
 
     perfc_incra(vmexits, exit_reason);
-
-    __vmread(IDT_VECTORING_INFO_FIELD, &idtv_info_field);
-    if (idtv_info_field & INTR_INFO_VALID_MASK) {
-        __vmwrite(VM_ENTRY_INTR_INFO_FIELD, idtv_info_field);
-
-        __vmread(VM_EXIT_INSTRUCTION_LEN, &inst_len);
-        if (inst_len >= 1 && inst_len <= 15)
-            __vmwrite(VM_ENTRY_INSTRUCTION_LEN, inst_len);
-
-        if (idtv_info_field & 0x800) { /* valid error code */
-            unsigned long error_code;
-            __vmread(IDT_VECTORING_ERROR_CODE, &error_code);
-            __vmwrite(VM_ENTRY_EXCEPTION_ERROR_CODE, error_code);
-        }
-
-        HVM_DBG_LOG(DBG_LEVEL_1, "idtv_info_field=%x", idtv_info_field);
-    }
 
     /* don't bother H/W interrutps */
     if (exit_reason != EXIT_REASON_EXTERNAL_INTERRUPT &&

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

#1 lore raw
Quoted 6 lines · Yunhong

Hi, Keir
This patch fix the “hda lost interrupt” issue when create vmx guest on PAE host.

It'd be nice to have some description of *how* the patch fixes the bug. I'd like to have some idea what the purpose of the piece of code you move around is: what's the difference between IDT-vectoring exception info and ordinary VM-exit exception info? Why is reflecting the info back into VM-entry fields always the right thing to do? etc. In general, patches that appear to simply shuffle code around worry me.

-- Keir