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/char/watchdog | |
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/char/watchdog')
-rw-r--r-- | drivers/char/watchdog/eurotechwdt.c | 2 | ||||
-rw-r--r-- | drivers/char/watchdog/mpcore_wdt.c | 2 | ||||
-rw-r--r-- | drivers/char/watchdog/pcwd_usb.c | 2 | ||||
-rw-r--r-- | drivers/char/watchdog/s3c2410_wdt.c | 3 | ||||
-rw-r--r-- | drivers/char/watchdog/wdt.c | 3 | ||||
-rw-r--r-- | drivers/char/watchdog/wdt285.c | 2 | ||||
-rw-r--r-- | drivers/char/watchdog/wdt_pci.c | 3 |
7 files changed, 7 insertions, 10 deletions
diff --git a/drivers/char/watchdog/eurotechwdt.c b/drivers/char/watchdog/eurotechwdt.c index 4f4269754c46..e228d6e173ce 100644 --- a/drivers/char/watchdog/eurotechwdt.c +++ b/drivers/char/watchdog/eurotechwdt.c | |||
@@ -153,7 +153,7 @@ static void eurwdt_activate_timer(void) | |||
153 | * Kernel methods. | 153 | * Kernel methods. |
154 | */ | 154 | */ |
155 | 155 | ||
156 | static irqreturn_t eurwdt_interrupt(int irq, void *dev_id, struct pt_regs *regs) | 156 | static irqreturn_t eurwdt_interrupt(int irq, void *dev_id) |
157 | { | 157 | { |
158 | printk(KERN_CRIT "timeout WDT timeout\n"); | 158 | printk(KERN_CRIT "timeout WDT timeout\n"); |
159 | 159 | ||
diff --git a/drivers/char/watchdog/mpcore_wdt.c b/drivers/char/watchdog/mpcore_wdt.c index 02d336ace504..3404a9c67f08 100644 --- a/drivers/char/watchdog/mpcore_wdt.c +++ b/drivers/char/watchdog/mpcore_wdt.c | |||
@@ -64,7 +64,7 @@ MODULE_PARM_DESC(mpcore_noboot, "MPcore watchdog action, set to 1 to ignore rebo | |||
64 | * This is the interrupt handler. Note that we only use this | 64 | * This is the interrupt handler. Note that we only use this |
65 | * in testing mode, so don't actually do a reboot here. | 65 | * in testing mode, so don't actually do a reboot here. |
66 | */ | 66 | */ |
67 | static irqreturn_t mpcore_wdt_fire(int irq, void *arg, struct pt_regs *regs) | 67 | static irqreturn_t mpcore_wdt_fire(int irq, void *arg) |
68 | { | 68 | { |
69 | struct mpcore_wdt *wdt = arg; | 69 | struct mpcore_wdt *wdt = arg; |
70 | 70 | ||
diff --git a/drivers/char/watchdog/pcwd_usb.c b/drivers/char/watchdog/pcwd_usb.c index 77662cb0ac46..bda45334d802 100644 --- a/drivers/char/watchdog/pcwd_usb.c +++ b/drivers/char/watchdog/pcwd_usb.c | |||
@@ -158,7 +158,7 @@ static struct usb_driver usb_pcwd_driver = { | |||
158 | }; | 158 | }; |
159 | 159 | ||
160 | 160 | ||
161 | static void usb_pcwd_intr_done(struct urb *urb, struct pt_regs *regs) | 161 | static void usb_pcwd_intr_done(struct urb *urb) |
162 | { | 162 | { |
163 | struct usb_pcwd_private *usb_pcwd = (struct usb_pcwd_private *)urb->context; | 163 | struct usb_pcwd_private *usb_pcwd = (struct usb_pcwd_private *)urb->context; |
164 | unsigned char *data = usb_pcwd->intr_buffer; | 164 | unsigned char *data = usb_pcwd->intr_buffer; |
diff --git a/drivers/char/watchdog/s3c2410_wdt.c b/drivers/char/watchdog/s3c2410_wdt.c index b36a04ae9ab8..68b1ca976d53 100644 --- a/drivers/char/watchdog/s3c2410_wdt.c +++ b/drivers/char/watchdog/s3c2410_wdt.c | |||
@@ -336,8 +336,7 @@ static struct miscdevice s3c2410wdt_miscdev = { | |||
336 | 336 | ||
337 | /* interrupt handler code */ | 337 | /* interrupt handler code */ |
338 | 338 | ||
339 | static irqreturn_t s3c2410wdt_irq(int irqno, void *param, | 339 | static irqreturn_t s3c2410wdt_irq(int irqno, void *param) |
340 | struct pt_regs *regs) | ||
341 | { | 340 | { |
342 | printk(KERN_INFO PFX "Watchdog timer expired!\n"); | 341 | printk(KERN_INFO PFX "Watchdog timer expired!\n"); |
343 | 342 | ||
diff --git a/drivers/char/watchdog/wdt.c b/drivers/char/watchdog/wdt.c index 13f23f4a2233..517fbd8643f8 100644 --- a/drivers/char/watchdog/wdt.c +++ b/drivers/char/watchdog/wdt.c | |||
@@ -225,14 +225,13 @@ static int wdt_get_temperature(int *temperature) | |||
225 | * wdt_interrupt: | 225 | * wdt_interrupt: |
226 | * @irq: Interrupt number | 226 | * @irq: Interrupt number |
227 | * @dev_id: Unused as we don't allow multiple devices. | 227 | * @dev_id: Unused as we don't allow multiple devices. |
228 | * @regs: Unused. | ||
229 | * | 228 | * |
230 | * Handle an interrupt from the board. These are raised when the status | 229 | * Handle an interrupt from the board. These are raised when the status |
231 | * map changes in what the board considers an interesting way. That means | 230 | * map changes in what the board considers an interesting way. That means |
232 | * a failure condition occurring. | 231 | * a failure condition occurring. |
233 | */ | 232 | */ |
234 | 233 | ||
235 | static irqreturn_t wdt_interrupt(int irq, void *dev_id, struct pt_regs *regs) | 234 | static irqreturn_t wdt_interrupt(int irq, void *dev_id) |
236 | { | 235 | { |
237 | /* | 236 | /* |
238 | * Read the status register see what is up and | 237 | * Read the status register see what is up and |
diff --git a/drivers/char/watchdog/wdt285.c b/drivers/char/watchdog/wdt285.c index 89a249e23fde..e4cf661dc890 100644 --- a/drivers/char/watchdog/wdt285.c +++ b/drivers/char/watchdog/wdt285.c | |||
@@ -46,7 +46,7 @@ static unsigned long timer_alive; | |||
46 | /* | 46 | /* |
47 | * If the timer expires.. | 47 | * If the timer expires.. |
48 | */ | 48 | */ |
49 | static void watchdog_fire(int irq, void *dev_id, struct pt_regs *regs) | 49 | static void watchdog_fire(int irq, void *dev_id) |
50 | { | 50 | { |
51 | printk(KERN_CRIT "Watchdog: Would Reboot.\n"); | 51 | printk(KERN_CRIT "Watchdog: Would Reboot.\n"); |
52 | *CSR_TIMER4_CNTL = 0; | 52 | *CSR_TIMER4_CNTL = 0; |
diff --git a/drivers/char/watchdog/wdt_pci.c b/drivers/char/watchdog/wdt_pci.c index 74d8cf836e13..ce1261c5cbce 100644 --- a/drivers/char/watchdog/wdt_pci.c +++ b/drivers/char/watchdog/wdt_pci.c | |||
@@ -270,14 +270,13 @@ static int wdtpci_get_temperature(int *temperature) | |||
270 | * wdtpci_interrupt: | 270 | * wdtpci_interrupt: |
271 | * @irq: Interrupt number | 271 | * @irq: Interrupt number |
272 | * @dev_id: Unused as we don't allow multiple devices. | 272 | * @dev_id: Unused as we don't allow multiple devices. |
273 | * @regs: Unused. | ||
274 | * | 273 | * |
275 | * Handle an interrupt from the board. These are raised when the status | 274 | * Handle an interrupt from the board. These are raised when the status |
276 | * map changes in what the board considers an interesting way. That means | 275 | * map changes in what the board considers an interesting way. That means |
277 | * a failure condition occurring. | 276 | * a failure condition occurring. |
278 | */ | 277 | */ |
279 | 278 | ||
280 | static irqreturn_t wdtpci_interrupt(int irq, void *dev_id, struct pt_regs *regs) | 279 | static irqreturn_t wdtpci_interrupt(int irq, void *dev_id) |
281 | { | 280 | { |
282 | /* | 281 | /* |
283 | * Read the status register see what is up and | 282 | * Read the status register see what is up and |