[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



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?


> +    gic_set_irq_properties(desc, priority);
>  }
>  
>  /* Program the GIC to route an interrupt to a guest
> @@ -155,7 +153,7 @@ int gic_route_irq_to_guest(struct domain *d, unsigned int 
> virq,
>      desc->handler = gic_hw_ops->gic_guest_irq_type;
>      set_bit(_IRQ_GUEST, &desc->status);
>  
> -    gic_set_irq_properties(desc, cpumask_of(v_target->processor), priority);
> +    gic_set_irq_properties(desc, priority);
>  
>      p->desc = desc;
>      res = 0;

_______________________________________________
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®.