diff options
Diffstat (limited to 'kernel/irq/handle.c')
-rw-r--r-- | kernel/irq/handle.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c index 3aba8d12f328..759b8b04d294 100644 --- a/kernel/irq/handle.c +++ b/kernel/irq/handle.c | |||
@@ -83,19 +83,21 @@ static struct irq_desc irq_desc_init = { | |||
83 | 83 | ||
84 | void init_kstat_irqs(struct irq_desc *desc, int cpu, int nr) | 84 | void init_kstat_irqs(struct irq_desc *desc, int cpu, int nr) |
85 | { | 85 | { |
86 | unsigned long bytes; | ||
87 | char *ptr; | ||
88 | int node; | 86 | int node; |
89 | 87 | void *ptr; | |
90 | /* Compute how many bytes we need per irq and allocate them */ | ||
91 | bytes = nr * sizeof(unsigned int); | ||
92 | 88 | ||
93 | node = cpu_to_node(cpu); | 89 | node = cpu_to_node(cpu); |
94 | ptr = kzalloc_node(bytes, GFP_ATOMIC, node); | 90 | ptr = kzalloc_node(nr * sizeof(*desc->kstat_irqs), GFP_ATOMIC, node); |
95 | printk(KERN_DEBUG " alloc kstat_irqs on cpu %d node %d\n", cpu, node); | ||
96 | 91 | ||
97 | if (ptr) | 92 | /* |
98 | desc->kstat_irqs = (unsigned int *)ptr; | 93 | * don't overwite if can not get new one |
94 | * init_copy_kstat_irqs() could still use old one | ||
95 | */ | ||
96 | if (ptr) { | ||
97 | printk(KERN_DEBUG " alloc kstat_irqs on cpu %d node %d\n", | ||
98 | cpu, node); | ||
99 | desc->kstat_irqs = ptr; | ||
100 | } | ||
99 | } | 101 | } |
100 | 102 | ||
101 | static void init_one_irq_desc(int irq, struct irq_desc *desc, int cpu) | 103 | static void init_one_irq_desc(int irq, struct irq_desc *desc, int cpu) |
@@ -227,6 +229,7 @@ struct irq_desc irq_desc[NR_IRQS] __cacheline_aligned_in_smp = { | |||
227 | } | 229 | } |
228 | }; | 230 | }; |
229 | 231 | ||
232 | static unsigned int kstat_irqs_all[NR_IRQS][NR_CPUS]; | ||
230 | int __init early_irq_init(void) | 233 | int __init early_irq_init(void) |
231 | { | 234 | { |
232 | struct irq_desc *desc; | 235 | struct irq_desc *desc; |
@@ -238,8 +241,10 @@ int __init early_irq_init(void) | |||
238 | desc = irq_desc; | 241 | desc = irq_desc; |
239 | count = ARRAY_SIZE(irq_desc); | 242 | count = ARRAY_SIZE(irq_desc); |
240 | 243 | ||
241 | for (i = 0; i < count; i++) | 244 | for (i = 0; i < count; i++) { |
242 | desc[i].irq = i; | 245 | desc[i].irq = i; |
246 | desc[i].kstat_irqs = kstat_irqs_all[i]; | ||
247 | } | ||
243 | 248 | ||
244 | return arch_early_irq_init(); | 249 | return arch_early_irq_init(); |
245 | } | 250 | } |
@@ -255,6 +260,11 @@ struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu) | |||
255 | } | 260 | } |
256 | #endif /* !CONFIG_SPARSE_IRQ */ | 261 | #endif /* !CONFIG_SPARSE_IRQ */ |
257 | 262 | ||
263 | void clear_kstat_irqs(struct irq_desc *desc) | ||
264 | { | ||
265 | memset(desc->kstat_irqs, 0, nr_cpu_ids * sizeof(*(desc->kstat_irqs))); | ||
266 | } | ||
267 | |||
258 | /* | 268 | /* |
259 | * What should we do if we get a hw irq event on an illegal vector? | 269 | * What should we do if we get a hw irq event on an illegal vector? |
260 | * Each architecture has to answer this themself. | 270 | * Each architecture has to answer this themself. |
@@ -467,12 +477,10 @@ void early_init_irq_lock_class(void) | |||
467 | } | 477 | } |
468 | } | 478 | } |
469 | 479 | ||
470 | #ifdef CONFIG_SPARSE_IRQ | ||
471 | unsigned int kstat_irqs_cpu(unsigned int irq, int cpu) | 480 | unsigned int kstat_irqs_cpu(unsigned int irq, int cpu) |
472 | { | 481 | { |
473 | struct irq_desc *desc = irq_to_desc(irq); | 482 | struct irq_desc *desc = irq_to_desc(irq); |
474 | return desc ? desc->kstat_irqs[cpu] : 0; | 483 | return desc ? desc->kstat_irqs[cpu] : 0; |
475 | } | 484 | } |
476 | #endif | ||
477 | EXPORT_SYMBOL(kstat_irqs_cpu); | 485 | EXPORT_SYMBOL(kstat_irqs_cpu); |
478 | 486 | ||