[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.10.1602241010090.28838@vshiva-Udesk>
Date: Wed, 24 Feb 2016 10:12:06 -0800 (PST)
From: Vikas Shivappa <vikas.shivappa@...el.com>
To: Thomas Gleixner <tglx@...utronix.de>
cc: Vikas Shivappa <vikas.shivappa@...ux.intel.com>,
vikas.shivappa@...el.com, x86@...nel.org,
linux-kernel@...r.kernel.org, hpa@...or.com, mingo@...nel.org,
peterz@...radead.org, ravi.v.shankar@...el.com,
tony.luck@...el.com, fenghua.yu@...el.com,
kanaka.d.juvva@...el.com, h.peter.anvin@...el.com
Subject: Re: [PATCH 2/5] x86/mbm: Intel Memory B/W Monitoring enumeration
and init
On Wed, 24 Feb 2016, Thomas Gleixner wrote:
> On Wed, 10 Feb 2016, Vikas Shivappa wrote:ar
>> +static int intel_mbm_init(void)
>> +{
>> + int ret = 0, array_size, maxid = cqm_max_rmid + 1;
>> +
>> + mbm_socket_max = cpumask_weight(&cqm_cpumask);
>
> This should use the new topology_max_packages() function, so you can alloc
> your array correctly even if not all sockets are online/plugged yet.
Will fix. Thanks for pointing out.
>
>> + array_size = sizeof(struct sample) * maxid * mbm_socket_max;
>> + mbm_local = kmalloc(array_size, GFP_KERNEL);
>> + if (!mbm_local) {
>> + ret = -ENOMEM;
>
> return -ENOMEM is sufficient here.
Will fix
>
>> + goto out;
>> + }
>> +
>> + mbm_total = kmalloc(array_size, GFP_KERNEL);
>> + if (!mbm_total) {
>> + kfree(mbm_local);
>> + ret = -ENOMEM;
>> + }
>> +out:
>> +
>> + return ret;
>> +}
>> +
>> cqm_l3_scale = boot_cpu_data.x86_cache_occ_scale;
>> @@ -1384,14 +1520,34 @@ static int __init intel_cqm_init(void)
>>
>> __perf_cpu_notifier(intel_cqm_cpu_notifier);
>
> You really should register the notifier _AFTER_ registering the pmu. That
> needs to be fixed anyway, because the existing code leaks the notifier AND
> memory in case perf_pmu_register fails.
Correct, Will fix the notifier leak
Thanks,
Vikas
>
> Thanks,
>
> tglx
>
Powered by blists - more mailing lists