Skip to contentSkip to conversation

interrupt: debug for discovering frequent interrupts

PATCH New Zhang Xincheng 1 participant 1 message Oct 11, 2022 IRQ

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 interrupt: debug for discovering frequent interrupts

In some cases, a peripheral's interrupt will be triggered frequently, which will keep the CPU processing the interrupt and eventually cause the RCU to report rcu_sched self-detected stall on the CPU. This patch provides a way to discover and report which outage is causing the problem.

---
 include/linux/irqdesc.h |   5 ++
 kernel/irq/Kconfig      |  25 +++++++++
 kernel/irq/spurious.c   | 121 +++++++++++++++++++++++++++++++++++++---
 3 files changed, 144 insertions(+), 7 deletions(-)
include/linux/irqdesc.h +5 -0
index 1cd4e36890fb..f82b138c68d6 100644
@@ -102,6 +102,11 @@ struct irq_desc {
 	int			parent_irq;
 	struct module		*owner;
 	const char		*name;
+#ifdef CONFIG_FREQUENT_IRQ_DEBUG
+	bool have_reported;
+	u32 gap_count;
+	u64 gap_time;
+#endif
 } ____cacheline_internodealigned_in_smp;
 
 #ifdef CONFIG_SPARSE_IRQ
kernel/irq/Kconfig +25 -0
index db3d174c53d4..0b666ef51a08 100644
@@ -137,6 +137,31 @@ config GENERIC_IRQ_DEBUGFS
 
 	  If you don't know what to do here, say N.
 
+config FREQUENT_IRQ_DEBUG
+	bool "Support for finding and reporting frequent interrupt"
+	default n
+	help
+
+	  This is a mechanism to detect and report that interrupts
+	  are triggered too frequently.
+
+config COUNT_PER_SECOND
+	int "Interrupt limit per second"
+	depends on FREQUENT_IRQ_DEBUG
+	default "2000"
+	help
+
+	  This is the limit on the number of interrupts triggered per second.
+	  (Max 65535)
+config DURATION_LIMIT
+	int "Duration limit"
+	depends on FREQUENT_IRQ_DEBUG
+	default "30"
+	help
+
+	  The number of interruptions per second exceeds the duration limit of
+	  the limit. (Max 65535)
+
 endmenu
 
 config GENERIC_IRQ_MULTI_HANDLER
kernel/irq/spurious.c +114 -7

167 lines not on this page · raw message

Signature · 1 line
2.20.1