irq_work: Add generic hardirq context callbacks
authorPeter Zijlstra <a.p.zijlstra@chello.nl>
Thu, 14 Oct 2010 06:01:34 +0000 (14:01 +0800)
committerIngo Molnar <mingo@elte.hu>
Mon, 18 Oct 2010 17:58:50 +0000 (19:58 +0200)
commite360adbe29241a0194e10e20595360dd7b98a2b3
treeef5fa5f50a895096bfb25bc11b25949603158238
parent8e5fc1a7320baf6076391607515dceb61319b36a
irq_work: Add generic hardirq context callbacks

Provide a mechanism that allows running code in IRQ context. It is
most useful for NMI code that needs to interact with the rest of the
system -- like wakeup a task to drain buffers.

Perf currently has such a mechanism, so extract that and provide it as
a generic feature, independent of perf so that others may also
benefit.

The IRQ context callback is generated through self-IPIs where
possible, or on architectures like powerpc the decrementer (the
built-in timer facility) is set to generate an interrupt immediately.

Architectures that don't have anything like this get to do with a
callback from the timer tick. These architectures can call
irq_work_run() at the tail of any IRQ handlers that might enqueue such
work (like the perf IRQ handler) to avoid undue latencies in
processing the work.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Kyle McMartin <kyle@mcmartin.ca>
Acked-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
[ various fixes ]
Signed-off-by: Huang Ying <ying.huang@intel.com>
LKML-Reference: <1287036094.7768.291.camel@yhuang-dev>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
39 files changed:
arch/alpha/Kconfig
arch/alpha/include/asm/perf_event.h
arch/alpha/kernel/time.c
arch/arm/Kconfig
arch/arm/include/asm/perf_event.h
arch/arm/kernel/perf_event.c
arch/frv/Kconfig
arch/frv/lib/Makefile
arch/frv/lib/perf_event.c [deleted file]
arch/parisc/Kconfig
arch/parisc/include/asm/perf_event.h
arch/powerpc/Kconfig
arch/powerpc/include/asm/paca.h
arch/powerpc/kernel/time.c
arch/s390/Kconfig
arch/s390/include/asm/perf_event.h
arch/sh/Kconfig
arch/sh/include/asm/perf_event.h
arch/sparc/Kconfig
arch/sparc/include/asm/perf_event.h
arch/sparc/kernel/pcr.c
arch/x86/Kconfig
arch/x86/include/asm/entry_arch.h
arch/x86/include/asm/hardirq.h
arch/x86/include/asm/hw_irq.h
arch/x86/include/asm/irq_vectors.h
arch/x86/kernel/Makefile
arch/x86/kernel/cpu/perf_event.c
arch/x86/kernel/entry_64.S
arch/x86/kernel/irq.c
arch/x86/kernel/irq_work.c [new file with mode: 0644]
arch/x86/kernel/irqinit.c
include/linux/irq_work.h [new file with mode: 0644]
include/linux/perf_event.h
init/Kconfig
kernel/Makefile
kernel/irq_work.c [new file with mode: 0644]
kernel/perf_event.c
kernel/timer.c