dect
/
linux-2.6
Archived
13
0
Fork 0
This repository has been archived on 2022-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
linux-2.6/drivers/char
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
..
agp [PARISC] Add support for Quicksilver AGPGART 2006-10-04 06:50:16 -06:00
drm IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
ftape IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
hw_random Remove all inclusions of <linux/config.h> 2006-10-04 03:38:54 -04:00
ip2 IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
ipmi IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
mwave IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
pcmcia IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
rio IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
tpm IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
watchdog IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
.gitignore [MIPS] Remove IT8172-based platforms, ITE 8172G and Globespan IVR support. 2006-10-03 17:59:17 +01:00
ChangeLog
Kconfig [MIPS] Remove IT8172-based platforms, ITE 8172G and Globespan IVR support. 2006-10-03 17:59:17 +01:00
Makefile [MIPS] Remove IT8172-based platforms, ITE 8172G and Globespan IVR support. 2006-10-03 17:59:17 +01:00
amiserial.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
applicom.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
applicom.h
briq_panel.c Remove all inclusions of <linux/config.h> 2006-10-04 03:38:54 -04:00
cd1865.h
consolemap.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
cp437.uni
cs5535_gpio.c [PATCH] make more file_operation structs static 2006-07-03 15:26:59 -07:00
cyclades.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
decserial.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
defkeymap.c_shipped
defkeymap.map
digi.h
digi1.h
digiFep1.h
digiPCI.h
ds1286.c [PATCH] proper flags type of spin_lock_irqsave() 2006-10-01 00:39:21 -07:00
ds1302.c [PATCH] make more file_operation structs static 2006-07-03 15:26:59 -07:00
ds1620.c [PATCH] make more file_operation structs static 2006-07-03 15:26:59 -07:00
dsp56k.c [PATCH] make more file_operation structs static 2006-07-03 15:26:59 -07:00
dtlk.c [PATCH] make more file_operation structs static 2006-07-03 15:26:59 -07:00
ec3104_keyb.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
efirtc.c [PATCH] make more file_operation structs static 2006-07-03 15:26:59 -07:00
epca.c [PATCH] char: kill unneeded memsets 2006-10-04 07:55:13 -07:00
epca.h [PATCH] char: kill unneeded memsets 2006-10-04 07:55:13 -07:00
epcaconfig.h
esp.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
generic_nvram.c [PATCH] powerpc: Kill _machine and hard-coded platform numbers 2006-03-28 23:15:54 +11:00
generic_serial.c [PATCH] char: kill unneeded memsets 2006-10-04 07:55:13 -07:00
genrtc.c [PATCH] make more file_operation structs static 2006-07-03 15:26:59 -07:00
hangcheck-timer.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
hpet.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
hvc_console.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
hvc_console.h [POWERPC] Make the hvc_console output buffer size settable 2006-07-13 18:53:32 +10:00
hvc_iseries.c Merge branch 'master' of git://oak/home/sfr/kernels/iseries/work 2006-10-04 15:02:27 +10:00
hvc_rtas.c [POWERPC] Make the hvc_console output buffer size settable 2006-07-13 18:53:32 +10:00
hvc_vio.c [POWERPC] The two vio HVC backends clash 2006-09-25 13:30:51 +10:00
hvcs.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
hvsi.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
i8k.c [PATCH] make more file_operation structs static 2006-07-03 15:26:59 -07:00
ip27-rtc.c [PATCH] make more file_operation structs static 2006-07-03 15:26:59 -07:00
isicom.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
istallion.c [PATCH] const struct tty_operations 2006-10-02 07:57:14 -07:00
keyboard.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
lcd.c [PATCH] make more file_operation structs static 2006-07-03 15:26:59 -07:00
lcd.h
lp.c [PATCH] There is no devfs, there has never been a devfs, we have always been at war with... 2006-09-29 09:18:10 -07:00
mbcs.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
mbcs.h
mem.c [PATCH] mem driver: fix conditional on isa i/o support 2006-09-29 09:18:22 -07:00
misc.c [PATCH] make more file_operation structs static 2006-07-03 15:26:59 -07:00
mmtimer.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
moxa.c [PATCH] const struct tty_operations 2006-10-02 07:57:14 -07:00
mspec.c Remove all inclusions of <linux/config.h> 2006-10-04 03:38:54 -04:00
mxser.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
mxser.h [PATCH] Typo fixes 2006-03-28 09:16:08 -08:00
n_hdlc.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
n_r3964.c [PATCH] R3964: fix GFP_KERNEL allocations in timer function 2006-06-25 10:01:17 -07:00
n_tty.c [PATCH] remove TTY_DONT_FLIP 2006-06-28 14:59:05 -07:00
nsc_gpio.c Remove all inclusions of <linux/config.h> 2006-10-04 03:38:54 -04:00
nvram.c [PATCH] make more file_operation structs static 2006-07-03 15:26:59 -07:00
nwbutton.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
nwbutton.h IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
nwflash.c [PATCH] make more file_operation structs static 2006-07-03 15:26:59 -07:00
pc8736x_gpio.c [PATCH] drivers/char/pc8736x_gpio.c: remove unused static functions 2006-09-29 09:18:05 -07:00
ppdev.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
pty.c [PATCH] const struct tty_operations 2006-10-02 07:57:14 -07:00
qtronix.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
random.c [PATCH] namespaces: utsname: switch to using uts namespaces 2006-10-02 07:57:21 -07:00
raw.c [PATCH] Streamline generic_file_* interfaces and filemap cleanups 2006-10-01 00:39:28 -07:00
riscom8.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
riscom8.h
riscom8_reg.h
rocket.c [PATCH] const struct tty_operations 2006-10-02 07:57:14 -07:00
rocket.h
rocket_int.h
rtc.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
scan_keyb.c
scan_keyb.h
scc.h [PATCH] m68k: static vs. extern in scc.h 2006-01-12 09:09:00 -08:00
scx200_gpio.c [PATCH] scx200_gpio export cleanups 2006-09-29 09:18:06 -07:00
selection.c [PATCH] tty locking on resize 2006-09-29 09:18:12 -07:00
ser_a2232.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
ser_a2232.h
ser_a2232fw.ax
ser_a2232fw.h
serial167.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
snsc.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
snsc.h [IA64-SGI] Handle SC env. powerdown events 2006-01-26 13:32:26 -08:00
snsc_event.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
sonypi.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
specialix.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
specialix_io8.h
stallion.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
sx.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
sx.h
sxboards.h
sxwindow.h
synclink.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
synclink_gt.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
synclinkmp.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
sysrq.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
tb0219.c [PATCH] make more file_operation structs static 2006-07-03 15:26:59 -07:00
tipar.c [PATCH] pr_debug: tipar: repair nonexistant pr_debug argument use 2006-10-03 08:04:19 -07:00
tlclk.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
toshiba.c [PATCH] make more file_operation structs static 2006-07-03 15:26:59 -07:00
tty_io.c [PATCH] const struct tty_operations 2006-10-02 07:57:14 -07:00
tty_ioctl.c [PATCH] Fix locking for tty drivers when doing urgent characters 2006-09-29 09:18:24 -07:00
vc_screen.c [PATCH] There is no devfs, there has never been a devfs, we have always been at war with... 2006-09-29 09:18:10 -07:00
viocons.c [PATCH] const struct tty_operations 2006-10-02 07:57:14 -07:00
viotape.c [POWERPC] iseries: Small viotape cleanup allowed by devfs removal 2006-07-13 18:56:00 +10:00
vme_scc.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
vr41xx_giu.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
vt.c [PATCH] vt: proper prototypes for some console functions 2006-10-03 08:04:12 -07:00
vt_ioctl.c [PATCH] vt: Make vt_pid a struct pid (making it pid wrap around safe). 2006-10-02 07:57:14 -07:00