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/usb/net | |
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/usb/net')
-rw-r--r-- | drivers/usb/net/asix.c | 2 | ||||
-rw-r--r-- | drivers/usb/net/catc.c | 8 | ||||
-rw-r--r-- | drivers/usb/net/gl620a.c | 2 | ||||
-rw-r--r-- | drivers/usb/net/kaweth.c | 10 | ||||
-rw-r--r-- | drivers/usb/net/net1080.c | 2 | ||||
-rw-r--r-- | drivers/usb/net/pegasus.c | 14 | ||||
-rw-r--r-- | drivers/usb/net/rtl8150.c | 12 | ||||
-rw-r--r-- | drivers/usb/net/usbnet.c | 10 |
8 files changed, 30 insertions, 30 deletions
diff --git a/drivers/usb/net/asix.c b/drivers/usb/net/asix.c index 9c0eacf7055c..c73dd224aa76 100644 --- a/drivers/usb/net/asix.c +++ b/drivers/usb/net/asix.c | |||
@@ -214,7 +214,7 @@ static int asix_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, | |||
214 | USB_CTRL_SET_TIMEOUT); | 214 | USB_CTRL_SET_TIMEOUT); |
215 | } | 215 | } |
216 | 216 | ||
217 | static void asix_async_cmd_callback(struct urb *urb, struct pt_regs *regs) | 217 | static void asix_async_cmd_callback(struct urb *urb) |
218 | { | 218 | { |
219 | struct usb_ctrlrequest *req = (struct usb_ctrlrequest *)urb->context; | 219 | struct usb_ctrlrequest *req = (struct usb_ctrlrequest *)urb->context; |
220 | 220 | ||
diff --git a/drivers/usb/net/catc.c b/drivers/usb/net/catc.c index be5f5e142dd0..f740325abac4 100644 --- a/drivers/usb/net/catc.c +++ b/drivers/usb/net/catc.c | |||
@@ -223,7 +223,7 @@ struct catc { | |||
223 | * Receive routines. | 223 | * Receive routines. |
224 | */ | 224 | */ |
225 | 225 | ||
226 | static void catc_rx_done(struct urb *urb, struct pt_regs *regs) | 226 | static void catc_rx_done(struct urb *urb) |
227 | { | 227 | { |
228 | struct catc *catc = urb->context; | 228 | struct catc *catc = urb->context; |
229 | u8 *pkt_start = urb->transfer_buffer; | 229 | u8 *pkt_start = urb->transfer_buffer; |
@@ -289,7 +289,7 @@ static void catc_rx_done(struct urb *urb, struct pt_regs *regs) | |||
289 | } | 289 | } |
290 | } | 290 | } |
291 | 291 | ||
292 | static void catc_irq_done(struct urb *urb, struct pt_regs *regs) | 292 | static void catc_irq_done(struct urb *urb) |
293 | { | 293 | { |
294 | struct catc *catc = urb->context; | 294 | struct catc *catc = urb->context; |
295 | u8 *data = urb->transfer_buffer; | 295 | u8 *data = urb->transfer_buffer; |
@@ -376,7 +376,7 @@ static void catc_tx_run(struct catc *catc) | |||
376 | catc->netdev->trans_start = jiffies; | 376 | catc->netdev->trans_start = jiffies; |
377 | } | 377 | } |
378 | 378 | ||
379 | static void catc_tx_done(struct urb *urb, struct pt_regs *regs) | 379 | static void catc_tx_done(struct urb *urb) |
380 | { | 380 | { |
381 | struct catc *catc = urb->context; | 381 | struct catc *catc = urb->context; |
382 | unsigned long flags; | 382 | unsigned long flags; |
@@ -486,7 +486,7 @@ static void catc_ctrl_run(struct catc *catc) | |||
486 | err("submit(ctrl_urb) status %d", status); | 486 | err("submit(ctrl_urb) status %d", status); |
487 | } | 487 | } |
488 | 488 | ||
489 | static void catc_ctrl_done(struct urb *urb, struct pt_regs *regs) | 489 | static void catc_ctrl_done(struct urb *urb) |
490 | { | 490 | { |
491 | struct catc *catc = urb->context; | 491 | struct catc *catc = urb->context; |
492 | struct ctrl_queue *q; | 492 | struct ctrl_queue *q; |
diff --git a/drivers/usb/net/gl620a.c b/drivers/usb/net/gl620a.c index 3155f25f1d48..a3242be21959 100644 --- a/drivers/usb/net/gl620a.c +++ b/drivers/usb/net/gl620a.c | |||
@@ -106,7 +106,7 @@ static inline int gl_control_write(struct usbnet *dev, u8 request, u16 value) | |||
106 | return retval; | 106 | return retval; |
107 | } | 107 | } |
108 | 108 | ||
109 | static void gl_interrupt_complete(struct urb *urb, struct pt_regs *regs) | 109 | static void gl_interrupt_complete(struct urb *urb) |
110 | { | 110 | { |
111 | int status = urb->status; | 111 | int status = urb->status; |
112 | 112 | ||
diff --git a/drivers/usb/net/kaweth.c b/drivers/usb/net/kaweth.c index 544d41fe9b92..957d4ad316f9 100644 --- a/drivers/usb/net/kaweth.c +++ b/drivers/usb/net/kaweth.c | |||
@@ -475,7 +475,7 @@ static int kaweth_reset(struct kaweth_device *kaweth) | |||
475 | return result; | 475 | return result; |
476 | } | 476 | } |
477 | 477 | ||
478 | static void kaweth_usb_receive(struct urb *, struct pt_regs *regs); | 478 | static void kaweth_usb_receive(struct urb *); |
479 | static int kaweth_resubmit_rx_urb(struct kaweth_device *, gfp_t); | 479 | static int kaweth_resubmit_rx_urb(struct kaweth_device *, gfp_t); |
480 | 480 | ||
481 | /**************************************************************** | 481 | /**************************************************************** |
@@ -500,7 +500,7 @@ static void kaweth_resubmit_int_urb(struct kaweth_device *kaweth, gfp_t mf) | |||
500 | kaweth->dev->devpath, status); | 500 | kaweth->dev->devpath, status); |
501 | } | 501 | } |
502 | 502 | ||
503 | static void int_callback(struct urb *u, struct pt_regs *regs) | 503 | static void int_callback(struct urb *u) |
504 | { | 504 | { |
505 | struct kaweth_device *kaweth = u->context; | 505 | struct kaweth_device *kaweth = u->context; |
506 | int act_state; | 506 | int act_state; |
@@ -581,7 +581,7 @@ static void kaweth_async_set_rx_mode(struct kaweth_device *kaweth); | |||
581 | /**************************************************************** | 581 | /**************************************************************** |
582 | * kaweth_usb_receive | 582 | * kaweth_usb_receive |
583 | ****************************************************************/ | 583 | ****************************************************************/ |
584 | static void kaweth_usb_receive(struct urb *urb, struct pt_regs *regs) | 584 | static void kaweth_usb_receive(struct urb *urb) |
585 | { | 585 | { |
586 | struct kaweth_device *kaweth = urb->context; | 586 | struct kaweth_device *kaweth = urb->context; |
587 | struct net_device *net = kaweth->net; | 587 | struct net_device *net = kaweth->net; |
@@ -725,7 +725,7 @@ static struct ethtool_ops ops = { | |||
725 | /**************************************************************** | 725 | /**************************************************************** |
726 | * kaweth_usb_transmit_complete | 726 | * kaweth_usb_transmit_complete |
727 | ****************************************************************/ | 727 | ****************************************************************/ |
728 | static void kaweth_usb_transmit_complete(struct urb *urb, struct pt_regs *regs) | 728 | static void kaweth_usb_transmit_complete(struct urb *urb) |
729 | { | 729 | { |
730 | struct kaweth_device *kaweth = urb->context; | 730 | struct kaweth_device *kaweth = urb->context; |
731 | struct sk_buff *skb = kaweth->tx_skb; | 731 | struct sk_buff *skb = kaweth->tx_skb; |
@@ -1154,7 +1154,7 @@ struct usb_api_data { | |||
1154 | /*-------------------------------------------------------------------* | 1154 | /*-------------------------------------------------------------------* |
1155 | * completion handler for compatibility wrappers (sync control/bulk) * | 1155 | * completion handler for compatibility wrappers (sync control/bulk) * |
1156 | *-------------------------------------------------------------------*/ | 1156 | *-------------------------------------------------------------------*/ |
1157 | static void usb_api_blocking_completion(struct urb *urb, struct pt_regs *regs) | 1157 | static void usb_api_blocking_completion(struct urb *urb) |
1158 | { | 1158 | { |
1159 | struct usb_api_data *awd = (struct usb_api_data *)urb->context; | 1159 | struct usb_api_data *awd = (struct usb_api_data *)urb->context; |
1160 | 1160 | ||
diff --git a/drivers/usb/net/net1080.c b/drivers/usb/net/net1080.c index 301baa72bac7..ce00de8f13a1 100644 --- a/drivers/usb/net/net1080.c +++ b/drivers/usb/net/net1080.c | |||
@@ -368,7 +368,7 @@ static int net1080_check_connect(struct usbnet *dev) | |||
368 | return 0; | 368 | return 0; |
369 | } | 369 | } |
370 | 370 | ||
371 | static void nc_flush_complete(struct urb *urb, struct pt_regs *regs) | 371 | static void nc_flush_complete(struct urb *urb) |
372 | { | 372 | { |
373 | kfree(urb->context); | 373 | kfree(urb->context); |
374 | usb_free_urb(urb); | 374 | usb_free_urb(urb); |
diff --git a/drivers/usb/net/pegasus.c b/drivers/usb/net/pegasus.c index 918cf5a77c08..33abbd2176b6 100644 --- a/drivers/usb/net/pegasus.c +++ b/drivers/usb/net/pegasus.c | |||
@@ -96,7 +96,7 @@ MODULE_DEVICE_TABLE(usb, pegasus_ids); | |||
96 | 96 | ||
97 | static int update_eth_regs_async(pegasus_t *); | 97 | static int update_eth_regs_async(pegasus_t *); |
98 | /* Aargh!!! I _really_ hate such tweaks */ | 98 | /* Aargh!!! I _really_ hate such tweaks */ |
99 | static void ctrl_callback(struct urb *urb, struct pt_regs *regs) | 99 | static void ctrl_callback(struct urb *urb) |
100 | { | 100 | { |
101 | pegasus_t *pegasus = urb->context; | 101 | pegasus_t *pegasus = urb->context; |
102 | 102 | ||
@@ -605,7 +605,7 @@ static inline struct sk_buff *pull_skb(pegasus_t * pegasus) | |||
605 | return NULL; | 605 | return NULL; |
606 | } | 606 | } |
607 | 607 | ||
608 | static void read_bulk_callback(struct urb *urb, struct pt_regs *regs) | 608 | static void read_bulk_callback(struct urb *urb) |
609 | { | 609 | { |
610 | pegasus_t *pegasus = urb->context; | 610 | pegasus_t *pegasus = urb->context; |
611 | struct net_device *net; | 611 | struct net_device *net; |
@@ -764,7 +764,7 @@ done: | |||
764 | spin_unlock_irqrestore(&pegasus->rx_pool_lock, flags); | 764 | spin_unlock_irqrestore(&pegasus->rx_pool_lock, flags); |
765 | } | 765 | } |
766 | 766 | ||
767 | static void write_bulk_callback(struct urb *urb, struct pt_regs *regs) | 767 | static void write_bulk_callback(struct urb *urb) |
768 | { | 768 | { |
769 | pegasus_t *pegasus = urb->context; | 769 | pegasus_t *pegasus = urb->context; |
770 | struct net_device *net = pegasus->net; | 770 | struct net_device *net = pegasus->net; |
@@ -801,7 +801,7 @@ static void write_bulk_callback(struct urb *urb, struct pt_regs *regs) | |||
801 | netif_wake_queue(net); | 801 | netif_wake_queue(net); |
802 | } | 802 | } |
803 | 803 | ||
804 | static void intr_callback(struct urb *urb, struct pt_regs *regs) | 804 | static void intr_callback(struct urb *urb) |
805 | { | 805 | { |
806 | pegasus_t *pegasus = urb->context; | 806 | pegasus_t *pegasus = urb->context; |
807 | struct net_device *net; | 807 | struct net_device *net; |
@@ -1226,7 +1226,7 @@ static void pegasus_set_multicast(struct net_device *net) | |||
1226 | } | 1226 | } |
1227 | 1227 | ||
1228 | pegasus->flags |= ETH_REGS_CHANGE; | 1228 | pegasus->flags |= ETH_REGS_CHANGE; |
1229 | ctrl_callback(pegasus->ctrl_urb, NULL); | 1229 | ctrl_callback(pegasus->ctrl_urb); |
1230 | } | 1230 | } |
1231 | 1231 | ||
1232 | static __u8 mii_phy_probe(pegasus_t * pegasus) | 1232 | static __u8 mii_phy_probe(pegasus_t * pegasus) |
@@ -1433,11 +1433,11 @@ static int pegasus_resume (struct usb_interface *intf) | |||
1433 | if (netif_running(pegasus->net)) { | 1433 | if (netif_running(pegasus->net)) { |
1434 | pegasus->rx_urb->status = 0; | 1434 | pegasus->rx_urb->status = 0; |
1435 | pegasus->rx_urb->actual_length = 0; | 1435 | pegasus->rx_urb->actual_length = 0; |
1436 | read_bulk_callback(pegasus->rx_urb, NULL); | 1436 | read_bulk_callback(pegasus->rx_urb); |
1437 | 1437 | ||
1438 | pegasus->intr_urb->status = 0; | 1438 | pegasus->intr_urb->status = 0; |
1439 | pegasus->intr_urb->actual_length = 0; | 1439 | pegasus->intr_urb->actual_length = 0; |
1440 | intr_callback(pegasus->intr_urb, NULL); | 1440 | intr_callback(pegasus->intr_urb); |
1441 | } | 1441 | } |
1442 | queue_delayed_work(pegasus_workqueue, &pegasus->carrier_check, | 1442 | queue_delayed_work(pegasus_workqueue, &pegasus->carrier_check, |
1443 | CARRIER_CHECK_DELAY); | 1443 | CARRIER_CHECK_DELAY); |
diff --git a/drivers/usb/net/rtl8150.c b/drivers/usb/net/rtl8150.c index 2364c2099387..72171f94ded4 100644 --- a/drivers/usb/net/rtl8150.c +++ b/drivers/usb/net/rtl8150.c | |||
@@ -208,7 +208,7 @@ static int set_registers(rtl8150_t * dev, u16 indx, u16 size, void *data) | |||
208 | indx, 0, data, size, 500); | 208 | indx, 0, data, size, 500); |
209 | } | 209 | } |
210 | 210 | ||
211 | static void ctrl_callback(struct urb *urb, struct pt_regs *regs) | 211 | static void ctrl_callback(struct urb *urb) |
212 | { | 212 | { |
213 | rtl8150_t *dev; | 213 | rtl8150_t *dev; |
214 | 214 | ||
@@ -415,7 +415,7 @@ static inline struct sk_buff *pull_skb(rtl8150_t *dev) | |||
415 | return NULL; | 415 | return NULL; |
416 | } | 416 | } |
417 | 417 | ||
418 | static void read_bulk_callback(struct urb *urb, struct pt_regs *regs) | 418 | static void read_bulk_callback(struct urb *urb) |
419 | { | 419 | { |
420 | rtl8150_t *dev; | 420 | rtl8150_t *dev; |
421 | unsigned pkt_len, res; | 421 | unsigned pkt_len, res; |
@@ -525,7 +525,7 @@ tlsched: | |||
525 | tasklet_schedule(&dev->tl); | 525 | tasklet_schedule(&dev->tl); |
526 | } | 526 | } |
527 | 527 | ||
528 | static void write_bulk_callback(struct urb *urb, struct pt_regs *regs) | 528 | static void write_bulk_callback(struct urb *urb) |
529 | { | 529 | { |
530 | rtl8150_t *dev; | 530 | rtl8150_t *dev; |
531 | 531 | ||
@@ -541,7 +541,7 @@ static void write_bulk_callback(struct urb *urb, struct pt_regs *regs) | |||
541 | netif_wake_queue(dev->netdev); | 541 | netif_wake_queue(dev->netdev); |
542 | } | 542 | } |
543 | 543 | ||
544 | static void intr_callback(struct urb *urb, struct pt_regs *regs) | 544 | static void intr_callback(struct urb *urb) |
545 | { | 545 | { |
546 | rtl8150_t *dev; | 546 | rtl8150_t *dev; |
547 | __u8 *d; | 547 | __u8 *d; |
@@ -617,11 +617,11 @@ static int rtl8150_resume(struct usb_interface *intf) | |||
617 | if (netif_running(dev->netdev)) { | 617 | if (netif_running(dev->netdev)) { |
618 | dev->rx_urb->status = 0; | 618 | dev->rx_urb->status = 0; |
619 | dev->rx_urb->actual_length = 0; | 619 | dev->rx_urb->actual_length = 0; |
620 | read_bulk_callback(dev->rx_urb, NULL); | 620 | read_bulk_callback(dev->rx_urb); |
621 | 621 | ||
622 | dev->intr_urb->status = 0; | 622 | dev->intr_urb->status = 0; |
623 | dev->intr_urb->actual_length = 0; | 623 | dev->intr_urb->actual_length = 0; |
624 | intr_callback(dev->intr_urb, NULL); | 624 | intr_callback(dev->intr_urb); |
625 | } | 625 | } |
626 | return 0; | 626 | return 0; |
627 | } | 627 | } |
diff --git a/drivers/usb/net/usbnet.c b/drivers/usb/net/usbnet.c index 98a522f1e264..24bd3486ee63 100644 --- a/drivers/usb/net/usbnet.c +++ b/drivers/usb/net/usbnet.c | |||
@@ -158,7 +158,7 @@ int usbnet_get_endpoints(struct usbnet *dev, struct usb_interface *intf) | |||
158 | } | 158 | } |
159 | EXPORT_SYMBOL_GPL(usbnet_get_endpoints); | 159 | EXPORT_SYMBOL_GPL(usbnet_get_endpoints); |
160 | 160 | ||
161 | static void intr_complete (struct urb *urb, struct pt_regs *regs); | 161 | static void intr_complete (struct urb *urb); |
162 | 162 | ||
163 | static int init_status (struct usbnet *dev, struct usb_interface *intf) | 163 | static int init_status (struct usbnet *dev, struct usb_interface *intf) |
164 | { | 164 | { |
@@ -295,7 +295,7 @@ EXPORT_SYMBOL_GPL(usbnet_defer_kevent); | |||
295 | 295 | ||
296 | /*-------------------------------------------------------------------------*/ | 296 | /*-------------------------------------------------------------------------*/ |
297 | 297 | ||
298 | static void rx_complete (struct urb *urb, struct pt_regs *regs); | 298 | static void rx_complete (struct urb *urb); |
299 | 299 | ||
300 | static void rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags) | 300 | static void rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags) |
301 | { | 301 | { |
@@ -383,7 +383,7 @@ error: | |||
383 | 383 | ||
384 | /*-------------------------------------------------------------------------*/ | 384 | /*-------------------------------------------------------------------------*/ |
385 | 385 | ||
386 | static void rx_complete (struct urb *urb, struct pt_regs *regs) | 386 | static void rx_complete (struct urb *urb) |
387 | { | 387 | { |
388 | struct sk_buff *skb = (struct sk_buff *) urb->context; | 388 | struct sk_buff *skb = (struct sk_buff *) urb->context; |
389 | struct skb_data *entry = (struct skb_data *) skb->cb; | 389 | struct skb_data *entry = (struct skb_data *) skb->cb; |
@@ -467,7 +467,7 @@ block: | |||
467 | devdbg (dev, "no read resubmitted"); | 467 | devdbg (dev, "no read resubmitted"); |
468 | } | 468 | } |
469 | 469 | ||
470 | static void intr_complete (struct urb *urb, struct pt_regs *regs) | 470 | static void intr_complete (struct urb *urb) |
471 | { | 471 | { |
472 | struct usbnet *dev = urb->context; | 472 | struct usbnet *dev = urb->context; |
473 | int status = urb->status; | 473 | int status = urb->status; |
@@ -797,7 +797,7 @@ kevent (void *data) | |||
797 | 797 | ||
798 | /*-------------------------------------------------------------------------*/ | 798 | /*-------------------------------------------------------------------------*/ |
799 | 799 | ||
800 | static void tx_complete (struct urb *urb, struct pt_regs *regs) | 800 | static void tx_complete (struct urb *urb) |
801 | { | 801 | { |
802 | struct sk_buff *skb = (struct sk_buff *) urb->context; | 802 | struct sk_buff *skb = (struct sk_buff *) urb->context; |
803 | struct skb_data *entry = (struct skb_data *) skb->cb; | 803 | struct skb_data *entry = (struct skb_data *) skb->cb; |