aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-i386
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 /include/asm-i386
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 'include/asm-i386')
-rw-r--r--include/asm-i386/apic.h4
-rw-r--r--include/asm-i386/arch_hooks.h2
-rw-r--r--include/asm-i386/floppy.h6
-rw-r--r--include/asm-i386/hpet.h2
-rw-r--r--include/asm-i386/hw_irq.h2
-rw-r--r--include/asm-i386/irq_regs.h1
-rw-r--r--include/asm-i386/mach-default/do_timer.h8
-rw-r--r--include/asm-i386/mach-visws/do_timer.h8
-rw-r--r--include/asm-i386/mach-voyager/do_timer.h6
-rw-r--r--include/asm-i386/voyager.h4
10 files changed, 22 insertions, 21 deletions
diff --git a/include/asm-i386/apic.h b/include/asm-i386/apic.h
index 3a42b7d6fc92..b9529578fc37 100644
--- a/include/asm-i386/apic.h
+++ b/include/asm-i386/apic.h
@@ -98,7 +98,7 @@ extern void sync_Arb_IDs (void);
98extern void init_bsp_APIC (void); 98extern void init_bsp_APIC (void);
99extern void setup_local_APIC (void); 99extern void setup_local_APIC (void);
100extern void init_apic_mappings (void); 100extern void init_apic_mappings (void);
101extern void smp_local_timer_interrupt (struct pt_regs * regs); 101extern void smp_local_timer_interrupt (void);
102extern void setup_boot_APIC_clock (void); 102extern void setup_boot_APIC_clock (void);
103extern void setup_secondary_APIC_clock (void); 103extern void setup_secondary_APIC_clock (void);
104extern int APIC_init_uniprocessor (void); 104extern int APIC_init_uniprocessor (void);
@@ -107,7 +107,7 @@ extern void enable_APIC_timer(void);
107 107
108extern void enable_NMI_through_LVT0 (void * dummy); 108extern void enable_NMI_through_LVT0 (void * dummy);
109 109
110void smp_send_timer_broadcast_ipi(struct pt_regs *regs); 110void smp_send_timer_broadcast_ipi(void);
111void switch_APIC_timer_to_ipi(void *cpumask); 111void switch_APIC_timer_to_ipi(void *cpumask);
112void switch_ipi_to_APIC_timer(void *cpumask); 112void switch_ipi_to_APIC_timer(void *cpumask);
113#define ARCH_APICTIMER_STOPS_ON_C3 1 113#define ARCH_APICTIMER_STOPS_ON_C3 1
diff --git a/include/asm-i386/arch_hooks.h b/include/asm-i386/arch_hooks.h
index 238cf4275b96..a8c1fca9726d 100644
--- a/include/asm-i386/arch_hooks.h
+++ b/include/asm-i386/arch_hooks.h
@@ -14,7 +14,7 @@
14extern void init_ISA_irqs(void); 14extern void init_ISA_irqs(void);
15extern void apic_intr_init(void); 15extern void apic_intr_init(void);
16extern void smp_intr_init(void); 16extern void smp_intr_init(void);
17extern irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs); 17extern irqreturn_t timer_interrupt(int irq, void *dev_id);
18 18
19/* these are the defined hooks */ 19/* these are the defined hooks */
20extern void intr_init_hook(void); 20extern void intr_init_hook(void);
diff --git a/include/asm-i386/floppy.h b/include/asm-i386/floppy.h
index 359ead60b718..44ef2f55a8e9 100644
--- a/include/asm-i386/floppy.h
+++ b/include/asm-i386/floppy.h
@@ -51,7 +51,7 @@ static char *virtual_dma_addr;
51static int virtual_dma_mode; 51static int virtual_dma_mode;
52static int doing_pdma; 52static int doing_pdma;
53 53
54static irqreturn_t floppy_hardint(int irq, void *dev_id, struct pt_regs * regs) 54static irqreturn_t floppy_hardint(int irq, void *dev_id)
55{ 55{
56 register unsigned char st; 56 register unsigned char st;
57 57
@@ -63,7 +63,7 @@ static irqreturn_t floppy_hardint(int irq, void *dev_id, struct pt_regs * regs)
63 static int dma_wait=0; 63 static int dma_wait=0;
64#endif 64#endif
65 if (!doing_pdma) 65 if (!doing_pdma)
66 return floppy_interrupt(irq, dev_id, regs); 66 return floppy_interrupt(irq, dev_id);
67 67
68#ifdef TRACE_FLPY_INT 68#ifdef TRACE_FLPY_INT
69 if(!calls) 69 if(!calls)
@@ -106,7 +106,7 @@ static irqreturn_t floppy_hardint(int irq, void *dev_id, struct pt_regs * regs)
106 dma_wait=0; 106 dma_wait=0;
107#endif 107#endif
108 doing_pdma = 0; 108 doing_pdma = 0;
109 floppy_interrupt(irq, dev_id, regs); 109 floppy_interrupt(irq, dev_id);
110 return IRQ_HANDLED; 110 return IRQ_HANDLED;
111 } 111 }
112#ifdef TRACE_FLPY_INT 112#ifdef TRACE_FLPY_INT
diff --git a/include/asm-i386/hpet.h b/include/asm-i386/hpet.h
index af5d435519d1..e47be9a56cc2 100644
--- a/include/asm-i386/hpet.h
+++ b/include/asm-i386/hpet.h
@@ -108,7 +108,7 @@ extern int hpet_set_alarm_time(unsigned char hrs, unsigned char min, unsigned ch
108extern int hpet_set_periodic_freq(unsigned long freq); 108extern int hpet_set_periodic_freq(unsigned long freq);
109extern int hpet_rtc_dropped_irq(void); 109extern int hpet_rtc_dropped_irq(void);
110extern int hpet_rtc_timer_init(void); 110extern int hpet_rtc_timer_init(void);
111extern irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id, struct pt_regs *regs); 111extern irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id);
112#endif /* CONFIG_HPET_EMULATE_RTC */ 112#endif /* CONFIG_HPET_EMULATE_RTC */
113#endif /* CONFIG_HPET_TIMER */ 113#endif /* CONFIG_HPET_TIMER */
114#endif /* _I386_HPET_H */ 114#endif /* _I386_HPET_H */
diff --git a/include/asm-i386/hw_irq.h b/include/asm-i386/hw_irq.h
index 88f02a073561..8806c7e002a7 100644
--- a/include/asm-i386/hw_irq.h
+++ b/include/asm-i386/hw_irq.h
@@ -41,7 +41,7 @@ fastcall void call_function_interrupt(void);
41fastcall void apic_timer_interrupt(void); 41fastcall void apic_timer_interrupt(void);
42fastcall void error_interrupt(void); 42fastcall void error_interrupt(void);
43fastcall void spurious_interrupt(void); 43fastcall void spurious_interrupt(void);
44fastcall void thermal_interrupt(struct pt_regs *); 44fastcall void thermal_interrupt(void);
45#define platform_legacy_irq(irq) ((irq) < 16) 45#define platform_legacy_irq(irq) ((irq) < 16)
46#endif 46#endif
47 47
diff --git a/include/asm-i386/irq_regs.h b/include/asm-i386/irq_regs.h
new file mode 100644
index 000000000000..3dd9c0b70270
--- /dev/null
+++ b/include/asm-i386/irq_regs.h
@@ -0,0 +1 @@
#include <asm-generic/irq_regs.h>
diff --git a/include/asm-i386/mach-default/do_timer.h b/include/asm-i386/mach-default/do_timer.h
index 4182c347ef85..7d606e3364ae 100644
--- a/include/asm-i386/mach-default/do_timer.h
+++ b/include/asm-i386/mach-default/do_timer.h
@@ -14,11 +14,11 @@
14 * timer interrupt as a means of triggering reschedules etc. 14 * timer interrupt as a means of triggering reschedules etc.
15 **/ 15 **/
16 16
17static inline void do_timer_interrupt_hook(struct pt_regs *regs) 17static inline void do_timer_interrupt_hook(void)
18{ 18{
19 do_timer(1); 19 do_timer(1);
20#ifndef CONFIG_SMP 20#ifndef CONFIG_SMP
21 update_process_times(user_mode_vm(regs)); 21 update_process_times(user_mode_vm(get_irq_regs()));
22#endif 22#endif
23/* 23/*
24 * In the SMP case we use the local APIC timer interrupt to do the 24 * In the SMP case we use the local APIC timer interrupt to do the
@@ -26,10 +26,10 @@ static inline void do_timer_interrupt_hook(struct pt_regs *regs)
26 * system, in that case we have to call the local interrupt handler. 26 * system, in that case we have to call the local interrupt handler.
27 */ 27 */
28#ifndef CONFIG_X86_LOCAL_APIC 28#ifndef CONFIG_X86_LOCAL_APIC
29 profile_tick(CPU_PROFILING, regs); 29 profile_tick(CPU_PROFILING);
30#else 30#else
31 if (!using_apic_timer) 31 if (!using_apic_timer)
32 smp_local_timer_interrupt(regs); 32 smp_local_timer_interrupt();
33#endif 33#endif
34} 34}
35 35
diff --git a/include/asm-i386/mach-visws/do_timer.h b/include/asm-i386/mach-visws/do_timer.h
index 8db618c5a72b..21cd696d4d0f 100644
--- a/include/asm-i386/mach-visws/do_timer.h
+++ b/include/asm-i386/mach-visws/do_timer.h
@@ -4,14 +4,14 @@
4#include <asm/i8259.h> 4#include <asm/i8259.h>
5#include "cobalt.h" 5#include "cobalt.h"
6 6
7static inline void do_timer_interrupt_hook(struct pt_regs *regs) 7static inline void do_timer_interrupt_hook(void)
8{ 8{
9 /* Clear the interrupt */ 9 /* Clear the interrupt */
10 co_cpu_write(CO_CPU_STAT,co_cpu_read(CO_CPU_STAT) & ~CO_STAT_TIMEINTR); 10 co_cpu_write(CO_CPU_STAT,co_cpu_read(CO_CPU_STAT) & ~CO_STAT_TIMEINTR);
11 11
12 do_timer(1); 12 do_timer(1);
13#ifndef CONFIG_SMP 13#ifndef CONFIG_SMP
14 update_process_times(user_mode_vm(regs)); 14 update_process_times(user_mode_vm(irq_regs));
15#endif 15#endif
16/* 16/*
17 * In the SMP case we use the local APIC timer interrupt to do the 17 * In the SMP case we use the local APIC timer interrupt to do the
@@ -19,10 +19,10 @@ static inline void do_timer_interrupt_hook(struct pt_regs *regs)
19 * system, in that case we have to call the local interrupt handler. 19 * system, in that case we have to call the local interrupt handler.
20 */ 20 */
21#ifndef CONFIG_X86_LOCAL_APIC 21#ifndef CONFIG_X86_LOCAL_APIC
22 profile_tick(CPU_PROFILING, regs); 22 profile_tick(CPU_PROFILING);
23#else 23#else
24 if (!using_apic_timer) 24 if (!using_apic_timer)
25 smp_local_timer_interrupt(regs); 25 smp_local_timer_interrupt();
26#endif 26#endif
27} 27}
28 28
diff --git a/include/asm-i386/mach-voyager/do_timer.h b/include/asm-i386/mach-voyager/do_timer.h
index 099fe9f5c1b2..04e69c104a74 100644
--- a/include/asm-i386/mach-voyager/do_timer.h
+++ b/include/asm-i386/mach-voyager/do_timer.h
@@ -1,14 +1,14 @@
1/* defines for inline arch setup functions */ 1/* defines for inline arch setup functions */
2#include <asm/voyager.h> 2#include <asm/voyager.h>
3 3
4static inline void do_timer_interrupt_hook(struct pt_regs *regs) 4static inline void do_timer_interrupt_hook(void)
5{ 5{
6 do_timer(1); 6 do_timer(1);
7#ifndef CONFIG_SMP 7#ifndef CONFIG_SMP
8 update_process_times(user_mode_vm(regs)); 8 update_process_times(user_mode_vm(irq_regs));
9#endif 9#endif
10 10
11 voyager_timer_interrupt(regs); 11 voyager_timer_interrupt();
12} 12}
13 13
14static inline int do_timer_overflow(int count) 14static inline int do_timer_overflow(int count)
diff --git a/include/asm-i386/voyager.h b/include/asm-i386/voyager.h
index aaf432dd7673..e74c54aa757f 100644
--- a/include/asm-i386/voyager.h
+++ b/include/asm-i386/voyager.h
@@ -505,8 +505,8 @@ extern int voyager_memory_detect(int region, __u32 *addr, __u32 *length);
505extern void voyager_smp_intr_init(void); 505extern void voyager_smp_intr_init(void);
506extern __u8 voyager_extended_cmos_read(__u16 cmos_address); 506extern __u8 voyager_extended_cmos_read(__u16 cmos_address);
507extern void voyager_smp_dump(void); 507extern void voyager_smp_dump(void);
508extern void voyager_timer_interrupt(struct pt_regs *regs); 508extern void voyager_timer_interrupt(void);
509extern void smp_local_timer_interrupt(struct pt_regs * regs); 509extern void smp_local_timer_interrupt(void);
510extern void voyager_power_off(void); 510extern void voyager_power_off(void);
511extern void smp_voyager_power_off(void *dummy); 511extern void smp_voyager_power_off(void *dummy);
512extern void voyager_restart(void); 512extern void voyager_restart(void);