[patch 14/14] [RFC] x86/irq: Hook up architecture specific stats

Thomas Gleixner posted 14 patches 1 month ago
[patch 14/14] [RFC] x86/irq: Hook up architecture specific stats
Posted by Thomas Gleixner 1 month ago
Enable the binary statistics interface for architecture specific
interrupts.

Signed-off-by: Thomas Gleixner <tglx@kernel.org>
---
 arch/x86/Kconfig               |    1 +
 arch/x86/include/asm/hardirq.h |    7 +++++++
 2 files changed, 8 insertions(+)

--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -177,6 +177,7 @@ config X86
 	select GENERIC_IRQ_PROBE
 	select GENERIC_IRQ_RESERVATION_MODE
 	select GENERIC_IRQ_SHOW
+	select GENERIC_IRQ_STATS_ARCH
 	select GENERIC_PENDING_IRQ		if SMP
 	select GENERIC_SMP_IDLE_THREAD
 	select GENERIC_TIME_VSYSCALL
--- a/arch/x86/include/asm/hardirq.h
+++ b/arch/x86/include/asm/hardirq.h
@@ -65,7 +65,14 @@ DECLARE_PER_CPU_SHARED_ALIGNED(irq_cpust
 #ifdef CONFIG_X86_POSTED_MSI
 DECLARE_PER_CPU_ALIGNED(struct pi_desc, posted_msi_pi_desc);
 #endif
+
 #define __ARCH_IRQ_STAT
+#define ARCH_IRQ_STATS_NUM_IRQS		IRQ_COUNT_MAX
+
+static inline unsigned int arch_get_irq_stat(unsigned int cpu, unsigned int idx)
+{
+	return data_race(per_cpu_ptr(&irq_stat, cpu)->counts[idx]);
+}
 
 #define inc_irq_stat(index)	this_cpu_inc(irq_stat.counts[IRQ_COUNT_##index])