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

Re: [Xen-devel] [PATCH v2 1/3] x86/HPET: obtain proper lock for changing IRQ affinity


  • To: Jan Beulich <JBeulich@xxxxxxxx>
  • From: Keir Fraser <keir@xxxxxxx>
  • Date: Wed, 17 Oct 2012 12:58:36 +0100
  • Cc: xen-devel <xen-devel@xxxxxxxxxxxxx>
  • Delivery-date: Wed, 17 Oct 2012 11:59:01 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xen.org>
  • Thread-index: Ac2sXrzq5Mr3DhlJQE6q8tACcsuo9g==
  • Thread-topic: [PATCH v2 1/3] x86/HPET: obtain proper lock for changing IRQ affinity

On 17/10/2012 12:45, "Jan Beulich" <JBeulich@xxxxxxxx> wrote:

> The IRQ descriptor lock should be held while adjusting the affinity of
> any IRQ; the HPET channel lock isn't sufficient to protect namely
> against races with moving the IRQ to a different CPU.
> 
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

Acked-by: Keir Fraser <keir@xxxxxxx>

> ---
> v2: rename new helper function
> 
> --- a/xen/arch/x86/hpet.c
> +++ b/xen/arch/x86/hpet.c
> @@ -436,6 +436,16 @@ static struct hpet_event_channel *hpet_g
>      return ch;
>  }
>  
> +static void set_channel_irq_affinity(const struct hpet_event_channel *ch)
> +{
> +    struct irq_desc *desc = irq_to_desc(ch->irq);
> +
> +    ASSERT(!local_irq_is_enabled());
> +    spin_lock(&desc->lock);
> +    hpet_msi_set_affinity(desc, cpumask_of(ch->cpu));
> +    spin_unlock(&desc->lock);
> +}
> +
>  static void hpet_attach_channel(unsigned int cpu,
>                                  struct hpet_event_channel *ch)
>  {
> @@ -450,7 +460,7 @@ static void hpet_attach_channel(unsigned
>      if ( ch->cpu != cpu )
>          return;
>  
> -    hpet_msi_set_affinity(irq_to_desc(ch->irq), cpumask_of(ch->cpu));
> +    set_channel_irq_affinity(ch);
>  }
>  
>  static void hpet_detach_channel(unsigned int cpu,
> @@ -472,7 +482,7 @@ static void hpet_detach_channel(unsigned
>      }
>  
>      ch->cpu = cpumask_first(ch->cpumask);
> -    hpet_msi_set_affinity(irq_to_desc(ch->irq), cpumask_of(ch->cpu));
> +    set_channel_irq_affinity(ch);
>  }
>  
>  #include <asm/mc146818rtc.h>
> 
> 
> 



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