linux/arch/ia64/kernel
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
..
cpufreq Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
acpi-ext.c Pull acpi_os_free into release branch 2006-07-01 17:19:08 -04:00
acpi-processor.c fix file specification in comments 2006-10-03 23:01:26 +02:00
acpi.c [PATCH] cpu to node relationship fixup: acpi_map_cpu2node 2006-09-25 17:38:36 -07:00
asm-offsets.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
audit.c [PATCH] audit: AUDIT_PERM support 2006-09-11 13:32:30 -04:00
brl_emu.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
cyclone.c [IA64] don't report !sn2 or !summit hardware as an error 2006-03-07 15:26:49 -08:00
efi.c [IA64] sparse cleanups 2006-08-02 16:03:44 -07:00
efi_stub.S [IA64] make efi_stub.S fit in 80 cols 2006-06-21 14:35:28 -07:00
entry.h Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
entry.S fix file specification in comments 2006-10-03 23:01:26 +02:00
esi.c [IA64] esi-support 2006-06-21 11:19:22 -07:00
esi_stub.S [IA64] esi-support 2006-06-21 11:19:22 -07:00
fsys.S [IA64] cleanup in fsys.S 2006-02-28 08:53:32 -08:00
gate-data.S Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
gate.lds.S [PATCH] vDSO hash-style fix 2006-07-31 13:28:43 -07:00
gate.S Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
head.S [IA64] Save register stack contents on cpu start 2006-09-08 11:05:13 -07:00
ia64_ksyms.c Pull esi-support into release branch 2006-09-26 09:47:30 -07:00
init_task.c [PATCH] nsproxy: move init_nsproxy into kernel/nsproxy.c 2006-10-02 07:57:20 -07:00
iosapic.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
irq.c [PATCH] genirq: cleanup: remove irq_descp() 2006-06-29 10:26:22 -07:00
irq_ia64.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
irq_lsapic.c [PATCH] genirq: add ->retrigger() irq op to consolidate hw_irq_resend() 2006-06-29 10:26:23 -07:00
ivt.S Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
jprobes.S [IA64] prevent accidental modification of args in jprobe handler 2006-01-13 14:45:21 -08:00
kprobes.c [PATCH] kretprobe spinlock deadlock patch 2006-10-02 07:57:16 -07:00
machvec.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
Makefile [PATCH] msi: move the ia64 code into arch/ia64 2006-10-04 07:55:29 -07:00
mca.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
mca_asm.S [IA64] ar.fpsr not set on MCA/INIT kernel entry 2006-09-26 15:20:35 -07:00
mca_drv.c [IA64] printing support for MCA/INIT 2006-09-26 14:44:37 -07:00
mca_drv.h [IA64] printing support for MCA/INIT 2006-09-26 14:44:37 -07:00
mca_drv_asm.S Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
minstate.h Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
module.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
msi_ia64.c [PATCH] msi: move the ia64 code into arch/ia64 2006-10-04 07:55:29 -07:00
numa.c [PATCH] cpumask: export node_to_cpu_mask consistently 2006-10-02 07:57:17 -07:00
pal.S [IA64] Do not assume output registers be reservered. 2006-08-02 16:12:08 -07:00
palinfo.c Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6 2006-08-03 12:50:20 -07:00
patch.c [IA64] add init declaration - gate page functions 2006-03-22 16:54:38 -08:00
perfmon.c Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6 2006-09-27 10:53:30 -07:00
perfmon_default_smpl.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
perfmon_generic.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
perfmon_itanium.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
perfmon_mckinley.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
perfmon_montecito.h [IA64] Perfmon for Montecito 2006-01-16 10:31:44 -08:00
process.c [PATCH] remove remaining errno and __KERNEL_SYSCALLS__ references 2006-10-02 07:57:23 -07:00
ptrace.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
sal.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
salinfo.c [IA64] printing support for MCA/INIT 2006-09-26 14:44:37 -07:00
semaphore.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
setup.c [SERIAL] Remove wrong asm/serial.h inclusions 2006-10-01 17:09:16 +01:00
sigframe.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
signal.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
smp.c [IA64] wider use of for_each_cpu_mask() in arch/ia64 2005-10-25 15:10:08 -07:00
smpboot.c [IA64] Add interface so modules can discover whether multithreading is on. 2006-09-26 11:39:38 -07:00
sys_ia64.c [PATCH] IA64,sparc: local DoS with corrupted ELFs 2006-09-08 08:40:46 -07:00
time.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
topology.c [PATCH] fix "cpu to node relationship fixup: map cpu to node" 2006-09-27 08:26:08 -07:00
traps.c [PATCH] Change panic_on_oops message to "Fatal exception" 2006-08-14 12:54:29 -07:00
unaligned.c [IA64] sysctl option to silence unaligned trap warnings 2006-02-28 09:42:23 -08:00
uncached.c [PATCH] Define easier to handle GFP_THISNODE 2006-09-26 08:48:50 -07:00
unwind.c [IA64] MCA/INIT: remove obsolete unwind code 2005-09-11 14:09:34 -07:00
unwind_decoder.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
unwind_i.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
vmlinux.lds.S [IA64] minor reformatting to vmlinux.lds.S 2006-09-26 15:35:47 -07:00