diff options
author | David Howells <dhowells@redhat.com> | 2006-10-05 09:55:46 -0400 |
---|---|---|
committer | David Howells <dhowells@warthog.cambridge.redhat.com> | 2006-10-05 10:10:12 -0400 |
commit | 7d12e780e003f93433d49ce78cfedf4b4c52adc5 (patch) | |
tree | 6748550400445c11a306b132009f3001e3525df8 /drivers/net/wan | |
parent | da482792a6d1a3fbaaa25fae867b343fb4db3246 (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/net/wan')
-rw-r--r-- | drivers/net/wan/cosa.c | 4 | ||||
-rw-r--r-- | drivers/net/wan/cycx_main.c | 4 | ||||
-rw-r--r-- | drivers/net/wan/dscc4.c | 4 | ||||
-rw-r--r-- | drivers/net/wan/farsync.c | 2 | ||||
-rw-r--r-- | drivers/net/wan/hd6457x.c | 2 | ||||
-rw-r--r-- | drivers/net/wan/lmc/lmc_main.c | 4 | ||||
-rw-r--r-- | drivers/net/wan/pc300_drv.c | 4 | ||||
-rw-r--r-- | drivers/net/wan/sbni.c | 4 | ||||
-rw-r--r-- | drivers/net/wan/sdla.c | 2 | ||||
-rw-r--r-- | drivers/net/wan/wanxl.c | 2 | ||||
-rw-r--r-- | drivers/net/wan/z85230.c | 2 | ||||
-rw-r--r-- | drivers/net/wan/z85230.h | 2 |
12 files changed, 18 insertions, 18 deletions
diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c index 1f95b4864ea1..e1bf8b93f958 100644 --- a/drivers/net/wan/cosa.c +++ b/drivers/net/wan/cosa.c | |||
@@ -345,7 +345,7 @@ static void put_driver_status(struct cosa_data *cosa); | |||
345 | static void put_driver_status_nolock(struct cosa_data *cosa); | 345 | static void put_driver_status_nolock(struct cosa_data *cosa); |
346 | 346 | ||
347 | /* Interrupt handling */ | 347 | /* Interrupt handling */ |
348 | static irqreturn_t cosa_interrupt(int irq, void *cosa, struct pt_regs *regs); | 348 | static irqreturn_t cosa_interrupt(int irq, void *cosa); |
349 | 349 | ||
350 | /* I/O ops debugging */ | 350 | /* I/O ops debugging */ |
351 | #ifdef DEBUG_IO | 351 | #ifdef DEBUG_IO |
@@ -1972,7 +1972,7 @@ out: | |||
1972 | spin_unlock_irqrestore(&cosa->lock, flags); | 1972 | spin_unlock_irqrestore(&cosa->lock, flags); |
1973 | } | 1973 | } |
1974 | 1974 | ||
1975 | static irqreturn_t cosa_interrupt(int irq, void *cosa_, struct pt_regs *regs) | 1975 | static irqreturn_t cosa_interrupt(int irq, void *cosa_) |
1976 | { | 1976 | { |
1977 | unsigned status; | 1977 | unsigned status; |
1978 | int count = 0; | 1978 | int count = 0; |
diff --git a/drivers/net/wan/cycx_main.c b/drivers/net/wan/cycx_main.c index a5e7ce1bd16a..12363e056b63 100644 --- a/drivers/net/wan/cycx_main.c +++ b/drivers/net/wan/cycx_main.c | |||
@@ -74,7 +74,7 @@ static int cycx_wan_setup(struct wan_device *wandev, wandev_conf_t *conf); | |||
74 | static int cycx_wan_shutdown(struct wan_device *wandev); | 74 | static int cycx_wan_shutdown(struct wan_device *wandev); |
75 | 75 | ||
76 | /* Miscellaneous functions */ | 76 | /* Miscellaneous functions */ |
77 | static irqreturn_t cycx_isr(int irq, void *dev_id, struct pt_regs *regs); | 77 | static irqreturn_t cycx_isr(int irq, void *dev_id); |
78 | 78 | ||
79 | /* Global Data | 79 | /* Global Data |
80 | * Note: All data must be explicitly initialized!!! | 80 | * Note: All data must be explicitly initialized!!! |
@@ -301,7 +301,7 @@ out: return ret; | |||
301 | * o acknowledge Cyclom 2X hardware interrupt. | 301 | * o acknowledge Cyclom 2X hardware interrupt. |
302 | * o call protocol-specific interrupt service routine, if any. | 302 | * o call protocol-specific interrupt service routine, if any. |
303 | */ | 303 | */ |
304 | static irqreturn_t cycx_isr(int irq, void *dev_id, struct pt_regs *regs) | 304 | static irqreturn_t cycx_isr(int irq, void *dev_id) |
305 | { | 305 | { |
306 | struct cycx_device *card = (struct cycx_device *)dev_id; | 306 | struct cycx_device *card = (struct cycx_device *)dev_id; |
307 | 307 | ||
diff --git a/drivers/net/wan/dscc4.c b/drivers/net/wan/dscc4.c index af4d4155905b..25021a7992a9 100644 --- a/drivers/net/wan/dscc4.c +++ b/drivers/net/wan/dscc4.c | |||
@@ -365,7 +365,7 @@ static int dscc4_init_ring(struct net_device *); | |||
365 | static void dscc4_release_ring(struct dscc4_dev_priv *); | 365 | static void dscc4_release_ring(struct dscc4_dev_priv *); |
366 | static void dscc4_timer(unsigned long); | 366 | static void dscc4_timer(unsigned long); |
367 | static void dscc4_tx_timeout(struct net_device *); | 367 | static void dscc4_tx_timeout(struct net_device *); |
368 | static irqreturn_t dscc4_irq(int irq, void *dev_id, struct pt_regs *ptregs); | 368 | static irqreturn_t dscc4_irq(int irq, void *dev_id); |
369 | static int dscc4_hdlc_attach(struct net_device *, unsigned short, unsigned short); | 369 | static int dscc4_hdlc_attach(struct net_device *, unsigned short, unsigned short); |
370 | static int dscc4_set_iface(struct dscc4_dev_priv *, struct net_device *); | 370 | static int dscc4_set_iface(struct dscc4_dev_priv *, struct net_device *); |
371 | #ifdef DSCC4_POLLING | 371 | #ifdef DSCC4_POLLING |
@@ -1476,7 +1476,7 @@ static int dscc4_set_iface(struct dscc4_dev_priv *dpriv, struct net_device *dev) | |||
1476 | return ret; | 1476 | return ret; |
1477 | } | 1477 | } |
1478 | 1478 | ||
1479 | static irqreturn_t dscc4_irq(int irq, void *token, struct pt_regs *ptregs) | 1479 | static irqreturn_t dscc4_irq(int irq, void *token) |
1480 | { | 1480 | { |
1481 | struct dscc4_dev_priv *root = token; | 1481 | struct dscc4_dev_priv *root = token; |
1482 | struct dscc4_pci_priv *priv; | 1482 | struct dscc4_pci_priv *priv; |
diff --git a/drivers/net/wan/farsync.c b/drivers/net/wan/farsync.c index 564351aafa41..c45d6a83339d 100644 --- a/drivers/net/wan/farsync.c +++ b/drivers/net/wan/farsync.c | |||
@@ -1498,7 +1498,7 @@ do_bottom_half_rx(struct fst_card_info *card) | |||
1498 | * Dev_id is our fst_card_info pointer | 1498 | * Dev_id is our fst_card_info pointer |
1499 | */ | 1499 | */ |
1500 | static irqreturn_t | 1500 | static irqreturn_t |
1501 | fst_intr(int irq, void *dev_id, struct pt_regs *regs) | 1501 | fst_intr(int irq, void *dev_id) |
1502 | { | 1502 | { |
1503 | struct fst_card_info *card; | 1503 | struct fst_card_info *card; |
1504 | struct fst_port_info *port; | 1504 | struct fst_port_info *port; |
diff --git a/drivers/net/wan/hd6457x.c b/drivers/net/wan/hd6457x.c index dce2bb317b82..8d0a1f2f00e5 100644 --- a/drivers/net/wan/hd6457x.c +++ b/drivers/net/wan/hd6457x.c | |||
@@ -424,7 +424,7 @@ static inline void sca_tx_intr(port_t *port) | |||
424 | 424 | ||
425 | 425 | ||
426 | 426 | ||
427 | static irqreturn_t sca_intr(int irq, void* dev_id, struct pt_regs *regs) | 427 | static irqreturn_t sca_intr(int irq, void* dev_id) |
428 | { | 428 | { |
429 | card_t *card = dev_id; | 429 | card_t *card = dev_id; |
430 | int i; | 430 | int i; |
diff --git a/drivers/net/wan/lmc/lmc_main.c b/drivers/net/wan/lmc/lmc_main.c index 7b5d81deb028..2b54f1bc3a0d 100644 --- a/drivers/net/wan/lmc/lmc_main.c +++ b/drivers/net/wan/lmc/lmc_main.c | |||
@@ -100,7 +100,7 @@ static int lmc_rx (struct net_device *dev); | |||
100 | static int lmc_open(struct net_device *dev); | 100 | static int lmc_open(struct net_device *dev); |
101 | static int lmc_close(struct net_device *dev); | 101 | static int lmc_close(struct net_device *dev); |
102 | static struct net_device_stats *lmc_get_stats(struct net_device *dev); | 102 | static struct net_device_stats *lmc_get_stats(struct net_device *dev); |
103 | static irqreturn_t lmc_interrupt(int irq, void *dev_instance, struct pt_regs *regs); | 103 | static irqreturn_t lmc_interrupt(int irq, void *dev_instance); |
104 | static void lmc_initcsrs(lmc_softc_t * const sc, lmc_csrptr_t csr_base, size_t csr_size); | 104 | static void lmc_initcsrs(lmc_softc_t * const sc, lmc_csrptr_t csr_base, size_t csr_size); |
105 | static void lmc_softreset(lmc_softc_t * const); | 105 | static void lmc_softreset(lmc_softc_t * const); |
106 | static void lmc_running_reset(struct net_device *dev); | 106 | static void lmc_running_reset(struct net_device *dev); |
@@ -1273,7 +1273,7 @@ static int lmc_ifdown (struct net_device *dev) /*fold00*/ | |||
1273 | /* Interrupt handling routine. This will take an incoming packet, or clean | 1273 | /* Interrupt handling routine. This will take an incoming packet, or clean |
1274 | * up after a trasmit. | 1274 | * up after a trasmit. |
1275 | */ | 1275 | */ |
1276 | static irqreturn_t lmc_interrupt (int irq, void *dev_instance, struct pt_regs *regs) /*fold00*/ | 1276 | static irqreturn_t lmc_interrupt (int irq, void *dev_instance) /*fold00*/ |
1277 | { | 1277 | { |
1278 | struct net_device *dev = (struct net_device *) dev_instance; | 1278 | struct net_device *dev = (struct net_device *) dev_instance; |
1279 | lmc_softc_t *sc; | 1279 | lmc_softc_t *sc; |
diff --git a/drivers/net/wan/pc300_drv.c b/drivers/net/wan/pc300_drv.c index 8d9b959bf15b..5823e3bca178 100644 --- a/drivers/net/wan/pc300_drv.c +++ b/drivers/net/wan/pc300_drv.c | |||
@@ -284,7 +284,7 @@ static void rx_dma_buf_pt_init(pc300_t *, int); | |||
284 | static void rx_dma_buf_init(pc300_t *, int); | 284 | static void rx_dma_buf_init(pc300_t *, int); |
285 | static void tx_dma_buf_check(pc300_t *, int); | 285 | static void tx_dma_buf_check(pc300_t *, int); |
286 | static void rx_dma_buf_check(pc300_t *, int); | 286 | static void rx_dma_buf_check(pc300_t *, int); |
287 | static irqreturn_t cpc_intr(int, void *, struct pt_regs *); | 287 | static irqreturn_t cpc_intr(int, void *); |
288 | static struct net_device_stats *cpc_get_stats(struct net_device *); | 288 | static struct net_device_stats *cpc_get_stats(struct net_device *); |
289 | static int clock_rate_calc(uclong, uclong, int *); | 289 | static int clock_rate_calc(uclong, uclong, int *); |
290 | static uclong detect_ram(pc300_t *); | 290 | static uclong detect_ram(pc300_t *); |
@@ -2363,7 +2363,7 @@ static void falc_intr(pc300_t * card) | |||
2363 | } | 2363 | } |
2364 | } | 2364 | } |
2365 | 2365 | ||
2366 | static irqreturn_t cpc_intr(int irq, void *dev_id, struct pt_regs *regs) | 2366 | static irqreturn_t cpc_intr(int irq, void *dev_id) |
2367 | { | 2367 | { |
2368 | pc300_t *card; | 2368 | pc300_t *card; |
2369 | volatile ucchar plx_status; | 2369 | volatile ucchar plx_status; |
diff --git a/drivers/net/wan/sbni.c b/drivers/net/wan/sbni.c index fc75bec19029..fc5c0c611ffd 100644 --- a/drivers/net/wan/sbni.c +++ b/drivers/net/wan/sbni.c | |||
@@ -119,7 +119,7 @@ static int sbni_ioctl( struct net_device *, struct ifreq *, int ); | |||
119 | static struct net_device_stats *sbni_get_stats( struct net_device * ); | 119 | static struct net_device_stats *sbni_get_stats( struct net_device * ); |
120 | static void set_multicast_list( struct net_device * ); | 120 | static void set_multicast_list( struct net_device * ); |
121 | 121 | ||
122 | static irqreturn_t sbni_interrupt( int, void *, struct pt_regs * ); | 122 | static irqreturn_t sbni_interrupt( int, void * ); |
123 | static void handle_channel( struct net_device * ); | 123 | static void handle_channel( struct net_device * ); |
124 | static int recv_frame( struct net_device * ); | 124 | static int recv_frame( struct net_device * ); |
125 | static void send_frame( struct net_device * ); | 125 | static void send_frame( struct net_device * ); |
@@ -501,7 +501,7 @@ sbni_start_xmit( struct sk_buff *skb, struct net_device *dev ) | |||
501 | */ | 501 | */ |
502 | 502 | ||
503 | static irqreturn_t | 503 | static irqreturn_t |
504 | sbni_interrupt( int irq, void *dev_id, struct pt_regs *regs ) | 504 | sbni_interrupt( int irq, void *dev_id ) |
505 | { | 505 | { |
506 | struct net_device *dev = (struct net_device *) dev_id; | 506 | struct net_device *dev = (struct net_device *) dev_id; |
507 | struct net_local *nl = (struct net_local *) dev->priv; | 507 | struct net_local *nl = (struct net_local *) dev->priv; |
diff --git a/drivers/net/wan/sdla.c b/drivers/net/wan/sdla.c index 0ba018f8382b..5715d25271f1 100644 --- a/drivers/net/wan/sdla.c +++ b/drivers/net/wan/sdla.c | |||
@@ -867,7 +867,7 @@ static void sdla_receive(struct net_device *dev) | |||
867 | spin_unlock_irqrestore(&sdla_lock, flags); | 867 | spin_unlock_irqrestore(&sdla_lock, flags); |
868 | } | 868 | } |
869 | 869 | ||
870 | static irqreturn_t sdla_isr(int irq, void *dev_id, struct pt_regs * regs) | 870 | static irqreturn_t sdla_isr(int irq, void *dev_id) |
871 | { | 871 | { |
872 | struct net_device *dev; | 872 | struct net_device *dev; |
873 | struct frad_local *flp; | 873 | struct frad_local *flp; |
diff --git a/drivers/net/wan/wanxl.c b/drivers/net/wan/wanxl.c index ec68f7dfd93f..c73601574334 100644 --- a/drivers/net/wan/wanxl.c +++ b/drivers/net/wan/wanxl.c | |||
@@ -244,7 +244,7 @@ static inline void wanxl_rx_intr(card_t *card) | |||
244 | 244 | ||
245 | 245 | ||
246 | 246 | ||
247 | static irqreturn_t wanxl_intr(int irq, void* dev_id, struct pt_regs *regs) | 247 | static irqreturn_t wanxl_intr(int irq, void* dev_id) |
248 | { | 248 | { |
249 | card_t *card = dev_id; | 249 | card_t *card = dev_id; |
250 | int i; | 250 | int i; |
diff --git a/drivers/net/wan/z85230.c b/drivers/net/wan/z85230.c index caa48f12fd0f..59ddd21c3958 100644 --- a/drivers/net/wan/z85230.c +++ b/drivers/net/wan/z85230.c | |||
@@ -728,7 +728,7 @@ EXPORT_SYMBOL(z8530_nop); | |||
728 | * channel). c->lock for both channels points to dev->lock | 728 | * channel). c->lock for both channels points to dev->lock |
729 | */ | 729 | */ |
730 | 730 | ||
731 | irqreturn_t z8530_interrupt(int irq, void *dev_id, struct pt_regs *regs) | 731 | irqreturn_t z8530_interrupt(int irq, void *dev_id) |
732 | { | 732 | { |
733 | struct z8530_dev *dev=dev_id; | 733 | struct z8530_dev *dev=dev_id; |
734 | u8 intr; | 734 | u8 intr; |
diff --git a/drivers/net/wan/z85230.h b/drivers/net/wan/z85230.h index 77e53208045f..158aea7b8eac 100644 --- a/drivers/net/wan/z85230.h +++ b/drivers/net/wan/z85230.h | |||
@@ -396,7 +396,7 @@ struct z8530_dev | |||
396 | extern u8 z8530_dead_port[]; | 396 | extern u8 z8530_dead_port[]; |
397 | extern u8 z8530_hdlc_kilostream_85230[]; | 397 | extern u8 z8530_hdlc_kilostream_85230[]; |
398 | extern u8 z8530_hdlc_kilostream[]; | 398 | extern u8 z8530_hdlc_kilostream[]; |
399 | extern irqreturn_t z8530_interrupt(int, void *, struct pt_regs *); | 399 | extern irqreturn_t z8530_interrupt(int, void *); |
400 | extern void z8530_describe(struct z8530_dev *, char *mapping, unsigned long io); | 400 | extern void z8530_describe(struct z8530_dev *, char *mapping, unsigned long io); |
401 | extern int z8530_init(struct z8530_dev *); | 401 | extern int z8530_init(struct z8530_dev *); |
402 | extern int z8530_shutdown(struct z8530_dev *); | 402 | extern int z8530_shutdown(struct z8530_dev *); |