diff --git a/sys/kern/subr_intr.c b/sys/kern/subr_intr.c --- a/sys/kern/subr_intr.c +++ b/sys/kern/subr_intr.c @@ -173,10 +173,8 @@ mtx_init(&isrc_table_lock, "intr isrc table", NULL, MTX_DEF); /* - * - 2 counters for each I/O interrupt. * - MAXCPU counters for each IPI counters for SMP. */ - intrcnt_count = intr_nirq * 2; #ifdef SMP intrcnt_count += INTR_IPI_COUNT * MAXCPU; #endif @@ -198,93 +196,6 @@ INTRNAME_LEN - 1, name); } -/* - * Update name for interrupt source with interrupt event. - */ -static void -intrcnt_updatename(struct intr_irqsrc *isrc) -{ - - /* QQQ: What about stray counter name? */ - mtx_assert(&isrc_table_lock, MA_OWNED); - intrcnt_setname(isrc->isrc_event->ie_fullname, isrc->isrc_index); -} - -/* - * Virtualization for interrupt source interrupt counter increment. - */ -static inline void -isrc_increment_count(struct intr_irqsrc *isrc) -{ - - if (isrc->isrc_flags & INTR_ISRCF_PPI) - atomic_add_long(&isrc->isrc_count[0], 1); - else - isrc->isrc_count[0]++; -} - -/* - * Virtualization for interrupt source interrupt stray counter increment. - */ -static inline void -isrc_increment_straycount(struct intr_irqsrc *isrc) -{ - - isrc->isrc_count[1]++; -} - -/* - * Virtualization for interrupt source interrupt name update. - */ -static void -isrc_update_name(struct intr_irqsrc *isrc, const char *name) -{ - char str[INTRNAME_LEN]; - - mtx_assert(&isrc_table_lock, MA_OWNED); - - if (name != NULL) { - snprintf(str, INTRNAME_LEN, "%s: %s", isrc->isrc_name, name); - intrcnt_setname(str, isrc->isrc_index); - snprintf(str, INTRNAME_LEN, "stray %s: %s", isrc->isrc_name, - name); - intrcnt_setname(str, isrc->isrc_index + 1); - } else { - snprintf(str, INTRNAME_LEN, "%s:", isrc->isrc_name); - intrcnt_setname(str, isrc->isrc_index); - snprintf(str, INTRNAME_LEN, "stray %s:", isrc->isrc_name); - intrcnt_setname(str, isrc->isrc_index + 1); - } -} - -/* - * Virtualization for interrupt source interrupt counters setup. - */ -static void -isrc_setup_counters(struct intr_irqsrc *isrc) -{ - u_int index; - - /* - * XXX - it does not work well with removable controllers and - * interrupt sources !!! - */ - index = intrcnt_count - 2; - isrc->isrc_index = index; - isrc->isrc_count = &intrcnt[index]; - isrc_update_name(isrc, NULL); -} - -/* - * Virtualization for interrupt source interrupt counters release. - */ -static void -isrc_release_counters(struct intr_irqsrc *isrc) -{ - - panic("%s: not implemented", __func__); -} - #ifdef SMP /* * Virtualization for interrupt source IPI counters setup. @@ -368,8 +279,6 @@ KASSERT(isrc != NULL, ("%s: no source", __func__)); - isrc_increment_count(isrc); - #ifdef INTR_SOLO if (isrc->isrc_filter != NULL) { int error; @@ -384,7 +293,6 @@ return (0); } - isrc_increment_straycount(isrc); return (EINVAL); } @@ -480,19 +388,8 @@ mtx_lock(&isrc_table_lock); error = isrc_alloc_irq(isrc); - if (error != 0) { - mtx_unlock(&isrc_table_lock); - return (error); - } - /* - * Setup interrupt counters, but not for IPI sources. Those are setup - * later and only for used ones (up to INTR_IPI_COUNT) to not exhaust - * our counter pool. - */ - if ((isrc->isrc_flags & INTR_ISRCF_IPI) == 0) - isrc_setup_counters(isrc); mtx_unlock(&isrc_table_lock); - return (0); + return (error); } /* @@ -504,8 +401,6 @@ int error; mtx_lock(&isrc_table_lock); - if ((isrc->isrc_flags & INTR_ISRCF_IPI) == 0) - isrc_release_counters(isrc); error = isrc_free_irq(isrc); mtx_unlock(&isrc_table_lock); return (error); @@ -709,15 +604,8 @@ return (error); } - error = intr_event_add_handler(isrc->isrc_event, name, filter, handler, - arg, intr_priority(flags), flags, cookiep); - if (error == 0) { - mtx_lock(&isrc_table_lock); - intrcnt_updatename(isrc); - mtx_unlock(&isrc_table_lock); - } - - return (error); + return (intr_event_add_handler(isrc->isrc_event, name, filter, handler, + arg, intr_priority(flags), flags, cookiep)); } /* @@ -1147,7 +1035,6 @@ if (isrc->isrc_handlers == 0) PIC_DISABLE_INTR(isrc->isrc_dev, isrc); PIC_TEARDOWN_INTR(isrc->isrc_dev, isrc, res, data); - intrcnt_updatename(isrc); mtx_unlock(&isrc_table_lock); } return (error); @@ -1157,7 +1044,6 @@ intr_describe_irq(device_t dev, struct resource *res, void *cookie, const char *descr) { - int error; struct intr_irqsrc *isrc; u_int res_id; @@ -1179,13 +1065,7 @@ return (0); } #endif - error = intr_event_describe_handler(isrc->isrc_event, cookie, descr); - if (error == 0) { - mtx_lock(&isrc_table_lock); - intrcnt_updatename(isrc); - mtx_unlock(&isrc_table_lock); - } - return (error); + return (intr_event_describe_handler(isrc->isrc_event, cookie, descr)); } #ifdef SMP diff --git a/sys/sys/intr.h b/sys/sys/intr.h --- a/sys/sys/intr.h +++ b/sys/sys/intr.h @@ -86,8 +86,6 @@ u_int isrc_flags; char isrc_name[INTR_ISRC_NAMELEN]; cpuset_t isrc_cpu; /* on which CPUs is enabled */ - u_int isrc_index; - u_long * isrc_count; u_int isrc_handlers; struct intr_event * isrc_event; #ifdef INTR_SOLO