diff options
author | David Howells <dhowells@redhat.com> | 2006-10-05 14:55:46 +0100 |
---|---|---|
committer | David Howells <dhowells@warthog.cambridge.redhat.com> | 2006-10-05 15:10:12 +0100 |
commit | 7d12e780e003f93433d49ce78cfedf4b4c52adc5 (patch) | |
tree | 6748550400445c11a306b132009f3001e3525df8 /drivers/parport | |
parent | da482792a6d1a3fbaaa25fae867b343fb4db3246 (diff) | |
download | linux-7d12e780e003f93433d49ce78cfedf4b4c52adc5.tar.gz linux-7d12e780e003f93433d49ce78cfedf4b4c52adc5.tar.bz2 linux-7d12e780e003f93433d49ce78cfedf4b4c52adc5.zip |
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)
Diffstat (limited to 'drivers/parport')
-rw-r--r-- | drivers/parport/daisy.c | 2 | ||||
-rw-r--r-- | drivers/parport/ieee1284.c | 2 | ||||
-rw-r--r-- | drivers/parport/parport_amiga.c | 4 | ||||
-rw-r--r-- | drivers/parport/parport_atari.c | 4 | ||||
-rw-r--r-- | drivers/parport/parport_ax88796.c | 4 | ||||
-rw-r--r-- | drivers/parport/parport_gsc.c | 4 | ||||
-rw-r--r-- | drivers/parport/parport_ip32.c | 11 | ||||
-rw-r--r-- | drivers/parport/parport_mfc3.c | 2 | ||||
-rw-r--r-- | drivers/parport/parport_pc.c | 4 | ||||
-rw-r--r-- | drivers/parport/parport_sunbpp.c | 2 | ||||
-rw-r--r-- | drivers/parport/share.c | 2 |
11 files changed, 18 insertions, 23 deletions
diff --git a/drivers/parport/daisy.c b/drivers/parport/daisy.c index 83ee095ec6e2..ff9f34453530 100644 --- a/drivers/parport/daisy.c +++ b/drivers/parport/daisy.c @@ -216,7 +216,7 @@ void parport_daisy_fini(struct parport *port) struct pardevice *parport_open(int devnum, const char *name, int (*pf) (void *), void (*kf) (void *), - void (*irqf) (int, void *, struct pt_regs *), + void (*irqf) (int, void *), int flags, void *handle) { struct daisydev *p = topology; diff --git a/drivers/parport/ieee1284.c b/drivers/parport/ieee1284.c index 7ff09f0f858f..5accaa7bde31 100644 --- a/drivers/parport/ieee1284.c +++ b/drivers/parport/ieee1284.c @@ -571,7 +571,7 @@ static int parport_ieee1284_ack_data_avail (struct parport *port) #endif /* IEEE1284 support */ /* Handle an interrupt. */ -void parport_ieee1284_interrupt (int which, void *handle, struct pt_regs *regs) +void parport_ieee1284_interrupt (int which, void *handle) { struct parport *port = handle; parport_ieee1284_wakeup (port); diff --git a/drivers/parport/parport_amiga.c b/drivers/parport/parport_amiga.c index 5126e74ac2ec..a0afaee5ebe5 100644 --- a/drivers/parport/parport_amiga.c +++ b/drivers/parport/parport_amiga.c @@ -138,9 +138,9 @@ static unsigned char amiga_read_status(struct parport *p) } /* as this ports irq handling is already done, we use a generic funktion */ -static irqreturn_t amiga_interrupt(int irq, void *dev_id, struct pt_regs *regs) +static irqreturn_t amiga_interrupt(int irq, void *dev_id) { - parport_generic_irq(irq, (struct parport *) dev_id, regs); + parport_generic_irq(irq, (struct parport *) dev_id); return IRQ_HANDLED; } diff --git a/drivers/parport/parport_atari.c b/drivers/parport/parport_atari.c index 78c3f34108bc..6ea9929b8c7f 100644 --- a/drivers/parport/parport_atari.c +++ b/drivers/parport/parport_atari.c @@ -104,9 +104,9 @@ parport_atari_restore_state(struct parport *p, struct parport_state *s) } static irqreturn_t -parport_atari_interrupt(int irq, void *dev_id, struct pt_regs *regs) +parport_atari_interrupt(int irq, void *dev_id) { - parport_generic_irq(irq, (struct parport *) dev_id, regs); + parport_generic_irq(irq, (struct parport *) dev_id); return IRQ_HANDLED; } diff --git a/drivers/parport/parport_ax88796.c b/drivers/parport/parport_ax88796.c index 1850632590fd..74f4e9742c6c 100644 --- a/drivers/parport/parport_ax88796.c +++ b/drivers/parport/parport_ax88796.c @@ -233,9 +233,9 @@ parport_ax88796_restore_state(struct parport *p, struct parport_state *s) } static irqreturn_t -parport_ax88796_interrupt(int irq, void *dev_id, struct pt_regs *regs) +parport_ax88796_interrupt(int irq, void *dev_id) { - parport_generic_irq(irq, dev_id, regs); + parport_generic_irq(irq, dev_id); return IRQ_HANDLED; } diff --git a/drivers/parport/parport_gsc.c b/drivers/parport/parport_gsc.c index 7352104f7b30..a7c5ead9a3d3 100644 --- a/drivers/parport/parport_gsc.c +++ b/drivers/parport/parport_gsc.c @@ -81,9 +81,9 @@ static int clear_epp_timeout(struct parport *pb) * of these are in parport_gsc.h. */ -static irqreturn_t parport_gsc_interrupt(int irq, void *dev_id, struct pt_regs *regs) +static irqreturn_t parport_gsc_interrupt(int irq, void *dev_id) { - parport_generic_irq(irq, (struct parport *) dev_id, regs); + parport_generic_irq(irq, (struct parport *) dev_id); return IRQ_HANDLED; } diff --git a/drivers/parport/parport_ip32.c b/drivers/parport/parport_ip32.c index 46e06e596d73..e3e19277030a 100644 --- a/drivers/parport/parport_ip32.c +++ b/drivers/parport/parport_ip32.c @@ -548,10 +548,8 @@ static void parport_ip32_dma_setup_context(unsigned int limit) * parport_ip32_dma_interrupt - DMA interrupt handler * @irq: interrupt number * @dev_id: unused - * @regs: pointer to &struct pt_regs */ -static irqreturn_t parport_ip32_dma_interrupt(int irq, void *dev_id, - struct pt_regs *regs) +static irqreturn_t parport_ip32_dma_interrupt(int irq, void *dev_id) { if (parport_ip32_dma.left) pr_trace(NULL, "(%d): ctx=%d", irq, parport_ip32_dma.ctx); @@ -560,8 +558,7 @@ static irqreturn_t parport_ip32_dma_interrupt(int irq, void *dev_id, } #if DEBUG_PARPORT_IP32 -static irqreturn_t parport_ip32_merr_interrupt(int irq, void *dev_id, - struct pt_regs *regs) +static irqreturn_t parport_ip32_merr_interrupt(int irq, void *dev_id) { pr_trace1(NULL, "(%d)", irq); return IRQ_HANDLED; @@ -772,13 +769,11 @@ static inline void parport_ip32_wakeup(struct parport *p) * parport_ip32_interrupt - interrupt handler * @irq: interrupt number * @dev_id: pointer to &struct parport - * @regs: pointer to &struct pt_regs * * Caught interrupts are forwarded to the upper parport layer if IRQ_mode is * %PARPORT_IP32_IRQ_FWD. */ -static irqreturn_t parport_ip32_interrupt(int irq, void *dev_id, - struct pt_regs *regs) +static irqreturn_t parport_ip32_interrupt(int irq, void *dev_id) { struct parport * const p = dev_id; struct parport_ip32_private * const priv = p->physport->private_data; diff --git a/drivers/parport/parport_mfc3.c b/drivers/parport/parport_mfc3.c index b2b8092a2b39..6541cde4df00 100644 --- a/drivers/parport/parport_mfc3.c +++ b/drivers/parport/parport_mfc3.c @@ -211,7 +211,7 @@ static void mfc3_change_mode( struct parport *p, int m) static int use_cnt = 0; -static irqreturn_t mfc3_interrupt(int irq, void *dev_id, struct pt_regs *regs) +static irqreturn_t mfc3_interrupt(int irq, void *dev_id) { int i; diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c index fe800dc0be9f..39c96641bc72 100644 --- a/drivers/parport/parport_pc.c +++ b/drivers/parport/parport_pc.c @@ -270,9 +270,9 @@ static int clear_epp_timeout(struct parport *pb) * of these are in parport_pc.h. */ -static irqreturn_t parport_pc_interrupt(int irq, void *dev_id, struct pt_regs *regs) +static irqreturn_t parport_pc_interrupt(int irq, void *dev_id) { - parport_generic_irq(irq, (struct parport *) dev_id, regs); + parport_generic_irq(irq, (struct parport *) dev_id); /* FIXME! Was it really ours? */ return IRQ_HANDLED; } diff --git a/drivers/parport/parport_sunbpp.c b/drivers/parport/parport_sunbpp.c index fac333b279bf..d758c90c86af 100644 --- a/drivers/parport/parport_sunbpp.c +++ b/drivers/parport/parport_sunbpp.c @@ -46,7 +46,7 @@ #define dprintk(x) #endif -static irqreturn_t parport_sunbpp_interrupt(int irq, void *dev_id, struct pt_regs *regs) +static irqreturn_t parport_sunbpp_interrupt(int irq, void *dev_id) { parport_generic_irq(irq, (struct parport *) dev_id, regs); return IRQ_HANDLED; diff --git a/drivers/parport/share.c b/drivers/parport/share.c index 94dc506b83d1..fd9129e424f9 100644 --- a/drivers/parport/share.c +++ b/drivers/parport/share.c @@ -519,7 +519,7 @@ void parport_remove_port(struct parport *port) struct pardevice * parport_register_device(struct parport *port, const char *name, int (*pf)(void *), void (*kf)(void *), - void (*irq_func)(int, void *, struct pt_regs *), + void (*irq_func)(int, void *), int flags, void *handle) { struct pardevice *tmp; |