linux/include/asm-ia64
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
..
sn [IA64] remove redundant local_irq_save() calls from sn_sal.h 2006-08-29 10:17:21 -07:00
Kbuild [HEADERS] One line per header in Kbuild files to reduce conflicts 2006-09-19 12:43:58 +01:00
a.out.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
acpi-ext.h [IA64] update HP CSR space discovery via ACPI 2006-04-06 14:42:38 -07:00
acpi.h [IA64] - Fix MAX_PXM_DOMAINS for systems with > 256 nodes 2006-04-20 10:16:11 -07:00
agp.h [PATCH] AGP fix for Xen VMM 2005-06-07 12:35:43 -07:00
asmmacro.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
atomic.h [PATCH] atomic: add_unless cmpxchg optimise 2006-03-23 07:38:17 -08:00
auxvec.h [PATCH] auxiliary vector cleanups 2005-09-07 16:57:21 -07:00
bitops.h [IA64] remove asm-ia64/bitops.h self-inclusion 2006-05-05 11:37:15 -07:00
break.h [PATCH] Kprobes/IA64: kdebug die notification mechanism 2005-06-23 09:45:22 -07:00
bug.h [PATCH] remove gcc-2 checks 2006-01-08 20:14:02 -08:00
bugs.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
byteorder.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
cache.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
cacheflush.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
checksum.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
compat.h [PATCH] ia64: add ptr_to_compat() 2006-03-27 08:44:48 -08:00
cpu.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
cputime.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
current.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
cyclone.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
delay.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
div64.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
dma-mapping.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
dma.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
dmi.h [PATCH] ia64: use i386 dmi_scan.c 2006-03-26 08:56:54 -08:00
elf.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
emergency-restart.h [PATCH] Add emergency_restart() 2005-07-26 14:35:41 -07:00
errno.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
esi.h [IA64] esi-support 2006-06-21 11:19:22 -07:00
fcntl.h [PATCH] Clean up struct flock definitions 2005-09-07 16:57:38 -07:00
fpswa.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
fpu.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
futex.h [IA64] Implement futex primitives 2006-09-26 14:00:56 -07:00
gcc_intrin.h [IA64] fix fls() 2005-04-21 11:07:59 -07:00
hardirq.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
hw_irq.h [PATCH] genirq: add ->retrigger() irq op to consolidate hw_irq_resend() 2006-06-29 10:26:23 -07:00
ia32.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
ia64regs.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ide.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
intel_intrin.h [IA64] use icc defined constant 2006-02-07 08:49:27 -08:00
intrinsics.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
io.h [PATCH] make valid_mmap_phys_addr_range() take a pfn 2006-07-10 13:24:25 -07:00
ioctl.h [PATCH] Generic ioctl.h 2006-01-10 08:01:34 -08:00
ioctls.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
iosapic.h [IA64] Minor cleanups - remove unnecessary function prototype in iosapic.h 2005-09-07 14:00:40 -07:00
ipcbuf.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
irq.h [PATCH] genirq ia64 cleanup 2006-07-03 15:26:58 -07:00
irq_regs.h IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
kdebug.h [PATCH] Notify page fault call chain for ia64 2006-06-26 09:58:22 -07:00
kmap_types.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
kprobes.h [IA64] kprobe opcode 16 bytes alignment on IA64 2006-09-26 11:20:37 -07:00
kregs.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
linkage.h [PATCH] abstract type/size specification for assembly 2006-03-24 07:33:25 -08:00
local.h [IA64] Fix missing parameter for local_add/sub 2005-12-07 11:30:11 -08:00
machvec.h IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
machvec_dig.h [IA64] cleanup dig_irq_init 2006-03-24 13:12:46 -08:00
machvec_hpsim.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
machvec_hpzx1.h [IA64] more robust zx1/sx1000 machvec support 2005-09-14 16:22:11 -07:00
machvec_hpzx1_swiotlb.h [IA64] more robust zx1/sx1000 machvec support 2005-09-14 16:22:11 -07:00
machvec_init.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
machvec_sn2.h [PATCH] msi: refactor and move the msi irq_chip into the arch code 2006-10-04 07:55:29 -07:00
mc146818rtc.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
mca.h [IA64] Sanitize assembler code for ia64_sal_os_state 2006-06-21 14:44:26 -07:00
mca_asm.h [IA64] Make gp value point to Region 5 in mca handler 2006-09-26 14:13:03 -07:00
meminit.h [PATCH] Have ia64 use add_active_range() and free_area_init_nodes 2006-09-27 08:26:11 -07:00
mman.h [PATCH] IA64,sparc: local DoS with corrupted ELFs 2006-09-08 08:40:46 -07:00
mmu.h [IA64] Fix race in mm-context wrap-around logic. 2005-08-12 15:05:21 -07:00
mmu_context.h [IA64] make mmu_context.h and tlb.c 80-column friendly 2005-11-03 14:43:50 -08:00
mmzone.h [PATCH] V5 ia64 SPARSEMEM - conditional changes for SPARSEMEM 2005-10-04 13:21:13 -07:00
module.h [PATCH] Move compiler check for modules to ia64 only 2006-09-26 10:52:37 +02:00
msgbuf.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
mutex.h [IA64] fix bug in ia64 __mutex_fastpath_trylock 2006-04-07 22:39:49 -07:00
namei.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
nodedata.h [PATCH] pgdat allocation and update for ia64 of memory hotplug: update pgdat address array 2006-06-27 17:32:37 -07:00
numa.h [PATCH] fix "cpu to node relationship fixup: map cpu to node" 2006-09-27 08:26:08 -07:00
page.h [PATCH] Fix 'make headers_check' on ia64 2006-09-16 12:54:32 -07:00
pal.h [IA64] PAL calls need physical mode, stacked 2006-09-26 15:21:11 -07:00
param.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
parport.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
patch.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
pci.h [PATCH] Make sparc64 use setup-res.c 2005-09-08 14:57:25 -07:00
percpu.h [PATCH] lockdep: add per_cpu_offset() 2006-07-03 15:27:00 -07:00
perfmon.h [IA64] alternate perfmon handler 2005-05-18 16:14:30 -07:00
perfmon_default_smpl.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
pgalloc.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
pgtable.h [PATCH] Standardize pxx_page macros 2006-09-26 08:48:51 -07:00
poll.h [PATCH] POLLRDHUP/EPOLLRDHUP handling for half-closed devices notifications 2006-03-25 08:22:56 -08:00
posix_types.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
processor.h [IA64] Move perfmon tables from thread_struct to pfm_context 2006-09-26 12:03:13 -07:00
ptrace.h [PATCH] Add regs_return_value() helper 2006-10-02 07:57:16 -07:00
ptrace_offsets.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
resource.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
rse.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
rwsem.h [PATCH] lockdep: remove RWSEM_DEBUG remnants 2006-07-03 15:27:01 -07:00
sal.h [IA64] avoid broken SAL_CACHE_FLUSH implementations 2006-02-02 13:25:54 -08:00
scatterlist.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sections.h [PATCH] kprobes/ia64: refuse kprobe on ivt code 2005-06-27 15:23:54 -07:00
segment.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
semaphore.h [IA64] Fix bug in ia64 specific down() function 2006-01-17 14:04:00 -08:00
sembuf.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
serial.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
setup.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
shmbuf.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
shmparam.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sigcontext.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
siginfo.h [PATCH] consolidate SIGEV_PAD_SIZE 2005-05-01 08:59:08 -07:00
signal.h [PATCH] irq-flags: IA64: Use the new IRQF_ constants 2006-07-02 13:58:47 -07:00
smp.h 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
socket.h [AF_UNIX]: Datagram getpeersec 2006-06-29 16:58:06 -07:00
sockios.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sparsemem.h [PATCH] V5 ia64 SPARSEMEM - conditional changes for SPARSEMEM 2005-10-04 13:21:13 -07:00
spinlock.h [PATCH] Directed yield: cpu_relax variants for spinlocks and rw-locks 2006-10-01 00:39:21 -07:00
spinlock_types.h [PATCH] spinlock consolidation 2005-09-10 10:06:21 -07:00
stat.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
statfs.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
string.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
suspend.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
system.h [IA64] sparse cleanups 2006-08-02 16:03:44 -07:00
termbits.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
termios.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
thread_info.h [PATCH] sched: cleanup, remove task_t, convert to struct task_struct 2006-07-03 15:27:11 -07:00
timex.h [IA64] ia64: simplify and fix udelay() 2006-02-15 13:37:04 -08:00
tlb.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
tlbflush.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
topology.h [PATCH] sched: introduce child field in sched_domain 2006-10-03 08:04:06 -07:00
types.h [PATCH] sab: consolidate kmem_bufctl_t 2005-09-05 00:05:48 -07:00
uaccess.h [PATCH] ia64 basic __user annotations 2005-09-29 08:46:27 -07:00
ucontext.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
unaligned.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
uncached.h [PATCH] ia64 uncached alloc 2005-06-21 18:46:18 -07:00
unistd.h [PATCH] rename the provided execve functions to kernel_execve 2006-10-02 07:57:23 -07:00
unwind.h [IA64] MCA/INIT: remove obsolete unwind code 2005-09-11 14:09:34 -07:00
user.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ustack.h [PATCH] Fix 'make headers_check' on ia64 2006-09-16 12:54:32 -07:00
vga.h [PATCH] vgacon: make VGA_MAP_MEM take size, remove extra use 2006-06-22 15:05:58 -07:00
xor.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00