[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen stable-4.16] x86/Viridian: don't mark IRQ vectors as pending when vLAPIC is disabled



commit a61f93d59742986d3119124bbe7a77fdcdf98a38
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Thu Dec 8 10:12:02 2022 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Dec 8 10:12:02 2022 +0100

    x86/Viridian: don't mark IRQ vectors as pending when vLAPIC is disabled
    
    In software-disabled state an LAPIC does not accept any interrupt
    requests and hence no IRR bit would newly become set while in this
    state. As a result it is also wrong for us to mark Viridian IPI or timer
    vectors as having a pending request when the vLAPIC is in this state.
    Such interrupts are simply lost.
    
    Introduce a local variable in send_ipi() to help readability.
    
    Fixes: fda96b7382ea ("viridian: add implementation of the 
HvSendSyntheticClusterIpi hypercall")
    Fixes: 26fba3c85571 ("viridian: add implementation of synthetic timers")
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Paul Durrant <paul@xxxxxxx>
    master commit: 831419f82913417dee4e5b0f80769c5db590540b
    master date: 2022-12-02 10:35:32 +0100
---
 xen/arch/x86/hvm/viridian/synic.c    | 2 +-
 xen/arch/x86/hvm/viridian/viridian.c | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/viridian/synic.c 
b/xen/arch/x86/hvm/viridian/synic.c
index 22e2df27e5..21f760fd24 100644
--- a/xen/arch/x86/hvm/viridian/synic.c
+++ b/xen/arch/x86/hvm/viridian/synic.c
@@ -350,7 +350,7 @@ bool viridian_synic_deliver_timer_msg(struct vcpu *v, 
unsigned int sintx,
     BUILD_BUG_ON(sizeof(payload) > sizeof(msg->u.payload));
     memcpy(msg->u.payload, &payload, sizeof(payload));
 
-    if ( !vs->masked )
+    if ( !vs->masked && vlapic_enabled(vcpu_vlapic(v)) )
         vlapic_set_irq(vcpu_vlapic(v), vs->vector, 0);
 
     return true;
diff --git a/xen/arch/x86/hvm/viridian/viridian.c 
b/xen/arch/x86/hvm/viridian/viridian.c
index 7d1cfc530b..ff4d83193b 100644
--- a/xen/arch/x86/hvm/viridian/viridian.c
+++ b/xen/arch/x86/hvm/viridian/viridian.c
@@ -831,7 +831,12 @@ static void send_ipi(struct hypercall_vpmask *vpmask, 
uint8_t vector)
         cpu_raise_softirq_batch_begin();
 
     for_each_vp ( vpmask, vp )
-        vlapic_set_irq(vcpu_vlapic(currd->vcpu[vp]), vector, 0);
+    {
+        struct vlapic *vlapic = vcpu_vlapic(currd->vcpu[vp]);
+
+        if ( vlapic_enabled(vlapic) )
+            vlapic_set_irq(vlapic, vector, 0);
+    }
 
     if ( nr > 1 )
         cpu_raise_softirq_batch_finish();
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.