Skip to contentSkip to conversation

x86/hvm: remove duplicate vlapic_find_highest_isr() calls

PATCH In review Paul Durrant 2 participants 2 messages Dec 7, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/hvm: remove duplicate vlapic_find_highest_isr() calls

When viridian APIC assist is active, the code in vlapic_has_pending_irq() may end up re-calling vlapic_find_highest_isr() after emulating an EOI whereas simply moving the call after the EOI emulation removes the need for this duplication.

---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: Wei Liu <[email protected]>
Cc: "Roger Pau Monné" <[email protected]>

I'm not sure why the code ended up this way. Both calls were added by commit 66bf4ef0486 "x86/hvm: re-work viridian APIC assist code" but there seems to be no good reason for the duplication. I can only think that an interim development version of the code fed the initially sampled ISR into an open-coded version of vlapic_EOI_set() (which makes the call internally).

---
 xen/arch/x86/hvm/vlapic.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
xen/arch/x86/hvm/vlapic.c +2 -5
index bdf946b25a..4f02499b3b 100644
@@ -1246,18 +1246,15 @@ int vlapic_has_pending_irq(struct vcpu *v)
          !nestedhvm_vcpu_in_guestmode(v) )
         return irr;
 
-    isr = vlapic_find_highest_isr(vlapic);
-
     /*
      * If APIC assist was set then an EOI may have been avoided.
      * If so, we need to emulate the EOI here before comparing ISR
      * with IRR.
      */
     if ( viridian_apic_assist_completed(v) )
-    {
         vlapic_EOI_set(vlapic);
-        isr = vlapic_find_highest_isr(vlapic);
-    }
+
+    isr = vlapic_find_highest_isr(vlapic);
 
     /*
      * The specification says that if APIC assist is set and a
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Paul Durrant

When viridian APIC assist is active, the code in vlapic_has_pending_irq() may end up re-calling vlapic_find_highest_isr() after emulating an EOI whereas simply moving the call after the EOI emulation removes the need for this duplication.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel