Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1347120
| From | Vikas Shivappa <vikas.shivappa@linux.intel.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 2/6] x86,perf/cqm: Fix cqm memory leak and notifier leak |
| Date | 2016-03-02 00:50 +0100 |
| Message-ID | <r82de-7Iy-35@gated-at.bofh.it> (permalink) |
| References | <r82dc-7Iy-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Fixes the hotcpu notifier leak and a memory leak during cqm(cache
quality of service monitoring) initialization.
Reviewed-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Vikas Shivappa <vikas.shivappa@linux.intel.com>
---
arch/x86/kernel/cpu/perf_event_intel_cqm.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/arch/x86/kernel/cpu/perf_event_intel_cqm.c b/arch/x86/kernel/cpu/perf_event_intel_cqm.c
index e6be335..5666171 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_cqm.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_cqm.c
@@ -1322,7 +1322,7 @@ static const struct x86_cpu_id intel_cqm_match[] = {
static int __init intel_cqm_init(void)
{
- char *str, scale[20];
+ char *str = NULL, scale[20];
int i, cpu, ret;
if (!x86_match_cpu(intel_cqm_match))
@@ -1382,16 +1382,23 @@ static int __init intel_cqm_init(void)
cqm_pick_event_reader(i);
}
- __perf_cpu_notifier(intel_cqm_cpu_notifier);
-
ret = perf_pmu_register(&intel_cqm_pmu, "intel_cqm", -1);
- if (ret)
+ if (ret) {
pr_err("Intel CQM perf registration failed: %d\n", ret);
- else
+ goto out;
+ } else {
pr_info("Intel CQM monitoring enabled\n");
+ }
+ /*
+ * Register the hot cpu notifier once we are sure cqm
+ * is enabled to avoid notifier leak.
+ */
+ __perf_cpu_notifier(intel_cqm_cpu_notifier);
out:
cpu_notifier_register_done();
+ if (ret)
+ kfree(str);
return ret;
}
--
1.9.1
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH V5 0/6] Intel memory b/w monitoring support Vikas Shivappa <vikas.shivappa@linux.intel.com> - 2016-03-02 00:50 +0100
[PATCH 4/6] x86/mbm: Memory bandwidth monitoring event management Vikas Shivappa <vikas.shivappa@linux.intel.com> - 2016-03-02 00:50 +0100
[PATCH 5/6] x86/mbm: RMID Recycling MBM changes Vikas Shivappa <vikas.shivappa@linux.intel.com> - 2016-03-02 00:50 +0100
[PATCH 6/6] x86/mbm: Add support for MBM counter overflow handling Vikas Shivappa <vikas.shivappa@linux.intel.com> - 2016-03-02 00:50 +0100
Re: [PATCH 6/6] x86/mbm: Add support for MBM counter overflow handling Vikas Shivappa <vikas.shivappa@linux.intel.com> - 2016-03-03 01:00 +0100
[PATCH 1/6] x86,perf/cqm: Fix cqm handling of grouping events into a cache_group Vikas Shivappa <vikas.shivappa@linux.intel.com> - 2016-03-02 00:50 +0100
[PATCH 2/6] x86,perf/cqm: Fix cqm memory leak and notifier leak Vikas Shivappa <vikas.shivappa@linux.intel.com> - 2016-03-02 00:50 +0100
Re: [PATCH 2/6] x86,perf/cqm: Fix cqm memory leak and notifier leak Thomas Gleixner <tglx@linutronix.de> - 2016-03-02 09:10 +0100
Re: [PATCH 2/6] x86,perf/cqm: Fix cqm memory leak and notifier leak Vikas Shivappa <vikas.shivappa@intel.com> - 2016-03-02 19:00 +0100
Re: [PATCH 2/6] x86,perf/cqm: Fix cqm memory leak and notifier leak Vikas Shivappa <vikas.shivappa@linux.intel.com> - 2016-03-03 01:00 +0100
csiph-web