Skip to contentSkip to conversation

IRQ fix incorrect logic in __clear_irq_vector (v2)

PATCH In review Andrew Cooper 4 participants 9 messages Aug 12, 2011 – Aug 15, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 IRQ fix incorrect logic in __clear_irq_vector (v2)

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

xen/arch/x86/irq.c +1 -0
diff -r 1f08b380d438 -r bd106cc2aa65 xen/arch/x86/irq.c
@@ -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++) {
#1 lore raw
Quoted 11 lines · 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

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

Quoted 18 lines

diff -r 1f08b380d438 -r bd106cc2aa65 xen/arch/x86/irq.c

xen/arch/x86/irq.c Fri Aug 12 14:54:11 2011 +0100 renamed from xen/arch/x86/irq.c Wed Aug 10 14:43:34 2011 +0100 +1 -0
@@ -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
[email protected]
http://lists.xensource.com/xen-devel

#3 lore raw

Re: Xen 4.1.2 - when ?

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

Quoted 7 lines · Boris Derzhavets

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

Boris.

#4 lore raw

Re: Xen 4.1.2 - when ?

Quoted 4 lines
Quoted 1 line
Quoted 1 line · Keir Fraser

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

#5 lore raw

Re: Re: Xen 4.1.2 - when ?

Quoted 7 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line · Keir Fraser

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

Quoted 2 lines

Jan

#6 lore raw

Re: Re: Xen 4.1.2 - when ?

Quoted 8 lines
Quoted 1 line
Quoted 1 line · Keir Fraser
Quoted 5 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line · Keir Fraser

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?

Quoted 5 lines
Quoted 2 lines

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

#7 lore raw

Re: Re: Xen 4.1.2 - when ?

In reply to Keir Fraser
Quoted 5 lines · Keir Fraser

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

Quoted 15 lines · Boris Derzhavets
Quoted 8 lines

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

Boris.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Signature · 2 lines
Andrew Cooper - Dom0 Kernel Engineer, Citrix XenServer
T: +44 (0)1223 225 900, http://www.citrix.com
#8 lore raw

Re: Re: Xen 4.1.2 - when ?

Quoted 11 lines · Andrew Cooper
Quoted 5 lines · Keir Fraser

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

Quoted 17 lines

~Andrew

Quoted 15 lines · Boris Derzhavets
Quoted 8 lines

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

Boris.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel