Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Nov 2016 11:12:45 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r308480 - head/sys/dev/hwpmc
Message-ID:  <201611101112.uAABCjJt010277@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avg
Date: Thu Nov 10 11:12:45 2016
New Revision: 308480
URL: https://svnweb.freebsd.org/changeset/base/308480

Log:
  pmc_process_csw_out: ignore deleted counters
  
  I see the fllowing panic on AMD when exiting pmcstat:
  
  panic: [pmc,1473] pp_pmcval outside of expected range cpu=2 ri=17
  pp_pmcval=fffffffffa529f5b pm_reloadcount=10000
  
  It seems that at least on AMD a performance counter keeps counting after
  overflowing.  When pmcstat exits it sets counters that it used to
  PMC_STATE_DELETED and waits until their use count goes to zero.
  amd_intr() wouldn't reload a counter in that state and, thus, a counter
  would be allowed to overflow.  That means that the counter's value would
  be allowed to go outside the expected range.
  
  MFC after:	2 weeks

Modified:
  head/sys/dev/hwpmc/hwpmc_mod.c

Modified: head/sys/dev/hwpmc/hwpmc_mod.c
==============================================================================
--- head/sys/dev/hwpmc/hwpmc_mod.c	Thu Nov 10 10:45:12 2016	(r308479)
+++ head/sys/dev/hwpmc/hwpmc_mod.c	Thu Nov 10 11:12:45 2016	(r308480)
@@ -1431,8 +1431,8 @@ pmc_process_csw_out(struct thread *td)
 		 * save the reading.
 		 */
 
-		if (pp != NULL && pp->pp_pmcs[ri].pp_pmc != NULL) {
-
+		if (pm->pm_state != PMC_STATE_DELETED && pp != NULL &&
+		    pp->pp_pmcs[ri].pp_pmc != NULL) {
 			KASSERT(pm == pp->pp_pmcs[ri].pp_pmc,
 			    ("[pmc,%d] pm %p != pp_pmcs[%d] %p", __LINE__,
 				pm, ri, pp->pp_pmcs[ri].pp_pmc));



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