Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758239AbcCCS0n (ORCPT ); Thu, 3 Mar 2016 13:26:43 -0500 Received: from mga01.intel.com ([192.55.52.88]:5849 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758111AbcCCS0l (ORCPT ); Thu, 3 Mar 2016 13:26:41 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,532,1449561600"; d="scan'208";a="926226437" Date: Thu, 3 Mar 2016 10:26:53 -0800 (PST) From: Vikas Shivappa X-X-Sender: vikas@vshiva-Udesk To: Thomas Gleixner cc: Vikas Shivappa , vikas.shivappa@intel.com, linux-kernel@vger.kernel.org, x86@kernel.org, hpa@zytor.com, mingo@kernel.org, peterz@infradead.org, ravi.v.shankar@intel.com, tony.luck@intel.com, fenghua.yu@intel.com, h.peter.anvin@intel.com Subject: Re: [PATCH 3/6] x86/mbm: Intel Memory B/W Monitoring enumeration and init In-Reply-To: Message-ID: References: <1456876108-28770-4-git-send-email-vikas.shivappa@linux.intel.com> <1456962966-29395-1-git-send-email-vikas.shivappa@linux.intel.com> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 976 Lines: 40 On Wed, 2 Mar 2016, Thomas Gleixner wrote: > On Wed, 2 Mar 2016, Vikas Shivappa wrote: >> + if (cqm_enabled && mbm_enabled) >> + intel_cqm_events_group.attrs = intel_cmt_mbm_events_attr; >> + else if (!cqm_enabled && mbm_enabled) >> + intel_cqm_events_group.attrs = intel_mbm_events_attr; >> + else if (cqm_enabled && !mbm_enabled) >> + intel_cqm_events_group.attrs = intel_cqm_events_attr; >> + >> ret = perf_pmu_register(&intel_cqm_pmu, "intel_cqm", -1); >> if (ret) { >> pr_err("Intel CQM perf registration failed: %d\n", ret); >> goto out; > > So what cleans up mbm_local and mbm_total in that case? I put all the cleanup code in the cqm_cleanup .. - please see copy below @@ -1331,6 +1427,39 @@ static void cqm_cleanup(void) kfree(cqm_rmid_ptrs[r]); kfree(cqm_rmid_ptrs); + kfree(mbm_local); + kfree(mbm_total); + mbm_enabled = false; + cqm_enabled = false; +} Thanks, Vikas > > Thanks, > > tglx >