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

Re: [Xen-devel] [RFC 2/8] xen/arm: gic: Do not configure affinity for guest IRQ during routing



Hi Stefano,

On 22/06/16 11:54, Stefano Stabellini wrote:
On Tue, 7 Jun 2016, Julien Grall wrote:
The affinity of a guest IRQ is set every time the guest enable it (see
vgic_enable_irqs).

It is not necessary to set the affinity when the IRQ is routed to the
guest because Xen will never receive the IRQ until it hass been enabled
by the guest.

Signed-off-by: Julien grall <julien.grall@xxxxxxx>
---
  xen/arch/arm/gic.c | 10 ++++------
  1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
index 8a1087b..f25381f 100644
--- a/xen/arch/arm/gic.c
+++ b/xen/arch/arm/gic.c
@@ -97,17 +97,13 @@ void gic_restore_state(struct vcpu *v)
  }

  /*
- * needs to be called with a valid cpu_mask, ie each cpu in the mask has
- * already called gic_cpu_init
   * - desc.lock must be held
   * - arch.type must be valid (i.e != IRQ_TYPE_INVALID)
   */
  static void gic_set_irq_properties(struct irq_desc *desc,
-                                   const cpumask_t *cpu_mask,
                                     unsigned int priority)
  {
      gic_hw_ops->set_irq_properties(desc, priority);
-    desc->handler->set_affinity(desc, cpu_mask);
  }

  /* Program the GIC to route an interrupt to the host (i.e. Xen)
@@ -123,7 +119,9 @@ void gic_route_irq_to_xen(struct irq_desc *desc, const 
cpumask_t *cpu_mask,

      desc->handler = gic_hw_ops->gic_host_irq_type;

-    gic_set_irq_properties(desc, cpu_mask, priority);
+    desc->handler->set_affinity(desc, cpu_mask);

You could call irq_set_affinity here, it might make for nicer code.

Actually thinking more about this, I think it would be better to add the
irq_set_affinity call to xen/arch/arm/irq.c:setup_irq, right after the
call to gic_route_irq_to_xen.  That way both gic_route_irq_to_xen and
gic_route_irq_to_guest would behave the same way: just setup the routing
and not the affinity.

What do you think?

I am fine to call irq_set_affinity from setup_irq. It makes more sense than calling the former from gic_route_irq_to_xen.

I will make the change in the next version.

Cheers,

--
Julien Grall

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

 


Rackspace

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