diff options
Diffstat (limited to 'kernel/irq/handle.c')
-rw-r--r-- | kernel/irq/handle.c | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c index f51eaee921b..9ebf7796887 100644 --- a/kernel/irq/handle.c +++ b/kernel/irq/handle.c | |||
@@ -82,19 +82,21 @@ static struct irq_desc irq_desc_init = { | |||
82 | 82 | ||
83 | void init_kstat_irqs(struct irq_desc *desc, int cpu, int nr) | 83 | void init_kstat_irqs(struct irq_desc *desc, int cpu, int nr) |
84 | { | 84 | { |
85 | unsigned long bytes; | ||
86 | char *ptr; | ||
87 | int node; | 85 | int node; |
88 | 86 | void *ptr; | |
89 | /* Compute how many bytes we need per irq and allocate them */ | ||
90 | bytes = nr * sizeof(unsigned int); | ||
91 | 87 | ||
92 | node = cpu_to_node(cpu); | 88 | node = cpu_to_node(cpu); |
93 | ptr = kzalloc_node(bytes, GFP_ATOMIC, node); | 89 | ptr = kzalloc_node(nr * sizeof(*desc->kstat_irqs), GFP_ATOMIC, node); |
94 | printk(KERN_DEBUG " alloc kstat_irqs on cpu %d node %d\n", cpu, node); | ||
95 | 90 | ||
96 | if (ptr) | 91 | /* |
97 | desc->kstat_irqs = (unsigned int *)ptr; | 92 | * don't overwite if can not get new one |
93 | * init_copy_kstat_irqs() could still use old one | ||
94 | */ | ||
95 | if (ptr) { | ||
96 | printk(KERN_DEBUG " alloc kstat_irqs on cpu %d node %d\n", | ||
97 | cpu, node); | ||
98 | desc->kstat_irqs = ptr; | ||
99 | } | ||
98 | } | 100 | } |
99 | 101 | ||
100 | static void init_one_irq_desc(int irq, struct irq_desc *desc, int cpu) | 102 | static void init_one_irq_desc(int irq, struct irq_desc *desc, int cpu) |
@@ -237,6 +239,7 @@ struct irq_desc irq_desc[NR_IRQS] __cacheline_aligned_in_smp = { | |||
237 | } | 239 | } |
238 | }; | 240 | }; |
239 | 241 | ||
242 | static unsigned int kstat_irqs_all[NR_IRQS][NR_CPUS]; | ||
240 | int __init early_irq_init(void) | 243 | int __init early_irq_init(void) |
241 | { | 244 | { |
242 | struct irq_desc *desc; | 245 | struct irq_desc *desc; |
@@ -253,6 +256,7 @@ int __init early_irq_init(void) | |||
253 | for (i = 0; i < count; i++) { | 256 | for (i = 0; i < count; i++) { |
254 | desc[i].irq = i; | 257 | desc[i].irq = i; |
255 | init_alloc_desc_masks(&desc[i], 0, true); | 258 | init_alloc_desc_masks(&desc[i], 0, true); |
259 | desc[i].kstat_irqs = kstat_irqs_all[i]; | ||
256 | } | 260 | } |
257 | return arch_early_irq_init(); | 261 | return arch_early_irq_init(); |
258 | } | 262 | } |
@@ -268,6 +272,11 @@ struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu) | |||
268 | } | 272 | } |
269 | #endif /* !CONFIG_SPARSE_IRQ */ | 273 | #endif /* !CONFIG_SPARSE_IRQ */ |
270 | 274 | ||
275 | void clear_kstat_irqs(struct irq_desc *desc) | ||
276 | { | ||
277 | memset(desc->kstat_irqs, 0, nr_cpu_ids * sizeof(*(desc->kstat_irqs))); | ||
278 | } | ||
279 | |||
271 | /* | 280 | /* |
272 | * What should we do if we get a hw irq event on an illegal vector? | 281 | * What should we do if we get a hw irq event on an illegal vector? |
273 | * Each architecture has to answer this themself. | 282 | * Each architecture has to answer this themself. |
@@ -341,6 +350,8 @@ irqreturn_t handle_IRQ_event(unsigned int irq, struct irqaction *action) | |||
341 | irqreturn_t ret, retval = IRQ_NONE; | 350 | irqreturn_t ret, retval = IRQ_NONE; |
342 | unsigned int status = 0; | 351 | unsigned int status = 0; |
343 | 352 | ||
353 | WARN_ONCE(!in_irq(), "BUG: IRQ handler called from non-hardirq context!"); | ||
354 | |||
344 | if (!(action->flags & IRQF_DISABLED)) | 355 | if (!(action->flags & IRQF_DISABLED)) |
345 | local_irq_enable_in_hardirq(); | 356 | local_irq_enable_in_hardirq(); |
346 | 357 | ||
@@ -360,6 +371,11 @@ irqreturn_t handle_IRQ_event(unsigned int irq, struct irqaction *action) | |||
360 | } | 371 | } |
361 | 372 | ||
362 | #ifndef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ | 373 | #ifndef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ |
374 | |||
375 | #ifdef CONFIG_ENABLE_WARN_DEPRECATED | ||
376 | # warning __do_IRQ is deprecated. Please convert to proper flow handlers | ||
377 | #endif | ||
378 | |||
363 | /** | 379 | /** |
364 | * __do_IRQ - original all in one highlevel IRQ handler | 380 | * __do_IRQ - original all in one highlevel IRQ handler |
365 | * @irq: the interrupt number | 381 | * @irq: the interrupt number |
@@ -480,12 +496,10 @@ void early_init_irq_lock_class(void) | |||
480 | } | 496 | } |
481 | } | 497 | } |
482 | 498 | ||
483 | #ifdef CONFIG_SPARSE_IRQ | ||
484 | unsigned int kstat_irqs_cpu(unsigned int irq, int cpu) | 499 | unsigned int kstat_irqs_cpu(unsigned int irq, int cpu) |
485 | { | 500 | { |
486 | struct irq_desc *desc = irq_to_desc(irq); | 501 | struct irq_desc *desc = irq_to_desc(irq); |
487 | return desc ? desc->kstat_irqs[cpu] : 0; | 502 | return desc ? desc->kstat_irqs[cpu] : 0; |
488 | } | 503 | } |
489 | #endif | ||
490 | EXPORT_SYMBOL(kstat_irqs_cpu); | 504 | EXPORT_SYMBOL(kstat_irqs_cpu); |
491 | 505 | ||