Skip to contentSkip to conversation

x86: ioapic: ignore level irq during processing

PATCH In review Peter Xu 2 participants 3 messages Jul 31, 2016 – Aug 1, 2016

lore
Share & tools
lore

Peter Xu

author
#0 lore raw

PATCH 1/1 x86: ioapic: ignore level irq during processing

For level triggered interrupts, we will get Remote IRR bit cleared after guest kernel finished processing specific request. Before that, we should ignore the same interrupt from triggering again.

---

I discovered this during debugging some IR issues. Only did very minimum test with e1000, but IIUC this should be the correct behavior for level triggered interrupts, and before that we might be sending some extra interrupts to guest (while we should not).

 hw/intc/ioapic.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
hw/intc/ioapic.c +8 -2
index 2d3282a..350f761 100644
@@ -129,9 +129,15 @@ static void ioapic_service(IOAPICCommonState *s)
                     }
                     continue;
                 }
-#else
-                (void)coalesce;
 #endif
+
+                if (coalesce) {
+                    /* We are level triggered interrupts, and the
+                     * guest should be still working on previous one,
+                     * so skip it. */
+                    continue;
+                }
+
                 /* No matter whether IR is enabled, we translate
                  * the IOAPIC message into a MSI one, and its
                  * address space will decide whether we need a
Signature · 1 line
2.7.4
#1 lore raw
Quoted 28 lines · Peter Xu

For level triggered interrupts, we will get Remote IRR bit cleared after guest kernel finished processing specific request. Before that, we should ignore the same interrupt from triggering again.

---

I discovered this during debugging some IR issues. Only did very minimum test with e1000, but IIUC this should be the correct behavior for level triggered interrupts, and before that we might be sending some extra interrupts to guest (while we should not).

 hw/intc/ioapic.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
hw/intc/ioapic.c +1 -2
index 2d3282a..350f761 100644
@@ -129,9 +129,15 @@ static void ioapic_service(IOAPICCommonState *s)
                     }
                     continue;
                 }
-#else
-                (void)coalesce;
 #endif
+

hw/intc/ioapic.c static void ioapic_service(IOAPICCommonState *s) · line 143

Quoted 10 lines
hw/intc/ioapic.c +7 -0
+                if (coalesce) {
+                    /* We are level triggered interrupts, and the
+                     * guest should be still working on previous one,
+                     * so skip it. */
+                    continue;
+                }
+
                 /* No matter whether IR is enabled, we translate
                  * the IOAPIC message into a MSI one, and its
                  * address space will decide whether we need a

The patch is okay for 2.7, as it matches what is done in the KVM split-irqchip case.

Paolo

author
#2 lore raw
Quoted 36 lines · Paolo Bonzini
Quoted 33 lines · Peter Xu

For level triggered interrupts, we will get Remote IRR bit cleared after guest kernel finished processing specific request. Before that, we should ignore the same interrupt from triggering again.

---

I discovered this during debugging some IR issues. Only did very minimum test with e1000, but IIUC this should be the correct behavior for level triggered interrupts, and before that we might be sending some extra interrupts to guest (while we should not).

 hw/intc/ioapic.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
hw/intc/ioapic.c +7 -2
index 2d3282a..350f761 100644
@@ -129,9 +129,15 @@ static void ioapic_service(IOAPICCommonState *s)
                     }
                     continue;
                 }
-#else
-                (void)coalesce;
 #endif
+
+                if (coalesce) {
+                    /* We are level triggered interrupts, and the
+                     * guest should be still working on previous one,
+                     * so skip it. */
+                    continue;
+                }
Quoted 8 lines

hw/intc/ioapic.c static void ioapic_service(IOAPICCommonState *s) · line 143

Quoted 5 lines
hw/intc/ioapic.c +1 -0
+
                 /* No matter whether IR is enabled, we translate
                  * the IOAPIC message into a MSI one, and its
                  * address space will decide whether we need a

The patch is okay for 2.7, as it matches what is done in the KVM split-irqchip case.

Cool. It'll be nice to have it in 2.7 as well. Thanks,

-- peterx