Commit 8c464a4b authored by Yinghai Lu's avatar Yinghai Lu Committed by Ingo Molnar

sparseirq: move kstat_irqs from kstat to irq_desc - fix

fix non-sparseirq architectures.
Signed-off-by: default avatarYinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent e492c5ae
...@@ -161,8 +161,6 @@ struct irq_desc { ...@@ -161,8 +161,6 @@ struct irq_desc {
#endif #endif
#ifdef CONFIG_HAVE_DYN_ARRAY #ifdef CONFIG_HAVE_DYN_ARRAY
unsigned int *kstat_irqs; unsigned int *kstat_irqs;
#else
unsigned int kstat_irqs[NR_CPUS];
#endif #endif
#if defined(CONFIG_INTR_REMAP) && defined(CONFIG_HAVE_SPARSE_IRQ) #if defined(CONFIG_INTR_REMAP) && defined(CONFIG_HAVE_SPARSE_IRQ)
struct irq_2_iommu *irq_2_iommu; struct irq_2_iommu *irq_2_iommu;
...@@ -219,8 +217,10 @@ extern struct irq_desc *sparse_irqs; ...@@ -219,8 +217,10 @@ extern struct irq_desc *sparse_irqs;
#endif #endif
#ifdef CONFIG_HAVE_DYN_ARRAY
#define kstat_irqs_this_cpu(DESC) \ #define kstat_irqs_this_cpu(DESC) \
((DESC)->kstat_irqs[smp_processor_id()]) ((DESC)->kstat_irqs[smp_processor_id()])
#endif
/* /*
* Migration helpers for obsolete names, they will go away: * Migration helpers for obsolete names, they will go away:
......
...@@ -28,7 +28,7 @@ struct cpu_usage_stat { ...@@ -28,7 +28,7 @@ struct cpu_usage_stat {
struct kernel_stat { struct kernel_stat {
struct cpu_usage_stat cpustat; struct cpu_usage_stat cpustat;
#ifndef CONFIG_GENERIC_HARDIRQS #ifndef CONFIG_HAVE_DYN_ARRAY
unsigned int irqs[NR_IRQS]; unsigned int irqs[NR_IRQS];
#endif #endif
}; };
...@@ -41,7 +41,13 @@ DECLARE_PER_CPU(struct kernel_stat, kstat); ...@@ -41,7 +41,13 @@ DECLARE_PER_CPU(struct kernel_stat, kstat);
extern unsigned long long nr_context_switches(void); extern unsigned long long nr_context_switches(void);
#ifndef CONFIG_GENERIC_HARDIRQS #ifndef CONFIG_HAVE_DYN_ARRAY
#define kstat_irqs_this_cpu(irq) \
(kstat_this_cpu.irqs[irq])
#endif
#ifndef CONFIG_HAVE_DYN_ARRAY
static inline unsigned int kstat_irqs_cpu(unsigned int irq, int cpu) static inline unsigned int kstat_irqs_cpu(unsigned int irq, int cpu)
{ {
return kstat_cpu(cpu).irqs[irq]; return kstat_cpu(cpu).irqs[irq];
......
...@@ -327,7 +327,11 @@ handle_simple_irq(unsigned int irq, struct irq_desc *desc) ...@@ -327,7 +327,11 @@ handle_simple_irq(unsigned int irq, struct irq_desc *desc)
if (unlikely(desc->status & IRQ_INPROGRESS)) if (unlikely(desc->status & IRQ_INPROGRESS))
goto out_unlock; goto out_unlock;
desc->status &= ~(IRQ_REPLAY | IRQ_WAITING); desc->status &= ~(IRQ_REPLAY | IRQ_WAITING);
#ifdef CONFIG_HAVE_DYN_ARRAY
kstat_irqs_this_cpu(desc)++; kstat_irqs_this_cpu(desc)++;
#else
kstat_irqs_this_cpu(irq)++;
#endif
action = desc->action; action = desc->action;
if (unlikely(!action || (desc->status & IRQ_DISABLED))) if (unlikely(!action || (desc->status & IRQ_DISABLED)))
...@@ -368,7 +372,11 @@ handle_level_irq(unsigned int irq, struct irq_desc *desc) ...@@ -368,7 +372,11 @@ handle_level_irq(unsigned int irq, struct irq_desc *desc)
if (unlikely(desc->status & IRQ_INPROGRESS)) if (unlikely(desc->status & IRQ_INPROGRESS))
goto out_unlock; goto out_unlock;
desc->status &= ~(IRQ_REPLAY | IRQ_WAITING); desc->status &= ~(IRQ_REPLAY | IRQ_WAITING);
#ifdef CONFIG_HAVE_DYN_ARRAY
kstat_irqs_this_cpu(desc)++; kstat_irqs_this_cpu(desc)++;
#else
kstat_irqs_this_cpu(irq)++;
#endif
/* /*
* If its disabled or no action available * If its disabled or no action available
...@@ -415,7 +423,11 @@ handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc) ...@@ -415,7 +423,11 @@ handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc)
goto out; goto out;
desc->status &= ~(IRQ_REPLAY | IRQ_WAITING); desc->status &= ~(IRQ_REPLAY | IRQ_WAITING);
#ifdef CONFIG_HAVE_DYN_ARRAY
kstat_irqs_this_cpu(desc)++; kstat_irqs_this_cpu(desc)++;
#else
kstat_irqs_this_cpu(irq)++;
#endif
/* /*
* If its disabled or no action available * If its disabled or no action available
...@@ -479,8 +491,11 @@ handle_edge_irq(unsigned int irq, struct irq_desc *desc) ...@@ -479,8 +491,11 @@ handle_edge_irq(unsigned int irq, struct irq_desc *desc)
mask_ack_irq(desc, irq); mask_ack_irq(desc, irq);
goto out_unlock; goto out_unlock;
} }
#ifdef CONFIG_HAVE_DYN_ARRAY
kstat_irqs_this_cpu(desc)++; kstat_irqs_this_cpu(desc)++;
#else
kstat_irqs_this_cpu(irq)++;
#endif
/* Start handling the irq */ /* Start handling the irq */
desc->chip->ack(irq); desc->chip->ack(irq);
...@@ -535,7 +550,11 @@ handle_percpu_irq(unsigned int irq, struct irq_desc *desc) ...@@ -535,7 +550,11 @@ handle_percpu_irq(unsigned int irq, struct irq_desc *desc)
{ {
irqreturn_t action_ret; irqreturn_t action_ret;
#ifdef CONFIG_HAVE_DYN_ARRAY
kstat_irqs_this_cpu(desc)++; kstat_irqs_this_cpu(desc)++;
#else
kstat_irqs_this_cpu(irq)++;
#endif
if (desc->chip->ack) if (desc->chip->ack)
desc->chip->ack(irq); desc->chip->ack(irq);
......
...@@ -34,7 +34,11 @@ void ...@@ -34,7 +34,11 @@ void
handle_bad_irq(unsigned int irq, struct irq_desc *desc) handle_bad_irq(unsigned int irq, struct irq_desc *desc)
{ {
print_irq_desc(irq, desc); print_irq_desc(irq, desc);
#ifdef CONFIG_HAVE_DYN_ARRAY
kstat_irqs_this_cpu(desc)++; kstat_irqs_this_cpu(desc)++;
#else
kstat_irqs_this_cpu(irq)++;
#endif
ack_bad_irq(irq); ack_bad_irq(irq);
} }
...@@ -401,7 +405,11 @@ unsigned int __do_IRQ(unsigned int irq) ...@@ -401,7 +405,11 @@ unsigned int __do_IRQ(unsigned int irq)
struct irqaction *action; struct irqaction *action;
unsigned int status; unsigned int status;
#ifdef CONFIG_HAVE_DYN_ARRAY
kstat_irqs_this_cpu(desc)++; kstat_irqs_this_cpu(desc)++;
#else
kstat_irqs_this_cpu(irq)++;
#endif
if (CHECK_IRQ_PER_CPU(desc->status)) { if (CHECK_IRQ_PER_CPU(desc->status)) {
irqreturn_t action_ret; irqreturn_t action_ret;
...@@ -501,10 +509,12 @@ void early_init_irq_lock_class(void) ...@@ -501,10 +509,12 @@ void early_init_irq_lock_class(void)
} }
#endif #endif
#ifdef CONFIG_HAVE_DYN_ARRAY
unsigned int kstat_irqs_cpu(unsigned int irq, int cpu) unsigned int kstat_irqs_cpu(unsigned int irq, int cpu)
{ {
struct irq_desc *desc = irq_to_desc(irq); struct irq_desc *desc = irq_to_desc(irq);
return desc->kstat_irqs[cpu]; return desc->kstat_irqs[cpu];
} }
#endif
EXPORT_SYMBOL(kstat_irqs_cpu); EXPORT_SYMBOL(kstat_irqs_cpu);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment