diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c --- a/sys/kern/kern_intr.c +++ b/sys/kern/kern_intr.c @@ -1356,9 +1356,9 @@ * handlers as their main argument. * Return value: * o 0: everything ok. - * o EINVAL: stray interrupt. + * o non-0: stray interrupt, current count. */ -int +u_long intr_event_handle(struct intr_event *ie, struct trapframe *frame) { struct intr_handler *ih; @@ -1376,16 +1376,14 @@ /* An interrupt with no event is a stray interrupt. */ if (ie == NULL) - return (EINVAL); + return (~0UL); /* Increment the interrupt counter. */ atomic_add_long(&ie->ie_intrcnt, 1); /* An interrupt with no handlers is a stray interrupt. */ - if (CK_SLIST_EMPTY(&ie->ie_handlers)) { - atomic_add_long(&ie->ie_stray, 1); - return (EINVAL); - } + if (CK_SLIST_EMPTY(&ie->ie_handlers)) + return (atomic_fetchadd_long(&ie->ie_stray, 1) + 1); /* * Execute fast interrupt handlers directly. @@ -1486,10 +1484,8 @@ td->td_intr_nesting_level--; #ifdef notyet /* The interrupt is not aknowledged by any filter and has no ithread. */ - if (!thread && !filter) { - atomic_add_long(&ie->ie_stray, 1); - return (EINVAL); - } + if (!thread && !filter) + return (atomic_fetchadd_long(&ie->ie_stray, 1) + 1); #endif return (0); } diff --git a/sys/sys/interrupt.h b/sys/sys/interrupt.h --- a/sys/sys/interrupt.h +++ b/sys/sys/interrupt.h @@ -180,7 +180,7 @@ int intr_event_describe_handler(struct intr_event *ie, void *cookie, const char *descr); int intr_event_destroy(struct intr_event *ie); -int intr_event_handle(struct intr_event *ie, struct trapframe *frame); +u_long intr_event_handle(struct intr_event *ie, struct trapframe *frame); int intr_event_remove_handler(void *cookie); int intr_event_suspend_handler(void *cookie); int intr_event_resume_handler(void *cookie); diff --git a/sys/x86/x86/intr_machdep.c b/sys/x86/x86/intr_machdep.c --- a/sys/x86/x86/intr_machdep.c +++ b/sys/x86/x86/intr_machdep.c @@ -325,6 +325,7 @@ { struct intr_event *ie; int vector; + u_long strays; /* * We count software interrupts when we process them. The @@ -349,12 +350,12 @@ * For stray interrupts, mask and EOI the source, bump the * stray count, and log the condition. */ - if (intr_event_handle(ie, frame) != 0) { + if ((strays = intr_event_handle(ie, frame)) != 0) { isrc->is_pic->pic_disable_source(isrc, PIC_EOI); (*isrc->is_straycount)++; - if (*isrc->is_straycount < INTR_STRAY_LOG_MAX) + if (strays < INTR_STRAY_LOG_MAX) log(LOG_ERR, "stray irq%d\n", vector); - else if (*isrc->is_straycount == INTR_STRAY_LOG_MAX) + else if (strays == INTR_STRAY_LOG_MAX) log(LOG_CRIT, "too many stray irq %d's: not logging anymore\n", vector);