2023-09-28 09:33:04

by Viresh Kumar

[permalink] [raw]
Subject: Re: [Patch v2 1/2] cpufreq: tegra194: save CPU data to avoid repeated SMP calls

On 01-09-23, 22:11, Sumit Gupta wrote:
> @@ -131,19 +132,10 @@ static int tegra234_get_cpu_ndiv(u32 cpu, u32 cpuid, u32 clusterid, u64 *ndiv)
> static void tegra234_set_cpu_ndiv(struct cpufreq_policy *policy, u64 ndiv)
> {

> + for_each_cpu_and(cpu, policy->cpus, cpu_online_mask)

(Yes this is existing code, but ..) you don't need to perform AND with
cpu_online_mask as policy->cpus should only contain currently online CPUs.

Please check if you ever see it differently.

> + data->cpu_data = devm_kcalloc(&pdev->dev, data->soc->num_clusters *
> + data->soc->maxcpus_per_cluster,
> + sizeof(struct tegra_cpu_data), GFP_KERNEL);

This should be: sizeof(*data->cpu_data) instead. Didn't checkpatch complain
about it ?

--
viresh


2023-09-29 17:36:49

by Sumit Gupta

[permalink] [raw]
Subject: Re: [Patch v2 1/2] cpufreq: tegra194: save CPU data to avoid repeated SMP calls



On 28/09/23 12:35, Viresh Kumar wrote:
> External email: Use caution opening links or attachments
>
>
> On 01-09-23, 22:11, Sumit Gupta wrote:
>> @@ -131,19 +132,10 @@ static int tegra234_get_cpu_ndiv(u32 cpu, u32 cpuid, u32 clusterid, u64 *ndiv)
>> static void tegra234_set_cpu_ndiv(struct cpufreq_policy *policy, u64 ndiv)
>> {
>
>> + for_each_cpu_and(cpu, policy->cpus, cpu_online_mask)
>
> (Yes this is existing code, but ..) you don't need to perform AND with
> cpu_online_mask as policy->cpus should only contain currently online CPUs.
>
> Please check if you ever see it differently.
>

I think this was kept to be safe.
Should I removed the AND in v3 or send separate patch?

>> + data->cpu_data = devm_kcalloc(&pdev->dev, data->soc->num_clusters *
>> + data->soc->maxcpus_per_cluster,
>> + sizeof(struct tegra_cpu_data), GFP_KERNEL);
>
> This should be: sizeof(*data->cpu_data) instead. Didn't checkpatch complain
> about it ?
>
> --
> viresh

Checkpatch didn't highlight it.
Will do the change in v3.

Thank you,
Sumit Gupta

2023-10-03 05:01:17

by Viresh Kumar

[permalink] [raw]
Subject: Re: [Patch v2 1/2] cpufreq: tegra194: save CPU data to avoid repeated SMP calls

On 29-09-23, 19:47, Sumit Gupta wrote:
>
>
> On 28/09/23 12:35, Viresh Kumar wrote:
> > External email: Use caution opening links or attachments
> >
> >
> > On 01-09-23, 22:11, Sumit Gupta wrote:
> > > @@ -131,19 +132,10 @@ static int tegra234_get_cpu_ndiv(u32 cpu, u32 cpuid, u32 clusterid, u64 *ndiv)
> > > static void tegra234_set_cpu_ndiv(struct cpufreq_policy *policy, u64 ndiv)
> > > {
> >
> > > + for_each_cpu_and(cpu, policy->cpus, cpu_online_mask)
> >
> > (Yes this is existing code, but ..) you don't need to perform AND with
> > cpu_online_mask as policy->cpus should only contain currently online CPUs.
> >
> > Please check if you ever see it differently.
> >
>
> I think this was kept to be safe.
> Should I removed the AND in v3 or send separate patch?

Sending it separately would be ideal.

--
viresh

2023-10-04 14:12:13

by Sumit Gupta

[permalink] [raw]
Subject: Re: [Patch v2 1/2] cpufreq: tegra194: save CPU data to avoid repeated SMP calls



On 03/10/23 10:30, Viresh Kumar wrote:
> External email: Use caution opening links or attachments
>
>
> On 29-09-23, 19:47, Sumit Gupta wrote:
>>
>>
>> On 28/09/23 12:35, Viresh Kumar wrote:
>>> External email: Use caution opening links or attachments
>>>
>>>
>>> On 01-09-23, 22:11, Sumit Gupta wrote:
>>>> @@ -131,19 +132,10 @@ static int tegra234_get_cpu_ndiv(u32 cpu, u32 cpuid, u32 clusterid, u64 *ndiv)
>>>> static void tegra234_set_cpu_ndiv(struct cpufreq_policy *policy, u64 ndiv)
>>>> {
>>>
>>>> + for_each_cpu_and(cpu, policy->cpus, cpu_online_mask)
>>>
>>> (Yes this is existing code, but ..) you don't need to perform AND with
>>> cpu_online_mask as policy->cpus should only contain currently online CPUs.
>>>
>>> Please check if you ever see it differently.
>>>
>>
>> I think this was kept to be safe.
>> Should I removed the AND in v3 or send separate patch?
>
> Sending it separately would be ideal.
>
> --
> viresh

Sent v3 with the "sizeof(*data->cpu_data)" change.
Will send a separate patch with change to remove AND with mask as suggested.

Thank you,
Sumit Gupta