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/mmc | |
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/mmc')
-rw-r--r-- | drivers/mmc/at91_mci.c | 4 | ||||
-rw-r--r-- | drivers/mmc/au1xmmc.c | 2 | ||||
-rw-r--r-- | drivers/mmc/imxmmc.c | 4 | ||||
-rw-r--r-- | drivers/mmc/mmci.c | 4 | ||||
-rw-r--r-- | drivers/mmc/omap.c | 4 | ||||
-rw-r--r-- | drivers/mmc/pxamci.c | 6 | ||||
-rw-r--r-- | drivers/mmc/sdhci.c | 2 | ||||
-rw-r--r-- | drivers/mmc/wbsd.c | 2 |
8 files changed, 14 insertions, 14 deletions
diff --git a/drivers/mmc/at91_mci.c b/drivers/mmc/at91_mci.c index cb142a66098c..494b23fb0a01 100644 --- a/drivers/mmc/at91_mci.c +++ b/drivers/mmc/at91_mci.c | |||
@@ -661,7 +661,7 @@ static void at91_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
661 | /* | 661 | /* |
662 | * Handle an interrupt | 662 | * Handle an interrupt |
663 | */ | 663 | */ |
664 | static irqreturn_t at91_mci_irq(int irq, void *devid, struct pt_regs *regs) | 664 | static irqreturn_t at91_mci_irq(int irq, void *devid) |
665 | { | 665 | { |
666 | struct at91mci_host *host = devid; | 666 | struct at91mci_host *host = devid; |
667 | int completed = 0; | 667 | int completed = 0; |
@@ -754,7 +754,7 @@ static irqreturn_t at91_mci_irq(int irq, void *devid, struct pt_regs *regs) | |||
754 | return IRQ_HANDLED; | 754 | return IRQ_HANDLED; |
755 | } | 755 | } |
756 | 756 | ||
757 | static irqreturn_t at91_mmc_det_irq(int irq, void *_host, struct pt_regs *regs) | 757 | static irqreturn_t at91_mmc_det_irq(int irq, void *_host) |
758 | { | 758 | { |
759 | struct at91mci_host *host = _host; | 759 | struct at91mci_host *host = _host; |
760 | int present = !at91_get_gpio_value(irq); | 760 | int present = !at91_get_gpio_value(irq); |
diff --git a/drivers/mmc/au1xmmc.c b/drivers/mmc/au1xmmc.c index 61268da13957..53ffcbb14a97 100644 --- a/drivers/mmc/au1xmmc.c +++ b/drivers/mmc/au1xmmc.c | |||
@@ -750,7 +750,7 @@ static void au1xmmc_dma_callback(int irq, void *dev_id) | |||
750 | #define STATUS_DATA_IN (SD_STATUS_NE) | 750 | #define STATUS_DATA_IN (SD_STATUS_NE) |
751 | #define STATUS_DATA_OUT (SD_STATUS_TH) | 751 | #define STATUS_DATA_OUT (SD_STATUS_TH) |
752 | 752 | ||
753 | static irqreturn_t au1xmmc_irq(int irq, void *dev_id, struct pt_regs *regs) | 753 | static irqreturn_t au1xmmc_irq(int irq, void *dev_id) |
754 | { | 754 | { |
755 | 755 | ||
756 | u32 status; | 756 | u32 status; |
diff --git a/drivers/mmc/imxmmc.c b/drivers/mmc/imxmmc.c index 1b79dd271aae..659d4a822cc5 100644 --- a/drivers/mmc/imxmmc.c +++ b/drivers/mmc/imxmmc.c | |||
@@ -635,7 +635,7 @@ static int imxmci_cpu_driven_data(struct imxmci_host *host, unsigned int *pstat) | |||
635 | return trans_done; | 635 | return trans_done; |
636 | } | 636 | } |
637 | 637 | ||
638 | static void imxmci_dma_irq(int dma, void *devid, struct pt_regs *regs) | 638 | static void imxmci_dma_irq(int dma, void *devid) |
639 | { | 639 | { |
640 | struct imxmci_host *host = devid; | 640 | struct imxmci_host *host = devid; |
641 | uint32_t stat = MMC_STATUS; | 641 | uint32_t stat = MMC_STATUS; |
@@ -646,7 +646,7 @@ static void imxmci_dma_irq(int dma, void *devid, struct pt_regs *regs) | |||
646 | tasklet_schedule(&host->tasklet); | 646 | tasklet_schedule(&host->tasklet); |
647 | } | 647 | } |
648 | 648 | ||
649 | static irqreturn_t imxmci_irq(int irq, void *devid, struct pt_regs *regs) | 649 | static irqreturn_t imxmci_irq(int irq, void *devid) |
650 | { | 650 | { |
651 | struct imxmci_host *host = devid; | 651 | struct imxmci_host *host = devid; |
652 | uint32_t stat = MMC_STATUS; | 652 | uint32_t stat = MMC_STATUS; |
diff --git a/drivers/mmc/mmci.c b/drivers/mmc/mmci.c index 2b5a0cc9ea56..828503c4ee62 100644 --- a/drivers/mmc/mmci.c +++ b/drivers/mmc/mmci.c | |||
@@ -261,7 +261,7 @@ static int mmci_pio_write(struct mmci_host *host, char *buffer, unsigned int rem | |||
261 | /* | 261 | /* |
262 | * PIO data transfer IRQ handler. | 262 | * PIO data transfer IRQ handler. |
263 | */ | 263 | */ |
264 | static irqreturn_t mmci_pio_irq(int irq, void *dev_id, struct pt_regs *regs) | 264 | static irqreturn_t mmci_pio_irq(int irq, void *dev_id) |
265 | { | 265 | { |
266 | struct mmci_host *host = dev_id; | 266 | struct mmci_host *host = dev_id; |
267 | void __iomem *base = host->base; | 267 | void __iomem *base = host->base; |
@@ -347,7 +347,7 @@ static irqreturn_t mmci_pio_irq(int irq, void *dev_id, struct pt_regs *regs) | |||
347 | /* | 347 | /* |
348 | * Handle completion of command and data transfers. | 348 | * Handle completion of command and data transfers. |
349 | */ | 349 | */ |
350 | static irqreturn_t mmci_irq(int irq, void *dev_id, struct pt_regs *regs) | 350 | static irqreturn_t mmci_irq(int irq, void *dev_id) |
351 | { | 351 | { |
352 | struct mmci_host *host = dev_id; | 352 | struct mmci_host *host = dev_id; |
353 | u32 status; | 353 | u32 status; |
diff --git a/drivers/mmc/omap.c b/drivers/mmc/omap.c index 52c9e52e6b78..762fa2895891 100644 --- a/drivers/mmc/omap.c +++ b/drivers/mmc/omap.c | |||
@@ -377,7 +377,7 @@ static inline void mmc_omap_report_irq(u16 status) | |||
377 | } | 377 | } |
378 | } | 378 | } |
379 | 379 | ||
380 | static irqreturn_t mmc_omap_irq(int irq, void *dev_id, struct pt_regs *regs) | 380 | static irqreturn_t mmc_omap_irq(int irq, void *dev_id) |
381 | { | 381 | { |
382 | struct mmc_omap_host * host = (struct mmc_omap_host *)dev_id; | 382 | struct mmc_omap_host * host = (struct mmc_omap_host *)dev_id; |
383 | u16 status; | 383 | u16 status; |
@@ -514,7 +514,7 @@ static irqreturn_t mmc_omap_irq(int irq, void *dev_id, struct pt_regs *regs) | |||
514 | return IRQ_HANDLED; | 514 | return IRQ_HANDLED; |
515 | } | 515 | } |
516 | 516 | ||
517 | static irqreturn_t mmc_omap_switch_irq(int irq, void *dev_id, struct pt_regs *regs) | 517 | static irqreturn_t mmc_omap_switch_irq(int irq, void *dev_id) |
518 | { | 518 | { |
519 | struct mmc_omap_host *host = (struct mmc_omap_host *) dev_id; | 519 | struct mmc_omap_host *host = (struct mmc_omap_host *) dev_id; |
520 | 520 | ||
diff --git a/drivers/mmc/pxamci.c b/drivers/mmc/pxamci.c index ef350908478c..a526698b8c91 100644 --- a/drivers/mmc/pxamci.c +++ b/drivers/mmc/pxamci.c | |||
@@ -299,7 +299,7 @@ static int pxamci_data_done(struct pxamci_host *host, unsigned int stat) | |||
299 | return 1; | 299 | return 1; |
300 | } | 300 | } |
301 | 301 | ||
302 | static irqreturn_t pxamci_irq(int irq, void *devid, struct pt_regs *regs) | 302 | static irqreturn_t pxamci_irq(int irq, void *devid) |
303 | { | 303 | { |
304 | struct pxamci_host *host = devid; | 304 | struct pxamci_host *host = devid; |
305 | unsigned int ireg; | 305 | unsigned int ireg; |
@@ -399,13 +399,13 @@ static struct mmc_host_ops pxamci_ops = { | |||
399 | .set_ios = pxamci_set_ios, | 399 | .set_ios = pxamci_set_ios, |
400 | }; | 400 | }; |
401 | 401 | ||
402 | static void pxamci_dma_irq(int dma, void *devid, struct pt_regs *regs) | 402 | static void pxamci_dma_irq(int dma, void *devid) |
403 | { | 403 | { |
404 | printk(KERN_ERR "DMA%d: IRQ???\n", dma); | 404 | printk(KERN_ERR "DMA%d: IRQ???\n", dma); |
405 | DCSR(dma) = DCSR_STARTINTR|DCSR_ENDINTR|DCSR_BUSERR; | 405 | DCSR(dma) = DCSR_STARTINTR|DCSR_ENDINTR|DCSR_BUSERR; |
406 | } | 406 | } |
407 | 407 | ||
408 | static irqreturn_t pxamci_detect_irq(int irq, void *devid, struct pt_regs *regs) | 408 | static irqreturn_t pxamci_detect_irq(int irq, void *devid) |
409 | { | 409 | { |
410 | struct pxamci_host *host = mmc_priv(devid); | 410 | struct pxamci_host *host = mmc_priv(devid); |
411 | 411 | ||
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c index 20711acb0120..6d024342b2fd 100644 --- a/drivers/mmc/sdhci.c +++ b/drivers/mmc/sdhci.c | |||
@@ -985,7 +985,7 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask) | |||
985 | } | 985 | } |
986 | } | 986 | } |
987 | 987 | ||
988 | static irqreturn_t sdhci_irq(int irq, void *dev_id, struct pt_regs *regs) | 988 | static irqreturn_t sdhci_irq(int irq, void *dev_id) |
989 | { | 989 | { |
990 | irqreturn_t result; | 990 | irqreturn_t result; |
991 | struct sdhci_host* host = dev_id; | 991 | struct sdhci_host* host = dev_id; |
diff --git a/drivers/mmc/wbsd.c b/drivers/mmc/wbsd.c index 88c6f0b129f5..ced309b37a8f 100644 --- a/drivers/mmc/wbsd.c +++ b/drivers/mmc/wbsd.c | |||
@@ -1256,7 +1256,7 @@ end: | |||
1256 | * Interrupt handling | 1256 | * Interrupt handling |
1257 | */ | 1257 | */ |
1258 | 1258 | ||
1259 | static irqreturn_t wbsd_irq(int irq, void *dev_id, struct pt_regs *regs) | 1259 | static irqreturn_t wbsd_irq(int irq, void *dev_id) |
1260 | { | 1260 | { |
1261 | struct wbsd_host *host = dev_id; | 1261 | struct wbsd_host *host = dev_id; |
1262 | int isr; | 1262 | int isr; |