svn commit: r233104 - head/sys/mips/atheros

Oleksandr Tymoshenko gonzo at FreeBSD.org
Sun Mar 18 01:43:42 UTC 2012


Author: gonzo
Date: Sun Mar 18 01:43:41 2012
New Revision: 233104
URL: http://svn.freebsd.org/changeset/base/233104

Log:
  - Fix logic for detection if further processing of PMC should be performed.
      pmc_intr returns one if one of the counters actually triggered the IRQ
  - style(9) fixed

Modified:
  head/sys/mips/atheros/apb.c

Modified: head/sys/mips/atheros/apb.c
==============================================================================
--- head/sys/mips/atheros/apb.c	Sun Mar 18 00:22:29 2012	(r233103)
+++ head/sys/mips/atheros/apb.c	Sun Mar 18 01:43:41 2012	(r233104)
@@ -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),


More information about the svn-src-head mailing list