xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Keir Fraser <keir.xen@gmail.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH 1/3] x86/HPET: obtain proper lock for changing IRQ affinity
Date: Tue, 16 Oct 2012 22:49:49 +0100	[thread overview]
Message-ID: <CCA3950D.41D0E%keir.xen@gmail.com> (raw)
In-Reply-To: <507DA35102000078000A1C26@nat28.tlf.novell.com>

On 16/10/2012 17:11, "Jan Beulich" <JBeulich@suse.com> wrote:

>>>> On 16.10.12 at 17:41, Keir Fraser <keir.xen@gmail.com> wrote:
>> On 16/10/2012 16:09, "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>
>> 
>> Would be more usual for the underscore-prefixed name to be the one that
>> doesn't take locks?
> 
> Will make the patch bigger, but I can certainly do that. I specifically
> picked only a single underscore to distinguish this a little from the
> "usual" case.

It doesn't make the patch much bigger, and it would be preferable.

> Jan
> 
>>> --- 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 _hpet_msi_set_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));
>>> +    _hpet_msi_set_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));
>>> +    _hpet_msi_set_affinity(ch);
>>>  }
>>>  
>>>  #include <asm/mc146818rtc.h>
>>> 
>>> 
>>> 
>>> _______________________________________________
>>> Xen-devel mailing list
>>> Xen-devel@lists.xen.org
>>> http://lists.xen.org/xen-devel
> 
> 
> 

  reply	other threads:[~2012-10-16 21:49 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 [this message]
2012-10-17 11:45         ` [PATCH v2 " Jan Beulich
2012-10-17 11:58           ` Keir Fraser
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=CCA3950D.41D0E%keir.xen@gmail.com \
    --to=keir.xen@gmail.com \
    --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).