git: d8099e33c79b - main - intr: move MAX_STRAY_LOG to interrupt.h
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 17 Aug 2023 22:11:30 UTC
The branch main has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=d8099e33c79b98666232c73d9ceee62fff853fad
commit d8099e33c79b98666232c73d9ceee62fff853fad
Author: Elliott Mitchell <ehem+freebsd@m5p.com>
AuthorDate: 2022-06-19 15:05:20 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2023-08-17 22:10:02 +0000
intr: move MAX_STRAY_LOG to interrupt.h
The two interrupt controllers which implement squelching of reports
after a maximum use the same limit. Move the limit to interrupt.h, the
better to encourage other interrupt controllers to implement the same.
Reviewed by: markj
MFC after: 2 weks
Differential Revision: https://reviews.freebsd.org/D35527
---
sys/powerpc/powerpc/intr_machdep.c | 8 +++-----
sys/sys/interrupt.h | 3 +++
sys/x86/x86/intr_machdep.c | 6 ++----
3 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/sys/powerpc/powerpc/intr_machdep.c b/sys/powerpc/powerpc/intr_machdep.c
index 605f436804d4..d64d15775ab5 100644
--- a/sys/powerpc/powerpc/intr_machdep.c
+++ b/sys/powerpc/powerpc/intr_machdep.c
@@ -87,8 +87,6 @@
#include "pic_if.h"
-#define MAX_STRAY_LOG 5
-
static MALLOC_DEFINE(M_INTR, "intr", "interrupt handler data");
struct powerpc_intr {
@@ -660,11 +658,11 @@ powerpc_dispatch_intr(u_int vector, struct trapframe *tf)
stray:
stray_count++;
- if (stray_count <= MAX_STRAY_LOG) {
+ if (stray_count <= INTR_STRAY_LOG_MAX) {
printf("stray irq %d\n", i ? i->irq : -1);
- if (stray_count >= MAX_STRAY_LOG) {
+ if (stray_count >= INTR_STRAY_LOG_MAX) {
printf("got %d stray interrupts, not logging anymore\n",
- MAX_STRAY_LOG);
+ INTR_STRAY_LOG_MAX);
}
}
if (i != NULL)
diff --git a/sys/sys/interrupt.h b/sys/sys/interrupt.h
index 9eeda4a3ed16..9fa0adf9139f 100644
--- a/sys/sys/interrupt.h
+++ b/sys/sys/interrupt.h
@@ -148,6 +148,9 @@ struct intr_event {
#define SWI_TQ 6
#define SWI_TQ_GIANT 6
+/* Maximum number of stray interrupts to log */
+#define INTR_STRAY_LOG_MAX 5
+
struct proc;
extern struct intr_event *clk_intr_event;
diff --git a/sys/x86/x86/intr_machdep.c b/sys/x86/x86/intr_machdep.c
index e53d86a8cef8..4a1bc942234a 100644
--- a/sys/x86/x86/intr_machdep.c
+++ b/sys/x86/x86/intr_machdep.c
@@ -72,8 +72,6 @@
#include <vm/vm.h>
-#define MAX_STRAY_LOG 5
-
typedef void (*mask_fn)(void *);
static int intrcnt_index;
@@ -355,9 +353,9 @@ intr_execute_handlers(struct intsrc *isrc, struct trapframe *frame)
if (intr_event_handle(ie, frame) != 0) {
isrc->is_pic->pic_disable_source(isrc, PIC_EOI);
(*isrc->is_straycount)++;
- if (*isrc->is_straycount < MAX_STRAY_LOG)
+ if (*isrc->is_straycount < INTR_STRAY_LOG_MAX)
log(LOG_ERR, "stray irq%d\n", vector);
- else if (*isrc->is_straycount == MAX_STRAY_LOG)
+ else if (*isrc->is_straycount == INTR_STRAY_LOG_MAX)
log(LOG_CRIT,
"too many stray irq %d's: not logging anymore\n",
vector);