xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Keir Fraser <keir@xen.org>
To: Jan Beulich <JBeulich@suse.com>
Cc: xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH v2 1/3] x86/HPET: obtain proper lock for changing IRQ affinity
Date: Wed, 17 Oct 2012 12:58:36 +0100	[thread overview]
Message-ID: <CCA45BFC.4FD87%keir@xen.org> (raw)
In-Reply-To: <507EB69302000078000A1F46@nat28.tlf.novell.com>

On 17/10/2012 12:45, "Jan Beulich" <JBeulich@suse.com> 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@suse.com>

Acked-by: Keir Fraser <keir@xen.org>

> ---
> 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>
> 
> 
> 

  reply	other threads:[~2012-10-17 11:58 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-16 15:05 [PATCH 0/3] x86: HPET adjustments Jan Beulich
2012-10-16 15:09 ` [PATCH 1/3] x86/HPET: obtain proper lock for changing IRQ affinity Jan Beulich
2012-10-16 15:41   ` Keir Fraser
2012-10-16 16:11     ` Jan Beulich
2012-10-16 21:49       ` Keir Fraser
2012-10-17 11:45         ` [PATCH v2 " Jan Beulich
2012-10-17 11:58           ` Keir Fraser [this message]
2012-10-16 15:10 ` [PATCH 2/3] x86/HPET: allow use for broadcast when interrupt remapping is in effect Jan Beulich
2012-10-17 11:47   ` [PATCH v2 " Jan Beulich
2012-10-17 11:59     ` Keir Fraser
2012-10-18  0:31       ` Zhang, Xiantao
2012-10-18  8:11       ` Jan Beulich
2012-10-16 15:11 ` [PATCH 3/3] x86/HPET: cache MSI message last written Jan Beulich
2012-10-18  8:22   ` Keir Fraser
2012-10-18 10:39     ` Jan Beulich
2012-10-18 16:42       ` Keir Fraser
2012-10-19  7:57         ` Jan Beulich
2012-10-19  9:32           ` Keir Fraser
2012-10-19  9:40             ` Jan Beulich
2012-10-25 11:53             ` [PATCH v2] " Jan Beulich
2012-10-25 12:18               ` Keir Fraser

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CCA45BFC.4FD87%keir@xen.org \
    --to=keir@xen.org \
    --cc=JBeulich@suse.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).