Commit 1b437c8c authored by Brian Gerst's avatar Brian Gerst Committed by Tejun Heo

x86-64: Move irq stats from PDA to per-cpu and consolidate with 32-bit.

Signed-off-by: default avatarBrian Gerst <brgerst@gmail.com>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent 74e79045
...@@ -3,22 +3,36 @@ ...@@ -3,22 +3,36 @@
#include <linux/threads.h> #include <linux/threads.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <asm/pda.h>
#include <asm/apic.h> #include <asm/apic.h>
typedef struct {
unsigned int __softirq_pending;
unsigned int __nmi_count; /* arch dependent */
unsigned int apic_timer_irqs; /* arch dependent */
unsigned int irq0_irqs;
unsigned int irq_resched_count;
unsigned int irq_call_count;
unsigned int irq_tlb_count;
unsigned int irq_thermal_count;
unsigned int irq_spurious_count;
unsigned int irq_threshold_count;
} ____cacheline_aligned irq_cpustat_t;
DECLARE_PER_CPU(irq_cpustat_t, irq_stat);
/* We can have at most NR_VECTORS irqs routed to a cpu at a time */ /* We can have at most NR_VECTORS irqs routed to a cpu at a time */
#define MAX_HARDIRQS_PER_CPU NR_VECTORS #define MAX_HARDIRQS_PER_CPU NR_VECTORS
#define __ARCH_IRQ_STAT 1 #define __ARCH_IRQ_STAT 1
#define inc_irq_stat(member) add_pda(member, 1) #define inc_irq_stat(member) percpu_add(irq_stat.member, 1)
#define local_softirq_pending() read_pda(__softirq_pending) #define local_softirq_pending() percpu_read(irq_stat.__softirq_pending)
#define __ARCH_SET_SOFTIRQ_PENDING 1 #define __ARCH_SET_SOFTIRQ_PENDING 1
#define set_softirq_pending(x) write_pda(__softirq_pending, (x)) #define set_softirq_pending(x) percpu_write(irq_stat.__softirq_pending, (x))
#define or_softirq_pending(x) or_pda(__softirq_pending, (x)) #define or_softirq_pending(x) percpu_or(irq_stat.__softirq_pending, (x))
extern void ack_bad_irq(unsigned int irq); extern void ack_bad_irq(unsigned int irq);
......
...@@ -25,19 +25,9 @@ struct x8664_pda { ...@@ -25,19 +25,9 @@ struct x8664_pda {
char *irqstackptr; char *irqstackptr;
short nodenumber; /* number of current node (32k max) */ short nodenumber; /* number of current node (32k max) */
short in_bootmem; /* pda lives in bootmem */ short in_bootmem; /* pda lives in bootmem */
unsigned int __softirq_pending;
unsigned int __nmi_count; /* number of NMI on this CPUs */
short mmu_state; short mmu_state;
short isidle; short isidle;
struct mm_struct *active_mm; struct mm_struct *active_mm;
unsigned apic_timer_irqs;
unsigned irq0_irqs;
unsigned irq_resched_count;
unsigned irq_call_count;
unsigned irq_tlb_count;
unsigned irq_thermal_count;
unsigned irq_threshold_count;
unsigned irq_spurious_count;
} ____cacheline_aligned_in_smp; } ____cacheline_aligned_in_smp;
DECLARE_PER_CPU(struct x8664_pda, __pda); DECLARE_PER_CPU(struct x8664_pda, __pda);
......
...@@ -36,11 +36,7 @@ void ack_bad_irq(unsigned int irq) ...@@ -36,11 +36,7 @@ void ack_bad_irq(unsigned int irq)
#endif #endif
} }
#ifdef CONFIG_X86_32 #define irq_stats(x) (&per_cpu(irq_stat, x))
# define irq_stats(x) (&per_cpu(irq_stat, x))
#else
# define irq_stats(x) cpu_pda(x)
#endif
/* /*
* /proc/interrupts printing: * /proc/interrupts printing:
*/ */
......
...@@ -19,6 +19,9 @@ ...@@ -19,6 +19,9 @@
#include <asm/io_apic.h> #include <asm/io_apic.h>
#include <asm/idle.h> #include <asm/idle.h>
DEFINE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat);
EXPORT_PER_CPU_SYMBOL(irq_stat);
/* /*
* Probabilistic stack overflow check: * Probabilistic stack overflow check:
* *
......
...@@ -61,11 +61,7 @@ static int endflag __initdata; ...@@ -61,11 +61,7 @@ static int endflag __initdata;
static inline unsigned int get_nmi_count(int cpu) static inline unsigned int get_nmi_count(int cpu)
{ {
#ifdef CONFIG_X86_64 return per_cpu(irq_stat, cpu).__nmi_count;
return cpu_pda(cpu)->__nmi_count;
#else
return nmi_count(cpu);
#endif
} }
static inline int mce_in_progress(void) static inline int mce_in_progress(void)
...@@ -82,12 +78,8 @@ static inline int mce_in_progress(void) ...@@ -82,12 +78,8 @@ static inline int mce_in_progress(void)
*/ */
static inline unsigned int get_timer_irqs(int cpu) static inline unsigned int get_timer_irqs(int cpu)
{ {
#ifdef CONFIG_X86_64
return read_pda(apic_timer_irqs) + read_pda(irq0_irqs);
#else
return per_cpu(irq_stat, cpu).apic_timer_irqs + return per_cpu(irq_stat, cpu).apic_timer_irqs +
per_cpu(irq_stat, cpu).irq0_irqs; per_cpu(irq_stat, cpu).irq0_irqs;
#endif
} }
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
......
...@@ -50,11 +50,7 @@ static irqreturn_t xen_call_function_single_interrupt(int irq, void *dev_id); ...@@ -50,11 +50,7 @@ static irqreturn_t xen_call_function_single_interrupt(int irq, void *dev_id);
*/ */
static irqreturn_t xen_reschedule_interrupt(int irq, void *dev_id) static irqreturn_t xen_reschedule_interrupt(int irq, void *dev_id)
{ {
#ifdef CONFIG_X86_32 inc_irq_stat(irq_resched_count);
__get_cpu_var(irq_stat).irq_resched_count++;
#else
add_pda(irq_resched_count, 1);
#endif
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -435,11 +431,7 @@ static irqreturn_t xen_call_function_interrupt(int irq, void *dev_id) ...@@ -435,11 +431,7 @@ static irqreturn_t xen_call_function_interrupt(int irq, void *dev_id)
{ {
irq_enter(); irq_enter();
generic_smp_call_function_interrupt(); generic_smp_call_function_interrupt();
#ifdef CONFIG_X86_32 inc_irq_stat(irq_call_count);
__get_cpu_var(irq_stat).irq_call_count++;
#else
add_pda(irq_call_count, 1);
#endif
irq_exit(); irq_exit();
return IRQ_HANDLED; return IRQ_HANDLED;
...@@ -449,11 +441,7 @@ static irqreturn_t xen_call_function_single_interrupt(int irq, void *dev_id) ...@@ -449,11 +441,7 @@ static irqreturn_t xen_call_function_single_interrupt(int irq, void *dev_id)
{ {
irq_enter(); irq_enter();
generic_smp_call_function_single_interrupt(); generic_smp_call_function_single_interrupt();
#ifdef CONFIG_X86_32 inc_irq_stat(irq_call_count);
__get_cpu_var(irq_stat).irq_call_count++;
#else
add_pda(irq_call_count, 1);
#endif
irq_exit(); irq_exit();
return IRQ_HANDLED; return IRQ_HANDLED;
......
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