linux/sound/oss
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
..
dmasound IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
emu10k1 IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
.gitignore kbuild: ignore all generated files for make allmodconfig (x86_64) 2006-02-26 20:15:58 +01:00
ac97_codec.c [PATCH] The scheduled removal of some OSS drivers 2006-10-04 07:55:32 -07:00
ac97.c [PATCH] The scheduled removal of some OSS drivers 2006-10-04 07:55:32 -07:00
ac97.h [PATCH] The scheduled removal of some OSS drivers 2006-10-04 07:55:32 -07:00
aci.c [PATCH] sem2mutex: sound/oss/ 2006-03-23 07:38:13 -08:00
aci.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ad1816.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
ad1848_mixer.h fix file specification in comments 2006-10-03 23:01:26 +02:00
ad1848.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
ad1848.h [PATCH] The scheduled removal of some OSS drivers 2006-10-04 07:55:32 -07:00
ad1889.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
ad1889.h [PARISC] OSS ad1889: Match register names with ALSA driver 2006-04-21 22:20:31 +00:00
adlib_card.c fix file specification in comments 2006-10-03 23:01:26 +02:00
aedsp16.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
au1550_ac97.c [PATCH] Alchemy: Delete unused pt_regs * argument from au1xxx_dbdma_chan_alloc 2006-09-26 08:48:54 -07:00
audio.c fix file specification in comments 2006-10-03 23:01:26 +02:00
bin2hex.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
btaudio.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
CHANGELOG Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
coproc.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
cs46xx_wrapper-24.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
cs46xx.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
cs46xxpm.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
cs461x_image.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
cs461x.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
cs4232.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
dev_table.c [PATCH] kill sound/oss/*_syms.c 2006-10-04 07:55:32 -07:00
dev_table.h [PATCH] kill sound/oss/*_syms.c 2006-10-04 07:55:32 -07:00
dmabuf.c [PATCH] kill sound/oss/*_syms.c 2006-10-04 07:55:32 -07:00
es1371.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
hal2.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
hal2.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
hex2hex.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
i810_audio.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
kahlua.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
Kconfig Merge git://git.kernel.org/pub/scm/linux/kernel/git/bunk/trivial 2006-10-03 16:35:11 -07:00
Makefile [PATCH] kill sound/oss/*_syms.c 2006-10-04 07:55:32 -07:00
midi_ctrl.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
midi_synth.c [PATCH] kill sound/oss/*_syms.c 2006-10-04 07:55:32 -07:00
midi_synth.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
midibuf.c [PATCH] kill sound/oss/*_syms.c 2006-10-04 07:55:32 -07:00
mpu401.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
mpu401.h IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
msnd_classic.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
msnd_classic.h Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
msnd_pinnacle.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
msnd_pinnacle.h Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
msnd.c [PATCH] msnd section fix 2006-06-25 10:01:04 -07:00
msnd.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
nec_vrc5477.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
nm256_audio.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
nm256_coeff.h [PATCH] sound/oss/: cleanups 2005-06-25 16:25:01 -07:00
nm256.h IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
opl3_hw.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
opl3.c fix file specification in comments 2006-10-03 23:01:26 +02:00
opl3.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
opl3sa2.c fix file specification in comments 2006-10-03 23:01:26 +02:00
os.h [PATCH] changing CONFIG_LOCALVERSION rebuilds too much, for no good reason 2005-11-09 07:55:57 -08:00
pas2_card.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
pas2_midi.c fix file specification in comments 2006-10-03 23:01:26 +02:00
pas2_mixer.c fix file specification in comments 2006-10-03 23:01:26 +02:00
pas2_pcm.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
pas2.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
pss.c fix file specification in comments 2006-10-03 23:01:26 +02:00
README.FIRST Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sb_audio.c fix file specification in comments 2006-10-03 23:01:26 +02:00
sb_card.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
sb_card.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sb_common.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
sb_ess.c spelling fixes 2006-06-26 18:35:02 +02:00
sb_ess.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sb_midi.c fix file specification in comments 2006-10-03 23:01:26 +02:00
sb_mixer.c fix file specification in comments 2006-10-03 23:01:26 +02:00
sb_mixer.h fix file specification in comments 2006-10-03 23:01:26 +02:00
sb.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sequencer.c [PATCH] kill sound/oss/*_syms.c 2006-10-04 07:55:32 -07:00
sh_dac_audio.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
sound_calls.h [PATCH] kill sound/oss/*_syms.c 2006-10-04 07:55:32 -07:00
sound_config.h Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
sound_firmware.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sound_timer.c [PATCH] kill sound/oss/*_syms.c 2006-10-04 07:55:32 -07:00
soundcard.c [PATCH] kill sound/oss/*_syms.c 2006-10-04 07:55:32 -07:00
soundvers.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sscape.c fix file specification in comments 2006-10-03 23:01:26 +02:00
swarm_cs4297a.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
sys_timer.c fix file specification in comments 2006-10-03 23:01:26 +02:00
trident.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
trident.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
trix.c fix file specification in comments 2006-10-03 23:01:26 +02:00
tuning.h [PATCH] The scheduled removal of some OSS drivers 2006-10-04 07:55:32 -07:00
uart401.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
uart6850.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
ulaw.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
v_midi.c fix file specification in comments 2006-10-03 23:01:26 +02:00
v_midi.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
via82cxxx_audio.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
vidc_fill.S Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
vidc.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
vidc.h IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
vwsnd.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
waveartist.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
waveartist.h fix file specification in comments 2006-10-03 23:01:26 +02:00

The modular sound driver patches were funded by Red Hat Software 
(www.redhat.com). The sound driver here is thus a modified version of 
Hannu's code. Please bear that in mind when considering the appropriate
forums for bug reporting. 

Alan Cox