diff options
Diffstat (limited to 'arch/x86/kernel/irq.c')
-rw-r--r-- | arch/x86/kernel/irq.c | 88 |
1 files changed, 57 insertions, 31 deletions
diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c index f13ca1650aa..3aaf7b9e3a8 100644 --- a/arch/x86/kernel/irq.c +++ b/arch/x86/kernel/irq.c | |||
@@ -15,6 +15,9 @@ | |||
15 | 15 | ||
16 | atomic_t irq_err_count; | 16 | atomic_t irq_err_count; |
17 | 17 | ||
18 | /* Function pointer for generic interrupt vector handling */ | ||
19 | void (*generic_interrupt_extension)(void) = NULL; | ||
20 | |||
18 | /* | 21 | /* |
19 | * 'what should we do if we get a hw irq event on an illegal vector'. | 22 | * 'what should we do if we get a hw irq event on an illegal vector'. |
20 | * each architecture has to answer this themselves. | 23 | * each architecture has to answer this themselves. |
@@ -42,55 +45,60 @@ void ack_bad_irq(unsigned int irq) | |||
42 | /* | 45 | /* |
43 | * /proc/interrupts printing: | 46 | * /proc/interrupts printing: |
44 | */ | 47 | */ |
45 | static int show_other_interrupts(struct seq_file *p) | 48 | static int show_other_interrupts(struct seq_file *p, int prec) |
46 | { | 49 | { |
47 | int j; | 50 | int j; |
48 | 51 | ||
49 | seq_printf(p, "NMI: "); | 52 | seq_printf(p, "%*s: ", prec, "NMI"); |
50 | for_each_online_cpu(j) | 53 | for_each_online_cpu(j) |
51 | seq_printf(p, "%10u ", irq_stats(j)->__nmi_count); | 54 | seq_printf(p, "%10u ", irq_stats(j)->__nmi_count); |
52 | seq_printf(p, " Non-maskable interrupts\n"); | 55 | seq_printf(p, " Non-maskable interrupts\n"); |
53 | #ifdef CONFIG_X86_LOCAL_APIC | 56 | #ifdef CONFIG_X86_LOCAL_APIC |
54 | seq_printf(p, "LOC: "); | 57 | seq_printf(p, "%*s: ", prec, "LOC"); |
55 | for_each_online_cpu(j) | 58 | for_each_online_cpu(j) |
56 | seq_printf(p, "%10u ", irq_stats(j)->apic_timer_irqs); | 59 | seq_printf(p, "%10u ", irq_stats(j)->apic_timer_irqs); |
57 | seq_printf(p, " Local timer interrupts\n"); | 60 | seq_printf(p, " Local timer interrupts\n"); |
61 | |||
62 | seq_printf(p, "%*s: ", prec, "SPU"); | ||
63 | for_each_online_cpu(j) | ||
64 | seq_printf(p, "%10u ", irq_stats(j)->irq_spurious_count); | ||
65 | seq_printf(p, " Spurious interrupts\n"); | ||
58 | #endif | 66 | #endif |
67 | if (generic_interrupt_extension) { | ||
68 | seq_printf(p, "PLT: "); | ||
69 | for_each_online_cpu(j) | ||
70 | seq_printf(p, "%10u ", irq_stats(j)->generic_irqs); | ||
71 | seq_printf(p, " Platform interrupts\n"); | ||
72 | } | ||
59 | #ifdef CONFIG_SMP | 73 | #ifdef CONFIG_SMP |
60 | seq_printf(p, "RES: "); | 74 | seq_printf(p, "%*s: ", prec, "RES"); |
61 | for_each_online_cpu(j) | 75 | for_each_online_cpu(j) |
62 | seq_printf(p, "%10u ", irq_stats(j)->irq_resched_count); | 76 | seq_printf(p, "%10u ", irq_stats(j)->irq_resched_count); |
63 | seq_printf(p, " Rescheduling interrupts\n"); | 77 | seq_printf(p, " Rescheduling interrupts\n"); |
64 | seq_printf(p, "CAL: "); | 78 | seq_printf(p, "%*s: ", prec, "CAL"); |
65 | for_each_online_cpu(j) | 79 | for_each_online_cpu(j) |
66 | seq_printf(p, "%10u ", irq_stats(j)->irq_call_count); | 80 | seq_printf(p, "%10u ", irq_stats(j)->irq_call_count); |
67 | seq_printf(p, " Function call interrupts\n"); | 81 | seq_printf(p, " Function call interrupts\n"); |
68 | seq_printf(p, "TLB: "); | 82 | seq_printf(p, "%*s: ", prec, "TLB"); |
69 | for_each_online_cpu(j) | 83 | for_each_online_cpu(j) |
70 | seq_printf(p, "%10u ", irq_stats(j)->irq_tlb_count); | 84 | seq_printf(p, "%10u ", irq_stats(j)->irq_tlb_count); |
71 | seq_printf(p, " TLB shootdowns\n"); | 85 | seq_printf(p, " TLB shootdowns\n"); |
72 | #endif | 86 | #endif |
73 | #ifdef CONFIG_X86_MCE | 87 | #ifdef CONFIG_X86_MCE |
74 | seq_printf(p, "TRM: "); | 88 | seq_printf(p, "%*s: ", prec, "TRM"); |
75 | for_each_online_cpu(j) | 89 | for_each_online_cpu(j) |
76 | seq_printf(p, "%10u ", irq_stats(j)->irq_thermal_count); | 90 | seq_printf(p, "%10u ", irq_stats(j)->irq_thermal_count); |
77 | seq_printf(p, " Thermal event interrupts\n"); | 91 | seq_printf(p, " Thermal event interrupts\n"); |
78 | # ifdef CONFIG_X86_64 | 92 | # ifdef CONFIG_X86_64 |
79 | seq_printf(p, "THR: "); | 93 | seq_printf(p, "%*s: ", prec, "THR"); |
80 | for_each_online_cpu(j) | 94 | for_each_online_cpu(j) |
81 | seq_printf(p, "%10u ", irq_stats(j)->irq_threshold_count); | 95 | seq_printf(p, "%10u ", irq_stats(j)->irq_threshold_count); |
82 | seq_printf(p, " Threshold APIC interrupts\n"); | 96 | seq_printf(p, " Threshold APIC interrupts\n"); |
83 | # endif | 97 | # endif |
84 | #endif | 98 | #endif |
85 | #ifdef CONFIG_X86_LOCAL_APIC | 99 | seq_printf(p, "%*s: %10u\n", prec, "ERR", atomic_read(&irq_err_count)); |
86 | seq_printf(p, "SPU: "); | ||
87 | for_each_online_cpu(j) | ||
88 | seq_printf(p, "%10u ", irq_stats(j)->irq_spurious_count); | ||
89 | seq_printf(p, " Spurious interrupts\n"); | ||
90 | #endif | ||
91 | seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count)); | ||
92 | #if defined(CONFIG_X86_IO_APIC) | 100 | #if defined(CONFIG_X86_IO_APIC) |
93 | seq_printf(p, "MIS: %10u\n", atomic_read(&irq_mis_count)); | 101 | seq_printf(p, "%*s: %10u\n", prec, "MIS", atomic_read(&irq_mis_count)); |
94 | #endif | 102 | #endif |
95 | return 0; | 103 | return 0; |
96 | } | 104 | } |
@@ -98,19 +106,22 @@ static int show_other_interrupts(struct seq_file *p) | |||
98 | int show_interrupts(struct seq_file *p, void *v) | 106 | int show_interrupts(struct seq_file *p, void *v) |
99 | { | 107 | { |
100 | unsigned long flags, any_count = 0; | 108 | unsigned long flags, any_count = 0; |
101 | int i = *(loff_t *) v, j; | 109 | int i = *(loff_t *) v, j, prec; |
102 | struct irqaction *action; | 110 | struct irqaction *action; |
103 | struct irq_desc *desc; | 111 | struct irq_desc *desc; |
104 | 112 | ||
105 | if (i > nr_irqs) | 113 | if (i > nr_irqs) |
106 | return 0; | 114 | return 0; |
107 | 115 | ||
116 | for (prec = 3, j = 1000; prec < 10 && j <= nr_irqs; ++prec) | ||
117 | j *= 10; | ||
118 | |||
108 | if (i == nr_irqs) | 119 | if (i == nr_irqs) |
109 | return show_other_interrupts(p); | 120 | return show_other_interrupts(p, prec); |
110 | 121 | ||
111 | /* print header */ | 122 | /* print header */ |
112 | if (i == 0) { | 123 | if (i == 0) { |
113 | seq_printf(p, " "); | 124 | seq_printf(p, "%*s", prec + 8, ""); |
114 | for_each_online_cpu(j) | 125 | for_each_online_cpu(j) |
115 | seq_printf(p, "CPU%-8d", j); | 126 | seq_printf(p, "CPU%-8d", j); |
116 | seq_putc(p, '\n'); | 127 | seq_putc(p, '\n'); |
@@ -121,23 +132,15 @@ int show_interrupts(struct seq_file *p, void *v) | |||
121 | return 0; | 132 | return 0; |
122 | 133 | ||
123 | spin_lock_irqsave(&desc->lock, flags); | 134 | spin_lock_irqsave(&desc->lock, flags); |
124 | #ifndef CONFIG_SMP | ||
125 | any_count = kstat_irqs(i); | ||
126 | #else | ||
127 | for_each_online_cpu(j) | 135 | for_each_online_cpu(j) |
128 | any_count |= kstat_irqs_cpu(i, j); | 136 | any_count |= kstat_irqs_cpu(i, j); |
129 | #endif | ||
130 | action = desc->action; | 137 | action = desc->action; |
131 | if (!action && !any_count) | 138 | if (!action && !any_count) |
132 | goto out; | 139 | goto out; |
133 | 140 | ||
134 | seq_printf(p, "%3d: ", i); | 141 | seq_printf(p, "%*d: ", prec, i); |
135 | #ifndef CONFIG_SMP | ||
136 | seq_printf(p, "%10u ", kstat_irqs(i)); | ||
137 | #else | ||
138 | for_each_online_cpu(j) | 142 | for_each_online_cpu(j) |
139 | seq_printf(p, "%10u ", kstat_irqs_cpu(i, j)); | 143 | seq_printf(p, "%10u ", kstat_irqs_cpu(i, j)); |
140 | #endif | ||
141 | seq_printf(p, " %8s", desc->chip->name); | 144 | seq_printf(p, " %8s", desc->chip->name); |
142 | seq_printf(p, "-%-8s", desc->name); | 145 | seq_printf(p, "-%-8s", desc->name); |
143 | 146 | ||
@@ -162,7 +165,10 @@ u64 arch_irq_stat_cpu(unsigned int cpu) | |||
162 | 165 | ||
163 | #ifdef CONFIG_X86_LOCAL_APIC | 166 | #ifdef CONFIG_X86_LOCAL_APIC |
164 | sum += irq_stats(cpu)->apic_timer_irqs; | 167 | sum += irq_stats(cpu)->apic_timer_irqs; |
168 | sum += irq_stats(cpu)->irq_spurious_count; | ||
165 | #endif | 169 | #endif |
170 | if (generic_interrupt_extension) | ||
171 | sum += irq_stats(cpu)->generic_irqs; | ||
166 | #ifdef CONFIG_SMP | 172 | #ifdef CONFIG_SMP |
167 | sum += irq_stats(cpu)->irq_resched_count; | 173 | sum += irq_stats(cpu)->irq_resched_count; |
168 | sum += irq_stats(cpu)->irq_call_count; | 174 | sum += irq_stats(cpu)->irq_call_count; |
@@ -174,9 +180,6 @@ u64 arch_irq_stat_cpu(unsigned int cpu) | |||
174 | sum += irq_stats(cpu)->irq_threshold_count; | 180 | sum += irq_stats(cpu)->irq_threshold_count; |
175 | #endif | 181 | #endif |
176 | #endif | 182 | #endif |
177 | #ifdef CONFIG_X86_LOCAL_APIC | ||
178 | sum += irq_stats(cpu)->irq_spurious_count; | ||
179 | #endif | ||
180 | return sum; | 183 | return sum; |
181 | } | 184 | } |
182 | 185 | ||
@@ -226,4 +229,27 @@ unsigned int __irq_entry do_IRQ(struct pt_regs *regs) | |||
226 | return 1; | 229 | return 1; |
227 | } | 230 | } |
228 | 231 | ||
232 | /* | ||
233 | * Handler for GENERIC_INTERRUPT_VECTOR. | ||
234 | */ | ||
235 | void smp_generic_interrupt(struct pt_regs *regs) | ||
236 | { | ||
237 | struct pt_regs *old_regs = set_irq_regs(regs); | ||
238 | |||
239 | ack_APIC_irq(); | ||
240 | |||
241 | exit_idle(); | ||
242 | |||
243 | irq_enter(); | ||
244 | |||
245 | inc_irq_stat(generic_irqs); | ||
246 | |||
247 | if (generic_interrupt_extension) | ||
248 | generic_interrupt_extension(); | ||
249 | |||
250 | irq_exit(); | ||
251 | |||
252 | set_irq_regs(old_regs); | ||
253 | } | ||
254 | |||
229 | EXPORT_SYMBOL_GPL(vector_used_by_percpu_irq); | 255 | EXPORT_SYMBOL_GPL(vector_used_by_percpu_irq); |