kernel-ark/include/asm-mips
David Howells 7d12e780e0 IRQ: Maintain regs pointer globally rather than passing to IRQ handlers
Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
of passing regs around manually through all ~1800 interrupt handlers in the
Linux kernel.

The regs pointer is used in few places, but it potentially costs both stack
space and code to pass it around.  On the FRV arch, removing the regs parameter
from all the genirq function results in a 20% speed up of the IRQ exit path
(ie: from leaving timer_interrupt() to leaving do_IRQ()).

Where appropriate, an arch may override the generic storage facility and do
something different with the variable.  On FRV, for instance, the address is
maintained in GR28 at all times inside the kernel as part of general exception
handling.

Having looked over the code, it appears that the parameter may be handed down
through up to twenty or so layers of functions.  Consider a USB character
device attached to a USB hub, attached to a USB controller that posts its
interrupts through a cascaded auxiliary interrupt controller.  A character
device driver may want to pass regs to the sysrq handler through the input
layer which adds another few layers of parameter passing.

I've build this code with allyesconfig for x86_64 and i386.  I've runtested the
main part of the code on FRV and i386, though I can't test most of the drivers.
I've also done partial conversion for powerpc and MIPS - these at least compile
with minimal configurations.

This will affect all archs.  Mostly the changes should be relatively easy.
Take do_IRQ(), store the regs pointer at the beginning, saving the old one:

	struct pt_regs *old_regs = set_irq_regs(regs);

And put the old one back at the end:

	set_irq_regs(old_regs);

Don't pass regs through to generic_handle_irq() or __do_IRQ().

In timer_interrupt(), this sort of change will be necessary:

	-	update_process_times(user_mode(regs));
	-	profile_tick(CPU_PROFILING, regs);
	+	update_process_times(user_mode(get_irq_regs()));
	+	profile_tick(CPU_PROFILING);

I'd like to move update_process_times()'s use of get_irq_regs() into itself,
except that i386, alone of the archs, uses something other than user_mode().

Some notes on the interrupt handling in the drivers:

 (*) input_dev() is now gone entirely.  The regs pointer is no longer stored in
     the input_dev struct.

 (*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking.  It does
     something different depending on whether it's been supplied with a regs
     pointer or not.

 (*) Various IRQ handler function pointers have been moved to type
     irq_handler_t.

Signed-Off-By: David Howells <dhowells@redhat.com>
(cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
2006-10-05 15:10:12 +01:00
..
arc
ddb5xxx
dec
emma2rh
ip32
jmr3927
lasat
mach-atlas [MIPS] Atlas: update interrupt handling 2006-09-27 13:37:42 +01:00
mach-au1x00 [PATCH] Alchemy: Delete unused pt_regs * argument from au1xxx_dbdma_chan_alloc 2006-09-26 08:48:54 -07:00
mach-cobalt [MIPS] Use the proper technical term for naming some of the cache macros. 2006-07-13 21:26:04 +01:00
mach-db1x00 [PATCH] Au1550/1200: add missing PSC #define's, make OSS driver use the proper ones 2006-06-23 07:42:56 -07:00
mach-dec [PATCH] char/rtc: Handle memory-mapped chips properly 2006-07-10 13:24:25 -07:00
mach-emma2rh
mach-ev64120 [MIPS] Add UART IRQ number for EV64120 2006-10-01 23:16:59 +01:00
mach-excite [MIPS] s/__ASSEMBLER__/__ASSEMBLY__/ for clarity sake. 2006-09-27 13:37:57 +01:00
mach-generic [PATCH] irq-flags: MIPS: Use the new IRQF_ constants 2006-07-02 13:58:47 -07:00
mach-ip22
mach-ip27 [PATCH] sched: introduce child field in sched_domain 2006-10-03 08:04:06 -07:00
mach-ip32
mach-ja [MIPS] Use the proper technical term for naming some of the cache macros. 2006-07-13 21:26:04 +01:00
mach-jazz [PATCH] irq-flags: MIPS: Use the new IRQF_ constants 2006-07-02 13:58:47 -07:00
mach-jmr3927
mach-lasat
mach-mips [MIPS] Use the proper technical term for naming some of the cache macros. 2006-07-13 21:26:04 +01:00
mach-ocelot
mach-ocelot3 [MIPS] Use the proper technical term for naming some of the cache macros. 2006-07-13 21:26:04 +01:00
mach-pb1x00
mach-pnx8550 [MIPS] PNX8550 fixups 2006-10-04 18:06:15 +01:00
mach-qemu [MIPS] Qemu does not have D-cache aliases 2006-09-27 13:37:49 +01:00
mach-rm200
mach-sibyte [MIPS] Use the proper technical term for naming some of the cache macros. 2006-07-13 21:26:04 +01:00
mach-sim [MIPS] Use the proper technical term for naming some of the cache macros. 2006-07-13 21:26:04 +01:00
mach-wrppmc
mach-yosemite [MIPS] Use the proper technical term for naming some of the cache macros. 2006-07-13 21:26:04 +01:00
mips-boards [MIPS] Atlas: update interrupt handling 2006-09-27 13:37:42 +01:00
pci
sgi
sibyte [MIPS] s/__ASSEMBLER__/__ASSEMBLY__/ for clarity sake. 2006-09-27 13:37:57 +01:00
sn [MIPS] Remove BSD and Sys V compat data types. 2006-06-29 21:10:54 +01:00
tx4927
tx4938 fix file specification in comments 2006-10-03 23:01:26 +02:00
vr41xx [MIPS] vr41xx: Update workpad setup function 2006-07-13 21:26:21 +01:00
xtalk
8253pit.h
a.out.h
abi.h
addrspace.h
apm.h [MIPS] Don't include obsolete <linux/config.h>. 2006-07-13 21:25:58 +01:00
asm.h
asmmacro-32.h
asmmacro-64.h
asmmacro.h [MIPS] Fix use of ehb instruction for non-R2 configurations. 2006-06-29 21:10:49 +01:00
atomic.h [MIPS] TRACE_IRQFLAGS_SUPPORT support. 2006-07-13 21:26:09 +01:00
auxvec.h
bcache.h
bitops.h [MIPS] TRACE_IRQFLAGS_SUPPORT support. 2006-07-13 21:26:09 +01:00
bootinfo.h [MIPS] Remove IT8172-based platforms, ITE 8172G and Globespan IVR support. 2006-10-03 17:59:17 +01:00
branch.h
break.h
bug.h
bugs.h
byteorder.h
cache.h
cachectl.h
cacheflush.h [MIPS] Remove __flush_icache_page 2006-10-01 23:16:58 +01:00
cacheops.h
checksum.h
compat.h [PATCH] N32 sigset and __COMPAT_ENDIAN_SWAP__ 2006-06-25 10:01:15 -07:00
compiler.h
cpu-features.h [MIPS] Use the proper technical term for naming some of the cache macros. 2006-07-13 21:26:04 +01:00
cpu-info.h
cpu.h [MIPS] Use the proper technical term for naming some of the cache macros. 2006-07-13 21:26:04 +01:00
cputime.h
current.h
debug.h
delay.h
div64.h
dma-mapping.h
dma.h
ds1286.h
ds1742.h
dsp.h
elf.h
emergency-restart.h
errno.h
fcntl.h [MIPS] Remove F_SETSIG and F_GETSIG in favor of the asm-generic definitions. 2006-09-27 13:37:48 +01:00
fixmap.h [MIPS] Fix FIXADDR_TOP for TX39/TX49. 2006-06-29 21:10:52 +01:00
floppy.h
fpregdef.h
fpu_emulator.h
fpu.h
futex.h
gdb-stub.h
gfx.h
gt64120.h
gt64240.h
hardirq.h
hazards.h [MIPS] s/__ASSEMBLER__/__ASSEMBLY__/ for clarity sake. 2006-09-27 13:37:57 +01:00
highmem.h
hw_irq.h [PATCH] genirq: add ->retrigger() irq op to consolidate hw_irq_resend() 2006-06-29 10:26:23 -07:00
i8259.h
ide.h
inst.h [MIPS] Fix rdhwr_op definition. 2006-07-13 21:26:08 +01:00
inventory.h
io.h
ioctl.h
ioctls.h
ipc.h
ipcbuf.h
irq_cpu.h
irq_regs.h IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
irq.h [MIPS] Cleanup leftovers of ARCH_HAS_IRQ_PER_CPU 2006-09-27 13:37:29 +01:00
irqflags.h [MIPS] lockdep: fix TRACE_IRQFLAGS_SUPPORT 2006-10-01 23:16:57 +01:00
isadep.h
jazz.h
jazzdma.h
Kbuild [MIPS] Have headers_install install <asm/cachectl.h> and <asm/sysmips.h>. 2006-09-27 13:37:56 +01:00
kmap_types.h
kspd.h
linkage.h
local.h
m48t35.h
m48t37.h
marvell.h
mc146818-time.h
mc146818rtc.h
mips_mt.h
mipsmtregs.h
mipsprom.h
mipsregs.h [MIPS] vr41xx: Replace magic number for P4K bit with symbol. 2006-07-13 21:26:11 +01:00
mman.h
mmu_context.h [MIPS] Reformat missformated SMTC bits. 2006-09-27 13:37:49 +01:00
mmu.h
mmzone.h
module.h
msc01_ic.h
msgbuf.h
mutex.h
namei.h
nile4.h
paccess.h
page.h [MIPS] Do not lose upper 32-bit on MIPS32 with 64-bit addresses in __pte(). 2006-09-27 13:37:39 +01:00
param.h
parport.h
pci.h
percpu.h
pgalloc.h
pgtable-32.h [PATCH] Standardize pxx_page macros 2006-09-26 08:48:51 -07:00
pgtable-64.h [MIPS] Fix USER_PTRS_PER_PGD for 64K page size. 2006-09-27 13:37:52 +01:00
pgtable-bits.h
pgtable.h [PATCH] Standardize pxx_page macros 2006-09-26 08:48:51 -07:00
pmon.h
poll.h
posix_types.h
prctl.h
prefetch.h
processor.h
ptrace.h [MIPS] Let gcc align 'struct pt_regs' on 8 bytes boundary 2006-10-03 17:59:17 +01:00
qemu.h
r4kcache.h
reboot.h
reg.h
regdef.h
resource.h
rm9k-ocd.h
rtc.h
rtlx.h
scatterlist.h
sections.h
segment.h
semaphore.h
sembuf.h
serial.h [MIPS] Remove IT8172-based platforms, ITE 8172G and Globespan IVR support. 2006-10-03 17:59:17 +01:00
setup.h
sgialib.h
sgiarcs.h
sgidefs.h
shmbuf.h
shmparam.h
sigcontext.h
siginfo.h
signal.h [MIPS] Move definition of IRIX compat constant into IRIX compat code. 2006-09-27 13:37:45 +01:00
sim.h
smp.h
smtc_ipi.h
smtc_proc.h
smtc.h
sni.h
socket.h [AF_UNIX]: Datagram getpeersec 2006-06-29 16:58:06 -07:00
sockios.h
sparsemem.h
spinlock_types.h
spinlock.h [PATCH] Directed yield: cpu_relax variants for spinlocks and rw-locks 2006-10-01 00:39:21 -07:00
stackframe.h [MIPS] Fix use of ehb instruction for non-R2 configurations. 2006-06-29 21:10:49 +01:00
stacktrace.h [MIPS] Make unwind_stack() can dig into interrupted context 2006-10-01 23:16:59 +01:00
stat.h
statfs.h
string.h
suspend.h
sysmips.h
system.h [PATCH] remove set_wmb - arch removal 2006-07-14 21:56:14 -07:00
termbits.h
termios.h
thread_info.h
time.h IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
timex.h [MIPS] Fix errors detected by "make headers_check" 2006-09-27 13:37:40 +01:00
titan_dep.h
tlb.h
tlbdebug.h
tlbflush.h
topology.h
traps.h
tx3912.h
types.h
uaccess.h
ucontext.h
unaligned.h
unistd.h [PATCH] remove remaining errno and __KERNEL_SYSCALLS__ references 2006-10-02 07:57:23 -07:00
user.h [MIPS] Fix errors detected by "make headers_check" 2006-09-27 13:37:40 +01:00
vga.h
vpe.h
war.h
watch.h
wbflush.h
xor.h
xxs1500.h