aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/parport
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2006-10-05 09:55:46 -0400
committerDavid Howells <dhowells@warthog.cambridge.redhat.com>2006-10-05 10:10:12 -0400
commit7d12e780e003f93433d49ce78cfedf4b4c52adc5 (patch)
tree6748550400445c11a306b132009f3001e3525df8 /drivers/parport
parentda482792a6d1a3fbaaa25fae867b343fb4db3246 (diff)
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.c2
-rw-r--r--drivers/parport/ieee1284.c2
-rw-r--r--drivers/parport/parport_amiga.c4
-rw-r--r--drivers/parport/parport_atari.c4
-rw-r--r--drivers/parport/parport_ax88796.c4
-rw-r--r--drivers/parport/parport_gsc.c4
-rw-r--r--drivers/parport/parport_ip32.c11
-rw-r--r--drivers/parport/parport_mfc3.c2
-rw-r--r--drivers/parport/parport_pc.c4
-rw-r--r--drivers/parport/parport_sunbpp.c2
-rw-r--r--drivers/parport/share.c2
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)
216 216
217struct pardevice *parport_open(int devnum, const char *name, 217struct pardevice *parport_open(int devnum, const char *name,
218 int (*pf) (void *), void (*kf) (void *), 218 int (*pf) (void *), void (*kf) (void *),
219 void (*irqf) (int, void *, struct pt_regs *), 219 void (*irqf) (int, void *),
220 int flags, void *handle) 220 int flags, void *handle)
221{ 221{
222 struct daisydev *p = topology; 222 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)
571#endif /* IEEE1284 support */ 571#endif /* IEEE1284 support */
572 572
573/* Handle an interrupt. */ 573/* Handle an interrupt. */
574void parport_ieee1284_interrupt (int which, void *handle, struct pt_regs *regs) 574void parport_ieee1284_interrupt (int which, void *handle)
575{ 575{
576 struct parport *port = handle; 576 struct parport *port = handle;
577 parport_ieee1284_wakeup (port); 577 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)
138} 138}
139 139
140/* as this ports irq handling is already done, we use a generic funktion */ 140/* as this ports irq handling is already done, we use a generic funktion */
141static irqreturn_t amiga_interrupt(int irq, void *dev_id, struct pt_regs *regs) 141static irqreturn_t amiga_interrupt(int irq, void *dev_id)
142{ 142{
143 parport_generic_irq(irq, (struct parport *) dev_id, regs); 143 parport_generic_irq(irq, (struct parport *) dev_id);
144 return IRQ_HANDLED; 144 return IRQ_HANDLED;
145} 145}
146 146
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)
104} 104}
105 105
106static irqreturn_t 106static irqreturn_t
107parport_atari_interrupt(int irq, void *dev_id, struct pt_regs *regs) 107parport_atari_interrupt(int irq, void *dev_id)
108{ 108{
109 parport_generic_irq(irq, (struct parport *) dev_id, regs); 109 parport_generic_irq(irq, (struct parport *) dev_id);
110 return IRQ_HANDLED; 110 return IRQ_HANDLED;
111} 111}
112 112
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)
233} 233}
234 234
235static irqreturn_t 235static irqreturn_t
236parport_ax88796_interrupt(int irq, void *dev_id, struct pt_regs *regs) 236parport_ax88796_interrupt(int irq, void *dev_id)
237{ 237{
238 parport_generic_irq(irq, dev_id, regs); 238 parport_generic_irq(irq, dev_id);
239 return IRQ_HANDLED; 239 return IRQ_HANDLED;
240} 240}
241 241
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)
81 * of these are in parport_gsc.h. 81 * of these are in parport_gsc.h.
82 */ 82 */
83 83
84static irqreturn_t parport_gsc_interrupt(int irq, void *dev_id, struct pt_regs *regs) 84static irqreturn_t parport_gsc_interrupt(int irq, void *dev_id)
85{ 85{
86 parport_generic_irq(irq, (struct parport *) dev_id, regs); 86 parport_generic_irq(irq, (struct parport *) dev_id);
87 return IRQ_HANDLED; 87 return IRQ_HANDLED;
88} 88}
89 89
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)
548 * parport_ip32_dma_interrupt - DMA interrupt handler 548 * parport_ip32_dma_interrupt - DMA interrupt handler
549 * @irq: interrupt number 549 * @irq: interrupt number
550 * @dev_id: unused 550 * @dev_id: unused
551 * @regs: pointer to &struct pt_regs
552 */ 551 */
553static irqreturn_t parport_ip32_dma_interrupt(int irq, void *dev_id, 552static irqreturn_t parport_ip32_dma_interrupt(int irq, void *dev_id)
554 struct pt_regs *regs)
555{ 553{
556 if (parport_ip32_dma.left) 554 if (parport_ip32_dma.left)
557 pr_trace(NULL, "(%d): ctx=%d", irq, parport_ip32_dma.ctx); 555 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,
560} 558}
561 559
562#if DEBUG_PARPORT_IP32 560#if DEBUG_PARPORT_IP32
563static irqreturn_t parport_ip32_merr_interrupt(int irq, void *dev_id, 561static irqreturn_t parport_ip32_merr_interrupt(int irq, void *dev_id)
564 struct pt_regs *regs)
565{ 562{
566 pr_trace1(NULL, "(%d)", irq); 563 pr_trace1(NULL, "(%d)", irq);
567 return IRQ_HANDLED; 564 return IRQ_HANDLED;
@@ -772,13 +769,11 @@ static inline void parport_ip32_wakeup(struct parport *p)
772 * parport_ip32_interrupt - interrupt handler 769 * parport_ip32_interrupt - interrupt handler
773 * @irq: interrupt number 770 * @irq: interrupt number
774 * @dev_id: pointer to &struct parport 771 * @dev_id: pointer to &struct parport
775 * @regs: pointer to &struct pt_regs
776 * 772 *
777 * Caught interrupts are forwarded to the upper parport layer if IRQ_mode is 773 * Caught interrupts are forwarded to the upper parport layer if IRQ_mode is
778 * %PARPORT_IP32_IRQ_FWD. 774 * %PARPORT_IP32_IRQ_FWD.
779 */ 775 */
780static irqreturn_t parport_ip32_interrupt(int irq, void *dev_id, 776static irqreturn_t parport_ip32_interrupt(int irq, void *dev_id)
781 struct pt_regs *regs)
782{ 777{
783 struct parport * const p = dev_id; 778 struct parport * const p = dev_id;
784 struct parport_ip32_private * const priv = p->physport->private_data; 779 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)
211 211
212static int use_cnt = 0; 212static int use_cnt = 0;
213 213
214static irqreturn_t mfc3_interrupt(int irq, void *dev_id, struct pt_regs *regs) 214static irqreturn_t mfc3_interrupt(int irq, void *dev_id)
215{ 215{
216 int i; 216 int i;
217 217
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)
270 * of these are in parport_pc.h. 270 * of these are in parport_pc.h.
271 */ 271 */
272 272
273static irqreturn_t parport_pc_interrupt(int irq, void *dev_id, struct pt_regs *regs) 273static irqreturn_t parport_pc_interrupt(int irq, void *dev_id)
274{ 274{
275 parport_generic_irq(irq, (struct parport *) dev_id, regs); 275 parport_generic_irq(irq, (struct parport *) dev_id);
276 /* FIXME! Was it really ours? */ 276 /* FIXME! Was it really ours? */
277 return IRQ_HANDLED; 277 return IRQ_HANDLED;
278} 278}
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 @@
46#define dprintk(x) 46#define dprintk(x)
47#endif 47#endif
48 48
49static irqreturn_t parport_sunbpp_interrupt(int irq, void *dev_id, struct pt_regs *regs) 49static irqreturn_t parport_sunbpp_interrupt(int irq, void *dev_id)
50{ 50{
51 parport_generic_irq(irq, (struct parport *) dev_id, regs); 51 parport_generic_irq(irq, (struct parport *) dev_id, regs);
52 return IRQ_HANDLED; 52 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)
519struct pardevice * 519struct pardevice *
520parport_register_device(struct parport *port, const char *name, 520parport_register_device(struct parport *port, const char *name,
521 int (*pf)(void *), void (*kf)(void *), 521 int (*pf)(void *), void (*kf)(void *),
522 void (*irq_func)(int, void *, struct pt_regs *), 522 void (*irq_func)(int, void *),
523 int flags, void *handle) 523 int flags, void *handle)
524{ 524{
525 struct pardevice *tmp; 525 struct pardevice *tmp;