Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 May 2010 22:04:58 +0000 (UTC)
From:      Ryan Stone <rstone@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r207484 - head/sys/dev/hwpmc
Message-ID:  <201005012204.o41M4wZ5060669@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rstone
Date: Sat May  1 22:04:58 2010
New Revision: 207484
URL: http://svn.freebsd.org/changeset/base/207484

Log:
  When configuring a system-wide couting PMC, hwpmc was incorrectly logging process mappings for that PMC.  Nothing ever reads pmc logs out of a counting PMC, so the log buffers were leaked when the PMC was deconfigured.  The process mappings are only useful for sampling PMCs anyway, so only log the mappings if the PMC is a sampling PMC.
  
  This bug would cause allocating sample-mode PMCs to fail with ENOMEM after allocating several counting-mode PMCs.
  
  Approved by:	jkoshy (mentor)
  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	Sat May  1 22:00:28 2010	(r207483)
+++ head/sys/dev/hwpmc/hwpmc_mod.c	Sat May  1 22:04:58 2010	(r207484)
@@ -2675,16 +2675,16 @@ pmc_start(struct pmc *pm)
 			PMCDBG(PMC,OPS,1, "po=%p in global list", po);
 		}
 		po->po_sscount++;
-	}
 
-	/*
-	 * Log mapping information for all existing processes in the
-	 * system.  Subsequent mappings are logged as they happen;
-	 * see pmc_process_mmap().
-	 */
-	if (po->po_logprocmaps == 0) {
-		pmc_log_all_process_mappings(po);
-		po->po_logprocmaps = 1;
+		/*
+		 * Log mapping information for all existing processes in the
+		 * system.  Subsequent mappings are logged as they happen;
+		 * see pmc_process_mmap().
+		 */
+		if (po->po_logprocmaps == 0) {
+			pmc_log_all_process_mappings(po);
+			po->po_logprocmaps = 1;
+		}
 	}
 
 	/*



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