aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tulip
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/net/tulip
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/net/tulip')
-rw-r--r--drivers/net/tulip/de2104x.c2
-rw-r--r--drivers/net/tulip/de4x5.c4
-rw-r--r--drivers/net/tulip/dmfe.c6
-rw-r--r--drivers/net/tulip/interrupt.c2
-rw-r--r--drivers/net/tulip/tulip.h2
-rw-r--r--drivers/net/tulip/tulip_core.c2
-rw-r--r--drivers/net/tulip/uli526x.c4
-rw-r--r--drivers/net/tulip/winbond-840.c4
-rw-r--r--drivers/net/tulip/xircom_cb.c6
-rw-r--r--drivers/net/tulip/xircom_tulip_cb.c4
10 files changed, 18 insertions, 18 deletions
diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c
index e1b48bd86646..2cfd9634895a 100644
--- a/drivers/net/tulip/de2104x.c
+++ b/drivers/net/tulip/de2104x.c
@@ -484,7 +484,7 @@ rx_next:
484 de->rx_tail = rx_tail; 484 de->rx_tail = rx_tail;
485} 485}
486 486
487static irqreturn_t de_interrupt (int irq, void *dev_instance, struct pt_regs *regs) 487static irqreturn_t de_interrupt (int irq, void *dev_instance)
488{ 488{
489 struct net_device *dev = dev_instance; 489 struct net_device *dev = dev_instance;
490 struct de_private *de = dev->priv; 490 struct de_private *de = dev->priv;
diff --git a/drivers/net/tulip/de4x5.c b/drivers/net/tulip/de4x5.c
index fb5fa7d68888..e17f9779ead2 100644
--- a/drivers/net/tulip/de4x5.c
+++ b/drivers/net/tulip/de4x5.c
@@ -896,7 +896,7 @@ static struct {
896*/ 896*/
897static int de4x5_open(struct net_device *dev); 897static int de4x5_open(struct net_device *dev);
898static int de4x5_queue_pkt(struct sk_buff *skb, struct net_device *dev); 898static int de4x5_queue_pkt(struct sk_buff *skb, struct net_device *dev);
899static irqreturn_t de4x5_interrupt(int irq, void *dev_id, struct pt_regs *regs); 899static irqreturn_t de4x5_interrupt(int irq, void *dev_id);
900static int de4x5_close(struct net_device *dev); 900static int de4x5_close(struct net_device *dev);
901static struct net_device_stats *de4x5_get_stats(struct net_device *dev); 901static struct net_device_stats *de4x5_get_stats(struct net_device *dev);
902static void de4x5_local_stats(struct net_device *dev, char *buf, int pkt_len); 902static void de4x5_local_stats(struct net_device *dev, char *buf, int pkt_len);
@@ -1538,7 +1538,7 @@ de4x5_queue_pkt(struct sk_buff *skb, struct net_device *dev)
1538** interrupt is asserted and this routine entered. 1538** interrupt is asserted and this routine entered.
1539*/ 1539*/
1540static irqreturn_t 1540static irqreturn_t
1541de4x5_interrupt(int irq, void *dev_id, struct pt_regs *regs) 1541de4x5_interrupt(int irq, void *dev_id)
1542{ 1542{
1543 struct net_device *dev = (struct net_device *)dev_id; 1543 struct net_device *dev = (struct net_device *)dev_id;
1544 struct de4x5_private *lp; 1544 struct de4x5_private *lp;
diff --git a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c
index ccf2c225f084..4dd8a0bae860 100644
--- a/drivers/net/tulip/dmfe.c
+++ b/drivers/net/tulip/dmfe.c
@@ -300,7 +300,7 @@ static struct net_device_stats * dmfe_get_stats(struct DEVICE *);
300static void dmfe_set_filter_mode(struct DEVICE *); 300static void dmfe_set_filter_mode(struct DEVICE *);
301static const struct ethtool_ops netdev_ethtool_ops; 301static const struct ethtool_ops netdev_ethtool_ops;
302static u16 read_srom_word(long ,int); 302static u16 read_srom_word(long ,int);
303static irqreturn_t dmfe_interrupt(int , void *, struct pt_regs *); 303static irqreturn_t dmfe_interrupt(int , void *);
304#ifdef CONFIG_NET_POLL_CONTROLLER 304#ifdef CONFIG_NET_POLL_CONTROLLER
305static void poll_dmfe (struct net_device *dev); 305static void poll_dmfe (struct net_device *dev);
306#endif 306#endif
@@ -735,7 +735,7 @@ static int dmfe_stop(struct DEVICE *dev)
735 * receive the packet to upper layer, free the transmitted packet 735 * receive the packet to upper layer, free the transmitted packet
736 */ 736 */
737 737
738static irqreturn_t dmfe_interrupt(int irq, void *dev_id, struct pt_regs *regs) 738static irqreturn_t dmfe_interrupt(int irq, void *dev_id)
739{ 739{
740 struct DEVICE *dev = dev_id; 740 struct DEVICE *dev = dev_id;
741 struct dmfe_board_info *db = netdev_priv(dev); 741 struct dmfe_board_info *db = netdev_priv(dev);
@@ -806,7 +806,7 @@ static void poll_dmfe (struct net_device *dev)
806 /* disable_irq here is not very nice, but with the lockless 806 /* disable_irq here is not very nice, but with the lockless
807 interrupt handler we have no other choice. */ 807 interrupt handler we have no other choice. */
808 disable_irq(dev->irq); 808 disable_irq(dev->irq);
809 dmfe_interrupt (dev->irq, dev, NULL); 809 dmfe_interrupt (dev->irq, dev);
810 enable_irq(dev->irq); 810 enable_irq(dev->irq);
811} 811}
812#endif 812#endif
diff --git a/drivers/net/tulip/interrupt.c b/drivers/net/tulip/interrupt.c
index 7f8f5d42a761..e3488d7b8ede 100644
--- a/drivers/net/tulip/interrupt.c
+++ b/drivers/net/tulip/interrupt.c
@@ -496,7 +496,7 @@ static inline unsigned int phy_interrupt (struct net_device *dev)
496 496
497/* The interrupt handler does all of the Rx thread work and cleans up 497/* The interrupt handler does all of the Rx thread work and cleans up
498 after the Tx thread. */ 498 after the Tx thread. */
499irqreturn_t tulip_interrupt(int irq, void *dev_instance, struct pt_regs *regs) 499irqreturn_t tulip_interrupt(int irq, void *dev_instance)
500{ 500{
501 struct net_device *dev = (struct net_device *)dev_instance; 501 struct net_device *dev = (struct net_device *)dev_instance;
502 struct tulip_private *tp = netdev_priv(dev); 502 struct tulip_private *tp = netdev_priv(dev);
diff --git a/drivers/net/tulip/tulip.h b/drivers/net/tulip/tulip.h
index 25668ddb1f7e..ad107f45c7b1 100644
--- a/drivers/net/tulip/tulip.h
+++ b/drivers/net/tulip/tulip.h
@@ -424,7 +424,7 @@ int tulip_read_eeprom(struct net_device *dev, int location, int addr_len);
424/* interrupt.c */ 424/* interrupt.c */
425extern unsigned int tulip_max_interrupt_work; 425extern unsigned int tulip_max_interrupt_work;
426extern int tulip_rx_copybreak; 426extern int tulip_rx_copybreak;
427irqreturn_t tulip_interrupt(int irq, void *dev_instance, struct pt_regs *regs); 427irqreturn_t tulip_interrupt(int irq, void *dev_instance);
428int tulip_refill_rx(struct net_device *dev); 428int tulip_refill_rx(struct net_device *dev);
429#ifdef CONFIG_TULIP_NAPI 429#ifdef CONFIG_TULIP_NAPI
430int tulip_poll(struct net_device *dev, int *budget); 430int tulip_poll(struct net_device *dev, int *budget);
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c
index 831919a81918..0aee618f883c 100644
--- a/drivers/net/tulip/tulip_core.c
+++ b/drivers/net/tulip/tulip_core.c
@@ -1823,7 +1823,7 @@ static void poll_tulip (struct net_device *dev)
1823 /* disable_irq here is not very nice, but with the lockless 1823 /* disable_irq here is not very nice, but with the lockless
1824 interrupt handler we have no other choice. */ 1824 interrupt handler we have no other choice. */
1825 disable_irq(dev->irq); 1825 disable_irq(dev->irq);
1826 tulip_interrupt (dev->irq, dev, NULL); 1826 tulip_interrupt (dev->irq, dev);
1827 enable_irq(dev->irq); 1827 enable_irq(dev->irq);
1828} 1828}
1829#endif 1829#endif
diff --git a/drivers/net/tulip/uli526x.c b/drivers/net/tulip/uli526x.c
index 0b176be51eb3..229158e8e4be 100644
--- a/drivers/net/tulip/uli526x.c
+++ b/drivers/net/tulip/uli526x.c
@@ -224,7 +224,7 @@ static struct net_device_stats * uli526x_get_stats(struct net_device *);
224static void uli526x_set_filter_mode(struct net_device *); 224static void uli526x_set_filter_mode(struct net_device *);
225static const struct ethtool_ops netdev_ethtool_ops; 225static const struct ethtool_ops netdev_ethtool_ops;
226static u16 read_srom_word(long, int); 226static u16 read_srom_word(long, int);
227static irqreturn_t uli526x_interrupt(int, void *, struct pt_regs *); 227static irqreturn_t uli526x_interrupt(int, void *);
228static void uli526x_descriptor_init(struct uli526x_board_info *, unsigned long); 228static void uli526x_descriptor_init(struct uli526x_board_info *, unsigned long);
229static void allocate_rx_buffer(struct uli526x_board_info *); 229static void allocate_rx_buffer(struct uli526x_board_info *);
230static void update_cr6(u32, unsigned long); 230static void update_cr6(u32, unsigned long);
@@ -659,7 +659,7 @@ static int uli526x_stop(struct net_device *dev)
659 * receive the packet to upper layer, free the transmitted packet 659 * receive the packet to upper layer, free the transmitted packet
660 */ 660 */
661 661
662static irqreturn_t uli526x_interrupt(int irq, void *dev_id, struct pt_regs *regs) 662static irqreturn_t uli526x_interrupt(int irq, void *dev_id)
663{ 663{
664 struct net_device *dev = dev_id; 664 struct net_device *dev = dev_id;
665 struct uli526x_board_info *db = netdev_priv(dev); 665 struct uli526x_board_info *db = netdev_priv(dev);
diff --git a/drivers/net/tulip/winbond-840.c b/drivers/net/tulip/winbond-840.c
index 2fca1ee24f5a..002a05e0722f 100644
--- a/drivers/net/tulip/winbond-840.c
+++ b/drivers/net/tulip/winbond-840.c
@@ -332,7 +332,7 @@ static void tx_timeout(struct net_device *dev);
332static int alloc_ringdesc(struct net_device *dev); 332static int alloc_ringdesc(struct net_device *dev);
333static void free_ringdesc(struct netdev_private *np); 333static void free_ringdesc(struct netdev_private *np);
334static int start_tx(struct sk_buff *skb, struct net_device *dev); 334static int start_tx(struct sk_buff *skb, struct net_device *dev);
335static irqreturn_t intr_handler(int irq, void *dev_instance, struct pt_regs *regs); 335static irqreturn_t intr_handler(int irq, void *dev_instance);
336static void netdev_error(struct net_device *dev, int intr_status); 336static void netdev_error(struct net_device *dev, int intr_status);
337static int netdev_rx(struct net_device *dev); 337static int netdev_rx(struct net_device *dev);
338static u32 __set_rx_mode(struct net_device *dev); 338static u32 __set_rx_mode(struct net_device *dev);
@@ -1110,7 +1110,7 @@ static void netdev_tx_done(struct net_device *dev)
1110 1110
1111/* The interrupt handler does all of the Rx thread work and cleans up 1111/* The interrupt handler does all of the Rx thread work and cleans up
1112 after the Tx thread. */ 1112 after the Tx thread. */
1113static irqreturn_t intr_handler(int irq, void *dev_instance, struct pt_regs *rgs) 1113static irqreturn_t intr_handler(int irq, void *dev_instance)
1114{ 1114{
1115 struct net_device *dev = (struct net_device *)dev_instance; 1115 struct net_device *dev = (struct net_device *)dev_instance;
1116 struct netdev_private *np = netdev_priv(dev); 1116 struct netdev_private *np = netdev_priv(dev);
diff --git a/drivers/net/tulip/xircom_cb.c b/drivers/net/tulip/xircom_cb.c
index 629eac645289..61d313049dd0 100644
--- a/drivers/net/tulip/xircom_cb.c
+++ b/drivers/net/tulip/xircom_cb.c
@@ -114,7 +114,7 @@ struct xircom_private {
114/* Function prototypes */ 114/* Function prototypes */
115static int xircom_probe(struct pci_dev *pdev, const struct pci_device_id *id); 115static int xircom_probe(struct pci_dev *pdev, const struct pci_device_id *id);
116static void xircom_remove(struct pci_dev *pdev); 116static void xircom_remove(struct pci_dev *pdev);
117static irqreturn_t xircom_interrupt(int irq, void *dev_instance, struct pt_regs *regs); 117static irqreturn_t xircom_interrupt(int irq, void *dev_instance);
118static int xircom_start_xmit(struct sk_buff *skb, struct net_device *dev); 118static int xircom_start_xmit(struct sk_buff *skb, struct net_device *dev);
119static int xircom_open(struct net_device *dev); 119static int xircom_open(struct net_device *dev);
120static int xircom_close(struct net_device *dev); 120static int xircom_close(struct net_device *dev);
@@ -334,7 +334,7 @@ static void __devexit xircom_remove(struct pci_dev *pdev)
334 leave("xircom_remove"); 334 leave("xircom_remove");
335} 335}
336 336
337static irqreturn_t xircom_interrupt(int irq, void *dev_instance, struct pt_regs *regs) 337static irqreturn_t xircom_interrupt(int irq, void *dev_instance)
338{ 338{
339 struct net_device *dev = (struct net_device *) dev_instance; 339 struct net_device *dev = (struct net_device *) dev_instance;
340 struct xircom_private *card = netdev_priv(dev); 340 struct xircom_private *card = netdev_priv(dev);
@@ -513,7 +513,7 @@ static struct net_device_stats *xircom_get_stats(struct net_device *dev)
513static void xircom_poll_controller(struct net_device *dev) 513static void xircom_poll_controller(struct net_device *dev)
514{ 514{
515 disable_irq(dev->irq); 515 disable_irq(dev->irq);
516 xircom_interrupt(dev->irq, dev, NULL); 516 xircom_interrupt(dev->irq, dev);
517 enable_irq(dev->irq); 517 enable_irq(dev->irq);
518} 518}
519#endif 519#endif
diff --git a/drivers/net/tulip/xircom_tulip_cb.c b/drivers/net/tulip/xircom_tulip_cb.c
index 312788caa4c6..a998c5d0ae9c 100644
--- a/drivers/net/tulip/xircom_tulip_cb.c
+++ b/drivers/net/tulip/xircom_tulip_cb.c
@@ -328,7 +328,7 @@ static void xircom_init_ring(struct net_device *dev);
328static int xircom_start_xmit(struct sk_buff *skb, struct net_device *dev); 328static int xircom_start_xmit(struct sk_buff *skb, struct net_device *dev);
329static int xircom_rx(struct net_device *dev); 329static int xircom_rx(struct net_device *dev);
330static void xircom_media_change(struct net_device *dev); 330static void xircom_media_change(struct net_device *dev);
331static irqreturn_t xircom_interrupt(int irq, void *dev_instance, struct pt_regs *regs); 331static irqreturn_t xircom_interrupt(int irq, void *dev_instance);
332static int xircom_close(struct net_device *dev); 332static int xircom_close(struct net_device *dev);
333static struct net_device_stats *xircom_get_stats(struct net_device *dev); 333static struct net_device_stats *xircom_get_stats(struct net_device *dev);
334static int xircom_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 334static int xircom_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
@@ -1044,7 +1044,7 @@ static void check_duplex(struct net_device *dev)
1044 1044
1045/* The interrupt handler does all of the Rx thread work and cleans up 1045/* The interrupt handler does all of the Rx thread work and cleans up
1046 after the Tx thread. */ 1046 after the Tx thread. */
1047static irqreturn_t xircom_interrupt(int irq, void *dev_instance, struct pt_regs *regs) 1047static irqreturn_t xircom_interrupt(int irq, void *dev_instance)
1048{ 1048{
1049 struct net_device *dev = dev_instance; 1049 struct net_device *dev = dev_instance;
1050 struct xircom_private *tp = netdev_priv(dev); 1050 struct xircom_private *tp = netdev_priv(dev);