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
This commit is contained in:
Elliott Mitchell 2022-06-19 08:05:20 -07:00 committed by Mark Johnston
parent 768489c721
commit d8099e33c7
3 changed files with 8 additions and 9 deletions

View file

@ -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)

View file

@ -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;

View file

@ -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);