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

Re: [Xen-devel] [PATCH v9 05/28] ARM: GICv3: forward pending LPIs to guests



Hi Andre,

On 11/05/17 18:53, Andre Przywara wrote:
diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c
index 44d2b50..87f58f6 100644
--- a/xen/arch/arm/vgic-v3.c
+++ b/xen/arch/arm/vgic-v3.c
@@ -1567,12 +1567,30 @@ static struct pending_irq 
*vgic_v3_lpi_to_pending(struct domain *d,
     return pirq;
 }

+/* Retrieve the priority of an LPI from its struct pending_irq. */
+static int vgic_v3_lpi_get_priority(struct domain *d, uint32_t vlpi)
+{
+    struct pending_irq *p = vgic_v3_lpi_to_pending(d, vlpi);
+
+    /*
+     * Cope with the case where this function is called with an invalid LPI.
+     * It is expected that a caller will bail out handling this LPI at a
+     * later point in time, but for the sake of this function let us return
+     * some value here and avoid a NULL pointer dereference.
+     */
+    if ( !p )
+        return 0xff;

I am sorry but I am still against a such as it is. This is only a way to workaround a broken design for LPIs.

Looking at the code, I think we don't need to take the rank lock for reading the priority as this can be done atomically. In this case, the call to get_priority could be moved after the check of p in the caller.

+
+    return p->lpi_priority;
+}
+

Cheers,

--
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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