xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] IRQ fix incorrect logic in __clear_irq_vector (v2)
@ 2011-08-12 13:54 Andrew Cooper
  2011-08-12 15:21 ` Keir Fraser
  0 siblings, 1 reply; 9+ messages in thread
From: Andrew Cooper @ 2011-08-12 13:54 UTC (permalink / raw)
  To: xen-devel; +Cc: Andrew Cooper

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

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++) {

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] IRQ fix incorrect logic in __clear_irq_vector (v2)
  2011-08-12 13:54 [PATCH] IRQ fix incorrect logic in __clear_irq_vector (v2) Andrew Cooper
@ 2011-08-12 15:21 ` Keir Fraser
  2011-08-12 15:40   ` Xen 4.1.2 - when ? Boris Derzhavets
  0 siblings, 1 reply; 9+ messages in thread
From: Keir Fraser @ 2011-08-12 15:21 UTC (permalink / raw)
  To: Andrew Cooper, xen-devel

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Xen 4.1.2 - when ?
  2011-08-12 15:21 ` Keir Fraser
@ 2011-08-12 15:40   ` Boris Derzhavets
  2011-08-12 15:51     ` Keir Fraser
  0 siblings, 1 reply; 9+ messages in thread
From: Boris Derzhavets @ 2011-08-12 15:40 UTC (permalink / raw)
  To: xen-devel, Keir Fraser


[-- Attachment #1.1: Type: text/plain, Size: 77 bytes --]

Any time estimate for stable release Xen 4.1.2 ?
If it's possible.

Boris.



[-- Attachment #1.2: Type: text/html, Size: 208 bytes --]

[-- Attachment #2: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Xen 4.1.2 - when ?
  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:20       ` Andrew Cooper
  0 siblings, 2 replies; 9+ messages in thread
From: Keir Fraser @ 2011-08-12 15:51 UTC (permalink / raw)
  To: Boris Derzhavets, xen-devel; +Cc: Ian Jackson

We should consider doing a first RC for it asap. Does anyone have anything
specific to be backported that hasn't already been done? E.g., toolstack
stuff, Ian?

 -- Keir

On 12/08/2011 16:40, "Boris Derzhavets" <bderzhavets@yahoo.com> wrote:

> Any time estimate for stable release Xen 4.1.2 ?
> If it's possible.
> 
> Boris.
> 
> 
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Xen 4.1.2 - when ?
  2011-08-12 15:51     ` Keir Fraser
@ 2011-08-12 16:03       ` Jan Beulich
  2011-08-12 16:18         ` Keir Fraser
  2011-08-12 16:20       ` Andrew Cooper
  1 sibling, 1 reply; 9+ messages in thread
From: Jan Beulich @ 2011-08-12 16:03 UTC (permalink / raw)
  To: Keir Fraser; +Cc: xen-devel

>>> On 12.08.11 at 17:51, Keir Fraser <keir.xen@gmail.com> wrote:
> We should consider doing a first RC for it asap. Does anyone have anything
> specific to be backported that hasn't already been done? E.g., toolstack
> stuff, Ian?

There should be two patches from me in your queue/inbox which I
would both consider candidates.

Jan

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Re: Xen 4.1.2 - when ?
  2011-08-12 16:03       ` Jan Beulich
@ 2011-08-12 16:18         ` Keir Fraser
  2011-08-15  6:22           ` Jan Beulich
  0 siblings, 1 reply; 9+ messages in thread
From: Keir Fraser @ 2011-08-12 16:18 UTC (permalink / raw)
  To: Jan Beulich; +Cc: xen-devel

On 12/08/2011 17:03, "Jan Beulich" <JBeulich@novell.com> wrote:

>>>> On 12.08.11 at 17:51, Keir Fraser <keir.xen@gmail.com> wrote:
>> We should consider doing a first RC for it asap. Does anyone have anything
>> specific to be backported that hasn't already been done? E.g., toolstack
>> stuff, Ian?
> 
> There should be two patches from me in your queue/inbox which I
> would both consider candidates.

"x86/PCI-MSI: properly determine VF BAR values" and "VT-d: don't reject
valid DMAR/ATSR tables on systems with multiple PCI segments"?

 -- Keir

> Jan
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Re: Xen 4.1.2 - when ?
  2011-08-12 15:51     ` Keir Fraser
  2011-08-12 16:03       ` Jan Beulich
@ 2011-08-12 16:20       ` Andrew Cooper
  2011-08-12 17:02         ` Keir Fraser
  1 sibling, 1 reply; 9+ messages in thread
From: Andrew Cooper @ 2011-08-12 16:20 UTC (permalink / raw)
  To: xen-devel



On 12/08/11 16:51, Keir Fraser wrote:
> We should consider doing a first RC for it asap. Does anyone have anything
> specific to be backported that hasn't already been done? E.g., toolstack
> stuff, Ian?
>
>  -- Keir

I would suggest my irq fix from today as a candidate, if it gets through
staging in time

~Andrew

> On 12/08/2011 16:40, "Boris Derzhavets" <bderzhavets@yahoo.com> wrote:
>
>> Any time estimate for stable release Xen 4.1.2 ?
>> If it's possible.
>>
>> Boris.
>>
>>
>>
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel

-- 
Andrew Cooper - Dom0 Kernel Engineer, Citrix XenServer
T: +44 (0)1223 225 900, http://www.citrix.com

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Re: Xen 4.1.2 - when ?
  2011-08-12 16:20       ` Andrew Cooper
@ 2011-08-12 17:02         ` Keir Fraser
  0 siblings, 0 replies; 9+ messages in thread
From: Keir Fraser @ 2011-08-12 17:02 UTC (permalink / raw)
  To: Andrew Cooper, xen-devel

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

> 
> 
> On 12/08/11 16:51, Keir Fraser wrote:
>> We should consider doing a first RC for it asap. Does anyone have anything
>> specific to be backported that hasn't already been done? E.g., toolstack
>> stuff, Ian?
>> 
>>  -- Keir
> 
> I would suggest my irq fix from today as a candidate, if it gets through
> staging in time

Yeah, that's a definite one.

 Thanks,
 Keir

> ~Andrew
> 
>> On 12/08/2011 16:40, "Boris Derzhavets" <bderzhavets@yahoo.com> wrote:
>> 
>>> Any time estimate for stable release Xen 4.1.2 ?
>>> If it's possible.
>>> 
>>> Boris.
>>> 
>>> 
>>> 
>> 
>> 
>> _______________________________________________
>> Xen-devel mailing list
>> Xen-devel@lists.xensource.com
>> http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Re: Xen 4.1.2 - when ?
  2011-08-12 16:18         ` Keir Fraser
@ 2011-08-15  6:22           ` Jan Beulich
  0 siblings, 0 replies; 9+ messages in thread
From: Jan Beulich @ 2011-08-15  6:22 UTC (permalink / raw)
  To: Keir Fraser; +Cc: xen-devel

>>> On 12.08.11 at 18:18, Keir Fraser <keir.xen@gmail.com> wrote:
> On 12/08/2011 17:03, "Jan Beulich" <JBeulich@novell.com> wrote:
> 
>>>>> On 12.08.11 at 17:51, Keir Fraser <keir.xen@gmail.com> wrote:
>>> We should consider doing a first RC for it asap. Does anyone have anything
>>> specific to be backported that hasn't already been done? E.g., toolstack
>>> stuff, Ian?
>> 
>> There should be two patches from me in your queue/inbox which I
>> would both consider candidates.
> 
> "x86/PCI-MSI: properly determine VF BAR values" and "VT-d: don't reject
> valid DMAR/ATSR tables on systems with multiple PCI segments"?

Exactly.

Jan

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-08-15  6:22 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-12 13:54 [PATCH] IRQ fix incorrect logic in __clear_irq_vector (v2) Andrew Cooper
2011-08-12 15:21 ` Keir Fraser
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

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