From owner-svn-src-all@FreeBSD.ORG Tue Apr 30 08:33:38 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D7D4A54A; Tue, 30 Apr 2013 08:33:38 +0000 (UTC) (envelope-from davide@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CA0DB12DF; Tue, 30 Apr 2013 08:33:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r3U8XchP036502; Tue, 30 Apr 2013 08:33:38 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r3U8XcHB036501; Tue, 30 Apr 2013 08:33:38 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201304300833.r3U8XcHB036501@svn.freebsd.org> From: Davide Italiano Date: Tue, 30 Apr 2013 08:33:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r250097 - head/sys/dev/hwpmc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Apr 2013 08:33:38 -0000 Author: davide Date: Tue Apr 30 08:33:38 2013 New Revision: 250097 URL: http://svnweb.freebsd.org/changeset/base/250097 Log: When hwpmc(4) module is unloaded it reports a double leakage. This happens at least if FreeBSD is ran under VirtualBox. In order to avoid the leakage, properly deallocate structures in case CPU claims that hw performance monitoring counters are not supported. Reported by: hiren Modified: head/sys/dev/hwpmc/hwpmc_intel.c Modified: head/sys/dev/hwpmc/hwpmc_intel.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_intel.c Tue Apr 30 08:18:08 2013 (r250096) +++ head/sys/dev/hwpmc/hwpmc_intel.c Tue Apr 30 08:33:38 2013 (r250097) @@ -87,7 +87,7 @@ pmc_intel_initialize(void) cputype = -1; nclasses = 2; - + error = 0; model = ((cpu_id & 0xF0000) >> 12) | ((cpu_id & 0xF0) >> 4); switch (cpu_id & 0xF00) { @@ -192,10 +192,6 @@ pmc_intel_initialize(void) ncpus = pmc_cpu_max(); - error = pmc_tsc_initialize(pmc_mdep, ncpus); - if (error) - goto error; - switch (cputype) { #if defined(__i386__) || defined(__amd64__) /* @@ -271,10 +267,10 @@ pmc_intel_initialize(void) break; } #endif - + error = pmc_tsc_initialize(pmc_mdep, ncpus); error: if (error) { - free(pmc_mdep, M_PMC); + pmc_mdep_free(pmc_mdep); pmc_mdep = NULL; }