Fix irqaction sleep-in-lock
This removes cli/sti from the irqaction allocation, and also prevents the allocation from sleeping while holding the lock. This will only matter once we have modules working. Dave, please apply if this looks ok.
This will be the last patch for a while from me as I'm out of the country on business until the 20th. Sparc32 hackers who want me to look over patches should expect some additional latency.
=== arch/sparc/kernel/irq.c 1.25 vs edited ==--- 1.25/arch/sparc/kernel/irq.c Mon Dec 29 13:37:39 2003
+++ edited/arch/sparc/kernel/irq.c Thu Jan 8 22:53:40 2004
@@ -49,6 +49,9 @@
#include <asm/pcic.h>
#include <asm/cacheflush.h>
+/* Used to protect the IRQ action lists */
+spinlock_t irq_action_lock = SPIN_LOCK_UNLOCKED;
+
/*
* Dave Redman ([email protected])
*
@@ -492,7 +495,7 @@
return -EBUSY;
}
- save_and_cli(flags);
+ spin_lock_irqsave(&irq_action_lock, flags);
/* If this is flagged as statically allocated then we use our
* private struct which is never freed.
@@ -507,10 +510,10 @@
if (action = NULL)
action = (struct irqaction *)kmalloc(sizeof(struct irqaction),
- GFP_KERNEL);
+ GFP_ATOMIC);
if (!action) {
- restore_flags(flags);
+ spin_unlock_irqrestore(&irq_action_lock, flags);
return -ENOMEM;
}
@@ -547,7 +550,7 @@
*(cpu_irq + irq_action) = action;
enable_irq(irq);
- restore_flags(flags);
+ spin_unlock_irqrestore(&irq_action_lock, flags);
return 0;
}
@@ -586,7 +589,7 @@
action = NULL; /* Or else! */
}
- save_and_cli(flags);
+ spin_lock_irqsave(&irq_action_lock, flags);
/* If this is flagged as statically allocated then we use our
* private struct which is never freed.
@@ -600,10 +603,10 @@
if (action = NULL)
action = (struct irqaction *)kmalloc(sizeof(struct irqaction),
- GFP_KERNEL);
+ GFP_ATOMIC);
if (!action) {
- restore_flags(flags);
+ spin_unlock_irqrestore(&irq_action_lock, flags);
return -ENOMEM;
}
@@ -620,7 +623,7 @@
*(cpu_irq + irq_action) = action;
enable_irq(irq);
- restore_flags(flags);
+ spin_unlock_irqrestore(&irq_action_lock, flags);
return 0;
}
Signature · 4 lines
Keith M Wesolowski <[email protected]> http://foobazco.org/~wesolows ------(( Project Foobazco Coordinator and Network Administrator ))------ "May Buddha bless all stubborn people!" -- Uliassutai Karakorum Blake
David S. Miller
AppliedQuoted 4 lines · On Thu, 8 Jan 2004 23:08:22 -0800 Keith M Wesolowski <[email protected]>…
This removes cli/sti from the irqaction allocation, and also prevents the allocation from sleeping while holding the lock. This will only matter once we have modules working. Dave, please apply if this looks ok.
Applied, thanks Keith.