Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Mar 2012 01:43:41 +0000 (UTC)
From:      Oleksandr Tymoshenko <gonzo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r233104 - head/sys/mips/atheros
Message-ID:  <201203180143.q2I1hfEh096007@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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),



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203180143.q2I1hfEh096007>