svn commit: r308480 - head/sys/dev/hwpmc

Andriy Gapon avg at FreeBSD.org
Thu Nov 10 11:12:46 UTC 2016


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));


More information about the svn-src-head mailing list