xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Keir Fraser <keir.xen@gmail.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>, xen-devel@lists.xensource.com
Subject: Re: [PATCH] IRQ fix incorrect logic in __clear_irq_vector (v2)
Date: Fri, 12 Aug 2011 16:21:06 +0100	[thread overview]
Message-ID: <CA6B0372.1F265%keir.xen@gmail.com> (raw)
In-Reply-To: <bd106cc2aa6553606794.1313157258@andrewcoop.uk.xensource.com>

On 12/08/2011 14:54, "Andrew Cooper" <andrew.cooper3@citrix.com> wrote:

> In the old code, tmp_mask is the cpu_and of cfg->cpu_mask and
> cpu_online_map.  However, in the usual case of moving an IRQ from one
> PCPU to another because the scheduler decides its a good idea,
> cfg->cpu_mask and cfg->old_cpu_mask do not intersect.  This causes the
> old cpu vector_irq table to keep the irq reference when it shouldn't.
> 
> This leads to a resource leak if a domain is shut down wile an irq has
> a move pending, which results in Xen's create_irq() eventually failing
> with -ENOSPC when all vector_irq tables are full of stale references.
> 
> v2: reuse tmp_mask to take account of online cpus

Nasty bug, nice fix!

The extra field in irq_cfg sounds plausible to me -- I don't mind adding it
if it's a nice cleanup.

 Thanks,
 Keir

> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> 
> diff -r 1f08b380d438 -r bd106cc2aa65 xen/arch/x86/irq.c
> --- a/xen/arch/x86/irq.c Wed Aug 10 14:43:34 2011 +0100
> +++ b/xen/arch/x86/irq.c Fri Aug 12 14:54:11 2011 +0100
> @@ -216,6 +216,7 @@ static void __clear_irq_vector(int irq)
>  
>      if (likely(!cfg->move_in_progress))
>          return;
> +    cpus_and(tmp_mask, cfg->old_cpu_mask, cpu_online_map);
>      for_each_cpu_mask(cpu, tmp_mask) {
>          for (vector = FIRST_DYNAMIC_VECTOR; vector <= LAST_DYNAMIC_VECTOR;
>                                  vector++) {
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel

  reply	other threads:[~2011-08-12 15:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-12 13:54 [PATCH] IRQ fix incorrect logic in __clear_irq_vector (v2) Andrew Cooper
2011-08-12 15:21 ` Keir Fraser [this message]
2011-08-12 15:40   ` Xen 4.1.2 - when ? Boris Derzhavets
2011-08-12 15:51     ` Keir Fraser
2011-08-12 16:03       ` Jan Beulich
2011-08-12 16:18         ` Keir Fraser
2011-08-15  6:22           ` Jan Beulich
2011-08-12 16:20       ` Andrew Cooper
2011-08-12 17:02         ` 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=CA6B0372.1F265%keir.xen@gmail.com \
    --to=keir.xen@gmail.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /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).