diff options
-rw-r--r-- | sys/mips/atheros/apb.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/sys/mips/atheros/apb.c b/sys/mips/atheros/apb.c index b0e5524..03eeb2f 100644 --- a/sys/mips/atheros/apb.c +++ b/sys/mips/atheros/apb.c @@ -347,6 +347,8 @@ apb_filter(void *arg) struct intr_event *event; uint32_t reg, irq; struct thread *td; + struct trapframe *tf; + register_t s; reg = ATH_READ_REG(AR71XX_MISC_INTR_STATUS); for (irq = 0; irq < APB_NIRQS; irq++) { @@ -368,18 +370,24 @@ apb_filter(void *arg) event = sc->sc_eventstab[irq]; if (!event || TAILQ_EMPTY(&event->ie_handlers)) { if (irq == APB_INTR_PMC) { - register_t s; - struct trapframe *tf = PCPU_GET(curthread)->td_intr_frame; + td = PCPU_GET(curthread); + tf = td->td_intr_frame; + s = intr_disable(); mips_intrcnt_inc(sc->sc_intr_counter[irq]); - if (pmc_intr && (*pmc_intr)(PCPU_GET(cpuid), tf)) { - intr_restore(s); - continue; + if (pmc_intr) { + /* + * Make sure at least one of counters + * generated this interrupt + */ + if (!(*pmc_intr)(PCPU_GET(cpuid), tf)) { + intr_restore(s); + continue; + } } intr_restore(s); - td = PCPU_GET(curthread); if (pmc_hook && (td->td_pflags & TDP_CALLCHAIN)) pmc_hook(PCPU_GET(curthread), |