Skip to contentSkip to conversation

irq: Remove irqaction.free_on_release

PATCH In review Andrew Cooper 2 participants 3 messages Oct 8, 2012 – Oct 9, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 irq: Remove irqaction.free_on_release

It is always set to 1, and only checked on some of the codepaths which free an irqaction.

--
This patch does touch common code as well as x86 and arm architectures, so probably needs quite a few acks.

xen/arch/arm/gic.c +1 -1
diff -r 5fbdbf585f5f -r 37f1afbec80b xen/arch/arm/gic.c
@@ -373,7 +373,7 @@ void __init release_irq(unsigned int irq
     /* Wait to make sure it's not being used on another CPU */
     do { smp_mb(); } while ( desc->status & IRQ_INPROGRESS );
 
-    if (action && action->free_on_release)
+    if ( action )
         xfree(action);
 }
 
xen/arch/arm/irq.c +0 -1
diff -r 5fbdbf585f5f -r 37f1afbec80b xen/arch/arm/irq.c
@@ -97,7 +97,6 @@ int __init request_irq(unsigned int irq,
     action->handler = handler;
     action->name = devname;
     action->dev_id = dev_id;
-    action->free_on_release = 1;
 
     retval = setup_irq(irq, action);
     if (retval)
xen/arch/x86/irq.c +1 -2
diff -r 5fbdbf585f5f -r 37f1afbec80b xen/arch/x86/irq.c
@@ -952,7 +952,6 @@ int __init request_irq(unsigned int irq,
     action->handler = handler;
     action->name = devname;
     action->dev_id = dev_id;
-    action->free_on_release = 1;
 
     retval = setup_irq(irq, action);
     if (retval)
@@ -979,7 +978,7 @@ void __init release_irq(unsigned int irq
     /* Wait to make sure it's not being used on another CPU */
     do { smp_mb(); } while ( desc->status & IRQ_INPROGRESS );
 
-    if (action && action->free_on_release)
+    if ( action )
         xfree(action);
 }
 
xen/include/xen/irq.h +0 -1
diff -r 5fbdbf585f5f -r 37f1afbec80b xen/include/xen/irq.h
@@ -13,7 +13,6 @@ struct irqaction {
     void (*handler)(int, void *, struct cpu_user_regs *);
     const char *name;
     void *dev_id;
-    bool_t free_on_release;
 };
 
 /*
#1 lore raw

But reasoning behind c/s 20153, which introduced it, still applies? Callers using setup_irq() don't want their passed-in irqaction to be xfree()ed?

-- Keir

Quoted 63 lines · Andrew Cooper

It is always set to 1, and only checked on some of the codepaths which free an irqaction.

--
This patch does touch common code as well as x86 and arm architectures, so probably needs quite a few acks.

diff -r 5fbdbf585f5f -r 37f1afbec80b xen/arch/arm/gic.c

xen/arch/arm/gic.c +1 -1
@@ -373,7 +373,7 @@ void __init release_irq(unsigned int irq
     /* Wait to make sure it's not being used on another CPU */
     do { smp_mb(); } while ( desc->status & IRQ_INPROGRESS );
 
-    if (action && action->free_on_release)
+    if ( action )
         xfree(action);
 }
 

diff -r 5fbdbf585f5f -r 37f1afbec80b xen/arch/arm/irq.c

xen/arch/arm/irq.c +0 -1
@@ -97,7 +97,6 @@ int __init request_irq(unsigned int irq,
     action->handler = handler;
     action->name = devname;
     action->dev_id = dev_id;
-    action->free_on_release = 1;
 
     retval = setup_irq(irq, action);
     if (retval)

diff -r 5fbdbf585f5f -r 37f1afbec80b xen/arch/x86/irq.c

xen/arch/x86/irq.c +1 -2
@@ -952,7 +952,6 @@ int __init request_irq(unsigned int irq,
     action->handler = handler;
     action->name = devname;
     action->dev_id = dev_id;
-    action->free_on_release = 1;
 
     retval = setup_irq(irq, action);
     if (retval)
@@ -979,7 +978,7 @@ void __init release_irq(unsigned int irq
     /* Wait to make sure it's not being used on another CPU */
     do { smp_mb(); } while ( desc->status & IRQ_INPROGRESS );
 
-    if (action && action->free_on_release)
+    if ( action )
         xfree(action);
 }
 

diff -r 5fbdbf585f5f -r 37f1afbec80b xen/include/xen/irq.h

xen/include/xen/irq.h +0 -1
@@ -13,7 +13,6 @@ struct irqaction {
     void (*handler)(int, void *, struct cpu_user_regs *);
     const char *name;
     void *dev_id;
-    bool_t free_on_release;
 };
 
 /*
#2 lore raw
Quoted 4 lines · Keir Fraser

But reasoning behind c/s 20153, which introduced it, still applies? Callers using setup_irq() don't want their passed-in irqaction to be xfree()ed?

-- Keir

Yikes - yes it does. My original reading of the code was that it was being set, hence the patch, but upon closer reading I am wrong.

As for grep'ing, it is only ever implicitly set to 0 by compound struct initialisation with { 0 }

Furthermore, there is now a case where an ns16550 uart->irq can be set higher than nr_irqs_gsi, although it is unclear whether this will actually cause a problem and hit the unconditional xfree(action) in dynamic_irq_cleanip(), which is only protected by BUG()'ing if the irq index is within the gsi range.

~Andrew

Quoted 67 lines · Andrew Cooper
Quoted 64 lines

It is always set to 1, and only checked on some of the codepaths which free an irqaction.

--
This patch does touch common code as well as x86 and arm architectures, so probably needs quite a few acks.

diff -r 5fbdbf585f5f -r 37f1afbec80b xen/arch/arm/gic.c

xen/arch/arm/gic.c +1 -1
@@ -373,7 +373,7 @@ void __init release_irq(unsigned int irq
     /* Wait to make sure it's not being used on another CPU */
     do { smp_mb(); } while ( desc->status & IRQ_INPROGRESS );
 
-    if (action && action->free_on_release)
+    if ( action )
         xfree(action);
 }
 

diff -r 5fbdbf585f5f -r 37f1afbec80b xen/arch/arm/irq.c

xen/arch/arm/irq.c +0 -1
@@ -97,7 +97,6 @@ int __init request_irq(unsigned int irq,
     action->handler = handler;
     action->name = devname;
     action->dev_id = dev_id;
-    action->free_on_release = 1;
 
     retval = setup_irq(irq, action);
     if (retval)

diff -r 5fbdbf585f5f -r 37f1afbec80b xen/arch/x86/irq.c

xen/arch/x86/irq.c +1 -2
@@ -952,7 +952,6 @@ int __init request_irq(unsigned int irq,
     action->handler = handler;
     action->name = devname;
     action->dev_id = dev_id;
-    action->free_on_release = 1;
 
     retval = setup_irq(irq, action);
     if (retval)
@@ -979,7 +978,7 @@ void __init release_irq(unsigned int irq
     /* Wait to make sure it's not being used on another CPU */
     do { smp_mb(); } while ( desc->status & IRQ_INPROGRESS );
 
-    if (action && action->free_on_release)
+    if ( action )
         xfree(action);
 }
 

diff -r 5fbdbf585f5f -r 37f1afbec80b xen/include/xen/irq.h

xen/include/xen/irq.h +0 -1
@@ -13,7 +13,6 @@ struct irqaction {
     void (*handler)(int, void *, struct cpu_user_regs *);
     const char *name;
     void *dev_id;
-    bool_t free_on_release;
 };
 
 /*
Signature · 2 lines
Andrew Cooper - Dom0 Kernel Engineer, Citrix XenServer
T: +44 (0)1223 225 900, http://www.citrix.com