aboutsummaryrefslogtreecommitdiff
path: root/kernel/irq/manage.c
AgeCommit message (Collapse)AuthorFilesLines
2011-02-19genirq: Move IRQ_WAKEUP to coreThomas Gleixner1-2/+2
No users outside of core. Signed-off-by: Thomas Gleixner <[email protected]>
2011-02-19genirq: Move IRQ_SUSPENDED to coreThomas Gleixner1-4/+4
No users outside of core. Signed-off-by: Thomas Gleixner <[email protected]>
2011-02-19genirq: Move IRQ_MASKED to coreThomas Gleixner1-2/+3
Keep status in sync until all users are fixed. Signed-off-by: Thomas Gleixner <[email protected]>
2011-02-19genirq: Move IRQ_PENDING flag to coreThomas Gleixner1-2/+3
Keep status in sync until all users are fixed. Signed-off-by: Thomas Gleixner <[email protected]>
2011-02-19genirq: Move IRQ_DISABLED to coreThomas Gleixner1-2/+2
Keep status in sync until all abusers are fixed. Signed-off-by: Thomas Gleixner <[email protected]>
2011-02-19genirq: Move IRQ_REPLAY and IRQ_WAITING to coreThomas Gleixner1-2/+2
No users outside of core. Signed-off-by: Thomas Gleixner <[email protected]>
2011-02-19genirq: Move IRQ_ONESHOT to coreThomas Gleixner1-4/+4
No users outside of core. Signed-off-by: Thomas Gleixner <[email protected]>
2011-02-19genirq: Add IRQ_INPROGRESS to coreThomas Gleixner1-8/+9
We need to maintain the flag for now in both fields status and istate. Add a CONFIG_GENERIC_HARDIRQS_NO_COMPAT switch to allow testing w/o the status one. Wrap the access to status IRQ_INPROGRESS in a inline which can be turned of with CONFIG_GENERIC_HARDIRQS_NO_COMPAT along with the define. There is no reason that anything outside of core looks at this. That needs some modifications, but we'll get there. Signed-off-by: Thomas Gleixner <[email protected]>
2011-02-19genirq: Move IRQ_SPURIOUS_DISABLED to core stateThomas Gleixner1-5/+4
No users outside. Signed-off-by: Thomas Gleixner <[email protected]>
2011-02-19genirq: Move IRQ_AUTODETECT to internal stateThomas Gleixner1-1/+2
No users outside of core Signed-off-by: Thomas Gleixner <[email protected]>
2011-02-19genirq: Fixup core code namespace falloutThomas Gleixner1-1/+1
Signed-off-by: Thomas Gleixner <[email protected]>
2011-02-19genirq: Consolidate IRQ_DISABLEDThomas Gleixner1-6/+3
Handle IRQ_DISABLED consistent. Signed-off-by: Thomas Gleixner <[email protected]>
2011-02-19genirq: Remove default magicThomas Gleixner1-2/+2
Now that everything uses the wrappers, we can remove the default functions. None of those functions is performance critical. That makes the IRQ_MASKED flag tracking fully consistent. Signed-off-by: Thomas Gleixner <[email protected]>
2011-02-19genirq: Consolidate disable/enableThomas Gleixner1-1/+1
Create irq_disable/enable and use them to keep the flags consistent. Signed-off-by: Thomas Gleixner <[email protected]>
2011-02-19genirq: Consolidate startup/shutdown of interruptsThomas Gleixner1-9/+5
Aside of duplicated code some of the startup/shutdown sites do not handle the MASKED/DISABLED flags and the depth field at all. Move that to a helper function and take care of it there. Signed-off-by: Thomas Gleixner <[email protected]> Cc: Peter Zijlstra <[email protected]> LKML-Reference: <[email protected]>
2011-02-19genirq: Remove bogus conditionalThomas Gleixner1-4/+1
The if (chip->irq_shutdown) check will always evaluate to true, as we fill in chip->irq_shutdown with default_shutdown in irq_chip_set_defaults() if the chip does not provide its own function. Signed-off-by: Thomas Gleixner <[email protected]> Cc: Peter Zijlstra <[email protected]> LKML-Reference: <[email protected]>
2011-02-19genirq: Remove redundant thread affinity settingThomas Gleixner1-2/+0
Thread affinity is already set by setup_affinity(). Signed-off-by: Thomas Gleixner <[email protected]>
2011-02-19genirq: Do not copy affinity before setThomas Gleixner1-13/+34
While rumaging through arch code I found that there are a few workarounds which deal with the fact that the initial affinity setting from request_irq() copies the mask into irq_data->affinity before the chip code is called. In the normal path we unconditionally copy the mask when the chip code returns 0. Copy after the code is called and add a return code IRQ_SET_MASK_OK_NOCOPY for the chip functions, which prevents the copy. That way we see the real mask when the chip function decided to truncate it further as some arches do. IRQ_SET_MASK_OK is 0, which is the current behaviour. Signed-off-by: Thomas Gleixner <[email protected]>
2011-02-19genirq: Always apply cpu online maskThomas Gleixner1-6/+6
If the affinity had been set by the user, then a later request_irq() will honour that setting. But online cpus can have changed. So apply the online mask and for this case as well. Signed-off-by: Thomas Gleixner <[email protected]>
2011-02-19genirq: Rremove redundant checkThomas Gleixner1-1/+2
IRQ_NO_BALANCING is already checked in irq_can_set_affinity() above, no need to check it again. Signed-off-by: Thomas Gleixner <[email protected]>
2011-02-19genirq: Simplify affinity related codeThomas Gleixner1-23/+41
There is lot of #ifdef CONFIG_GENERIC_PENDING_IRQ along with duplicated code in the irq core. Move the #ifdeffery into one place and cleanup the code so it's readable. No functional change. Signed-off-by: Thomas Gleixner <[email protected]>
2011-02-19genirq: Namespace cleanupThomas Gleixner1-3/+3
The irq namespace has become quite convoluted. My bad. Clean it up and deprecate the old functions. All new functions follow the scheme: irq number based: irq_set/get/xxx/_xxx(unsigned int irq, ...) irq_data based: irq_data_set/get/xxx/_xxx(struct irq_data *d, ....) irq_desc based: irq_desc_get_xxx(struct irq_desc *desc) Signed-off-by: Thomas Gleixner <[email protected]>
2011-02-19genirq: Add missing buslock to set_irq_type(), set_irq_wake()Thomas Gleixner1-0/+2
chips behind a slow bus cannot update the chip under desc->lock, but we miss the chip_buslock/chip_bus_sync_unlock() calls around the set type and set wake functions. Signed-off-by: Thomas Gleixner <[email protected]>
2011-02-19Merge branch 'irq/urgent' into irq/coreThomas Gleixner1-1/+1
Reason: Further patches are conflicting with mainline fixes Signed-off-by: Thomas Gleixner <[email protected]>
2011-02-19genirq: Disable the SHIRQ_DEBUG call in request_threaded_irq for nowThomas Gleixner1-1/+1
With CONFIG_SHIRQ_DEBUG=y we call a newly installed interrupt handler in request_threaded_irq(). The original implementation (commit a304e1b8) called the handler _BEFORE_ it was installed, but that caused problems with handlers calling disable_irq_nosync(). See commit 377bf1e4. It's braindead in the first place to call disable_irq_nosync in shared handlers, but .... Moving this call after we installed the handler looks innocent, but it is very subtle broken on SMP. Interrupt handlers rely on the fact, that the irq core prevents reentrancy. Now this debug call violates that promise because we run the handler w/o the IRQ_INPROGRESS protection - which we cannot apply here because that would result in a possibly forever masked interrupt line. A concurrent real hardware interrupt on a different CPU results in handler reentrancy and can lead to complete wreckage, which was unfortunately observed in reality and took a fricking long time to debug. Leave the code here for now. We want this debug feature, but that's not easy to fix. We really should get rid of those disable_irq_nosync() abusers and remove that function completely. Signed-off-by: Thomas Gleixner <[email protected]> Cc: Anton Vorontsov <[email protected]> Cc: David Woodhouse <[email protected]> Cc: Arjan van de Ven <[email protected]> Cc: [email protected] # .28 -> .37
2011-02-11Merge branch 'irq/for-mips' into irq/coreThomas Gleixner1-1/+6
Reason: irq/for-mips is provided for mips to make core independent progress. Merge it into irq/core to avoid conflicts Signed-off-by: Thomas Gleixner <[email protected]>
2011-02-11genirq: Call bus_lock/unlock functions in setup_irq()David Daney1-1/+6
irq_chips that supply .irq_bus_lock/.irq_bus_sync_unlock functions, expect that the other chip methods will be called inside of calls to the pair. If this expectation is not met, things tend to not work. Make setup_irq() call chip_bus_lock()/chip_bus_sync_unlock() too. For the vast majority of irq_chips, this will be a NOP as most don't have these bus lock functions. [ tglx: No we don't want to call that in __setup_irq(). Way too many error exit pathes. ] Signed-off-by: David Daney <[email protected]> LKML-Reference: <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]>
2011-02-08Merge branch 'irq/for-xen' into irq/coreThomas Gleixner1-1/+10
irq/for-xen contains new functionality to avoid Xen private irq hackery. That branch has a single irq commit and is pulled by Xen to base their new features on. Merge it into irq/core as other patches modify the same code. Signed-off-by: Thomas Gleixner <[email protected]>
2011-02-08genirq: Add IRQF_FORCE_RESUMEThomas Gleixner1-1/+10
Xen needs to reenable interrupts which are marked IRQF_NO_SUSPEND in the resume path. Add a flag to force the reenabling in the resume code. Tested-and-acked-by: Ian Campbell <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]>
2011-01-31genirq: Fix affinity notifier falloutThomas Gleixner1-1/+1
The new code of commit cd7eab44e(genirq: Add IRQ affinity notifiers) references irq_desc.affinity which fails to compile with CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED=y. Use irq_desc.irq_data.affinity instead. Signed-off-by: Thomas Gleixner <[email protected]> Cc: Ben Hutchings <[email protected]>
2011-01-22genirq: Add IRQ affinity notifiersBen Hutchings1-0/+82
When initiating I/O on a multiqueue and multi-IRQ device, we may want to select a queue for which the response will be handled on the same or a nearby CPU. This requires a reverse-map of IRQ affinity. Add a notification mechanism to support this. This is based closely on work by Thomas Gleixner <[email protected]>. Signed-off-by: Ben Hutchings <[email protected]> Cc: [email protected] Cc: Tom Herbert <[email protected]> Cc: David Miller <[email protected]> LKML-Reference: <1295470904.11126.84.camel@bwh-desktop> Signed-off-by: Thomas Gleixner <[email protected]>
2011-01-07sched: Constify function scope static struct sched_param usagePeter Zijlstra1-1/+1
Function-scope statics are discouraged because they are easily overlooked and can cause subtle bugs/races due to their global (non-SMP safe) nature. Linus noticed that we did this for sched_param - at minimum make the const. Suggested-by: Linus Torvalds <[email protected]> Signed-off-by: Peter Zijlstra <[email protected]> LKML-Reference: Message-ID: <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
2010-11-18Merge commit 'v2.6.37-rc2' into sched/coreIngo Molnar1-0/+4
Merge reason: Move to a .37-rc base. Signed-off-by: Ingo Molnar <[email protected]>
2010-10-23sched: Make sched_param argument static in sched_setscheduler() callersKOSAKI Motohiro1-1/+3
Andrew Morton pointed out almost all sched_setscheduler() callers are using fixed parameters and can be converted to static. It reduces runtime memory use a little. Signed-off-by: KOSAKI Motohiro <[email protected]> Reported-by: Andrew Morton <[email protected]> Acked-by: James Morris <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Steven Rostedt <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
2010-10-22genirq: Warn if enable_irq is called before irq is set upThomas Gleixner1-0/+4
The recent changes in the genirq core unearthed a bug in arch/um which called enable_irq() before the interrupt was set up. Warn and return instead of crashing the machine with a NULL pointer dereference. Signed-off-by: Thomas Gleixner <[email protected]> Cc: Richard Weinberger <[email protected]>
2010-10-04genirq: Provide compat handling for chip->set_wake()Thomas Gleixner1-2/+2
Wrap the old chip function set_wake() until the migration is complete and the old chip functions are removed. Signed-off-by: Thomas Gleixner <[email protected]> Cc: Peter Zijlstra <[email protected]> LKML-Reference: <[email protected]> Reviewed-by: H. Peter Anvin <[email protected]> Reviewed-by: Ingo Molnar <[email protected]>
2010-10-04genirq: Provide compat handling for chip->set_type()Thomas Gleixner1-5/+5
Wrap the old chip function set_type() until the migration is complete and the old chip functions are removed. Signed-off-by: Thomas Gleixner <[email protected]> Cc: Peter Zijlstra <[email protected]> LKML-Reference: <[email protected]> Reviewed-by: H. Peter Anvin <[email protected]> Reviewed-by: Ingo Molnar <[email protected]>
2010-10-04genirq: Provide compat handling for chip->set_affinity()Thomas Gleixner1-5/+6
Wrap the old chip function set_affinity() until the migration is complete and the old chip functions are removed. Signed-off-by: Thomas Gleixner <[email protected]> Cc: Peter Zijlstra <[email protected]> LKML-Reference: <[email protected]> Reviewed-by: H. Peter Anvin <[email protected]> Reviewed-by: Ingo Molnar <[email protected]>
2010-10-04genirq: Provide compat handling for chip->startup()Thomas Gleixner1-1/+1
Wrap the old chip function startup() until the migration is complete and the old chip functions are removed. Signed-off-by: Thomas Gleixner <[email protected]> Cc: Peter Zijlstra <[email protected]> LKML-Reference: <[email protected]> Reviewed-by: H. Peter Anvin <[email protected]> Reviewed-by: Ingo Molnar <[email protected]>
2010-10-04genirq: Provide compat handling for chip->disable()/shutdown()Thomas Gleixner1-4/+4
Wrap the old chip functions disable() and shutdown() until the migration is complete and the old chip functions are removed. Signed-off-by: Thomas Gleixner <[email protected]> Cc: Peter Zijlstra <[email protected]> LKML-Reference: <[email protected]> Reviewed-by: H. Peter Anvin <[email protected]> Reviewed-by: Ingo Molnar <[email protected]>
2010-10-04genirq: Provide compat handling for chip->unmask()Thomas Gleixner1-1/+1
Wrap the old chip function unmask() until the migration is complete and the old chip functions are removed. Signed-off-by: Thomas Gleixner <[email protected]> Cc: Peter Zijlstra <[email protected]> LKML-Reference: <[email protected]> Reviewed-by: H. Peter Anvin <[email protected]> Reviewed-by: Ingo Molnar <[email protected]>
2010-10-04genirq: Provide compat handling for bus_lock/bus_sync_unlockThomas Gleixner1-11/+11
Wrap the old chip functions for bus_lock/bus_sync_unlock until the migration is complete and the old chip functions are removed. Signed-off-by: Thomas Gleixner <[email protected]> Cc: Peter Zijlstra <[email protected]> LKML-Reference: <[email protected]> Reviewed-by: H. Peter Anvin <[email protected]> Reviewed-by: Ingo Molnar <[email protected]>
2010-10-04genirq: Convert core code to irq_dataThomas Gleixner1-27/+27
Convert all references in the core code to orq, chip, handler_data, chip_data, msi_desc, affinity to irq_data.* Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Ingo Molnar <[email protected]>
2010-07-29irq: Add new IRQ flag IRQF_NO_SUSPENDIan Campbell1-1/+1
A small number of users of IRQF_TIMER are using it for the implied no suspend behaviour on interrupts which are not timer interrupts. Therefore add a new IRQF_NO_SUSPEND flag, rename IRQF_TIMER to __IRQF_TIMER and redefine IRQF_TIMER in terms of these new flags. Signed-off-by: Ian Campbell <[email protected]> Cc: Jeremy Fitzhardinge <[email protected]> Cc: Dmitry Torokhov <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Grant Likely <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] LKML-Reference: <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]>
2010-06-09genirq: Deal with desc->set_type() changing desc->chipThomas Gleixner1-0/+3
The set_type() function can change the chip implementation when the trigger mode changes. That might result in using an non-initialized irq chip when called from __setup_irq() or when called via set_irq_type() on an already enabled irq. The set_irq_type() function should not be called on an enabled irq, but because we forgot to put a check into it, we have a bunch of users which grew the habit of doing that and it never blew up as the function is serialized via desc->lock against all users of desc->chip and they never hit the non-initialized irq chip issue. The easy fix for the __setup_irq() issue would be to move the irq_chip_set_defaults(desc->chip) call after the trigger setting to make sure that a chip change is covered. But as we have already users, which do the type setting after request_irq(), the safe fix for now is to call irq_chip_set_defaults() from __irq_set_trigger() when desc->set_type() changed the irq chip. It needs a deeper analysis whether we should refuse to change the chip on an already enabled irq, but that'd be a large scale change to fix all the existing users. So that's neither stable nor 2.6.35 material. Reported-by: Esben Haabendal <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Cc: linuxppc-dev <[email protected]> Cc: [email protected]
2010-05-03genirq: Add CPU mask affinity hintPeter P Waskiewicz Jr1-0/+22
This patch adds a cpumask affinity hint to the irq_desc structure, along with a registration function and a read-only proc entry for each interrupt. This affinity_hint handle for each interrupt can be used by underlying drivers that need a better mechanism to control interrupt affinity. The underlying driver can register a cpumask for the interrupt, which will allow the driver to provide the CPU mask for the interrupt to anything that requests it. The intent is to extend the userspace daemon, irqbalance, to help hint to it a preferred CPU mask to balance the interrupt into. [ tglx: Fixed compile warnings, added WARN_ON, made SMP only ] Signed-off-by: Peter P Waskiewicz Jr <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] LKML-Reference: <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]>
2010-04-13genirq: Remove IRQF_DISABLED from core codeThomas Gleixner1-30/+0
Remove all code which is related to IRQF_DISABLED from the core kernel code. IRQF_DISABLED still exists as a flag, but becomes a NOOP and will be removed after a grace period. That way we can easily revert to the previous behaviour by just restoring the core code. Signed-off-by: Thomas Gleixner <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Alan Cox <[email protected]> Cc: Andi Kleen <[email protected]> Cc: David Miller <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: Linus Torvalds <[email protected]> LKML-Reference: <[email protected]>
2010-04-13genirq: Introduce request_any_context_irq()Marc Zyngier1-0/+37
Now that we enjoy threaded interrupts, we're starting to see irq_chip implementations (wm831x, pca953x) that make use of threaded interrupts for the controller, and nested interrupts for the client interrupt. It all works very well, with one drawback: Drivers requesting an IRQ must now know whether the handler will run in a thread context or not, and call request_threaded_irq() or request_irq() accordingly. The problem is that the requesting driver sometimes doesn't know about the nature of the interrupt, specially when the interrupt controller is a discrete chip (typically a GPIO expander connected over I2C) that can be connected to a wide variety of otherwise perfectly supported hardware. This patch introduces the request_any_context_irq() function that mostly mimics the usual request_irq(), except that it checks whether the irq level is configured as nested or not, and calls the right backend. On success, it also returns either IRQC_IS_HARDIRQ or IRQC_IS_NESTED. [ tglx: Made return value an enum, simplified code and made the export of request_any_context_irq GPL ] Signed-off-by: Marc Zyngier <[email protected]> Cc: <[email protected]> LKML-Reference: <927ea285bd0c68934ddae1a47e44a9ba@localhost> Signed-off-by: Thomas Gleixner <[email protected]>
2010-03-31genirq: Force MSI irq handlers to run with interrupts disabledThomas Gleixner1-0/+10
Network folks reported that directing all MSI-X vectors of their multi queue NICs to a single core can cause interrupt stack overflows when enough interrupts fire at the same time. This is caused by the fact that we run interrupt handlers by default with interrupts enabled unless the driver reuqests the interrupt with the IRQF_DISABLED set. The NIC handlers do not set this flag, so simultaneous interrupts can nest unlimited and cause the stack overflow. The only safe counter measure is to run the interrupt handlers with interrupts disabled. We can't switch to this mode in general right now, but it is safe to do so for MSI interrupts. Force IRQF_DISABLED for MSI interrupt handlers. Signed-off-by: Thomas Gleixner <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Alan Cox <[email protected]> Cc: David Miller <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: [email protected]
2010-03-24genirq: Protect access to irq_desc->action in can_request_irq()Thomas Gleixner1-0/+4
can_request_irq() accesses and dereferences irq_desc->action w/o holding irq_desc->lock. So action can be freed on another CPU before it's dereferenced. Unlikely, but ... Protect it with desc->lock. Signed-off-by: Thomas Gleixner <[email protected]>