linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>
To: Emily Shaffer <emilyshaffer@google.com>
Cc: Viresh Kumar <viresh.kumar@linaro.org>,
	benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au,
	rjw@rjwysocki.net, linuxppc-dev@lists.ozlabs.org,
	linux-pm@vger.kernel.org, akshay.adiga@linux.vnet.ibm.com,
	ego@linux.vnet.ibm.com
Subject: Re: [PATCH] cpufreq: powernv: Use node ID in init_chip_info
Date: Thu, 20 Oct 2016 12:33:56 +0530	[thread overview]
Message-ID: <c113a5cb-6043-e1d0-ccfd-81871d65a1ab@linux.vnet.ibm.com> (raw)
In-Reply-To: <20161020035951.GH11766@vireshk-i7>

Hi,

On 10/20/2016 09:29 AM, Viresh Kumar wrote:
> + few IBM guys who have been working on this.
> 
> On 19-10-16, 15:02, Emily Shaffer wrote:
>> Fixed assumption that node_id==chip_id in powernv-cpufreq.c:init_chip_info;
>> explicitly use node ID where necessary.

Thanks for the bug fix. I agree that the node-ids should not be assumed to be
always be equal to chip-ids. But I think it would be better to get rid of
cpumask_of_node() as it has problems when the powernv-cpufreq driver is
initialized with offline cpus, like reported in the post below.
https://patchwork.kernel.org/patch/8887591/
(^^ This should also solve the node_id=chip_id problem)

Since throttle stats are common for all cpus in the chip, so we are better of
not using cpumask_of_node() instead define something like cpumask_of_chip()
where the driver doesn't have to compute chip cpumask.

Thanks and Regards,
Shilpa

>>
>> Tested: All CPUs report in /sys/devices/system/cpu*/cpufreq/throttle_stats
>>
>> Effort: platforms/arch-powerpc
>> Google-Bug-Id: 26979978
> 
> Is this relevant upstream?
> 
>>
>> Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
>> Change-Id: I22eb626b32fbb8053b3bbb9c75e677c700d0c2fb
> 
> Gerrit id isn't required for upstream..
> 
>> ---
>>  drivers/cpufreq/powernv-cpufreq.c | 27 +++++++++++++++++++++------
>>  1 file changed, 21 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/cpufreq/powernv-cpufreq.c
>> b/drivers/cpufreq/powernv-cpufreq.c
>> index d3ffde8..3750b58 100644
>> --- a/drivers/cpufreq/powernv-cpufreq.c
>> +++ b/drivers/cpufreq/powernv-cpufreq.c
>> @@ -911,32 +911,47 @@ static struct cpufreq_driver powernv_cpufreq_driver = {
>>
>>  static int init_chip_info(void)
>>  {
>> -       unsigned int chip[256];
>> +       int rc = 0;
>>         unsigned int cpu, i;
>>         unsigned int prev_chip_id = UINT_MAX;
>> +       unsigned int *chip, *node;
>> +
>> +       chip = kcalloc(num_possible_cpus(), sizeof(unsigned int), GFP_KERNEL);
>> +       node = kcalloc(num_possible_cpus(), sizeof(unsigned int), GFP_KERNEL);
>> +       if (!chip || !node) {
>> +               rc = -ENOMEM;
>> +               goto out;
>> +       }
>>
>>         for_each_possible_cpu(cpu) {
>>                 unsigned int id = cpu_to_chip_id(cpu);
>>
>>                 if (prev_chip_id != id) {
>>                         prev_chip_id = id;
>> -                       chip[nr_chips++] = id;
>> +                       node[nr_chips] = cpu_to_node(cpu);
>> +                       chip[nr_chips] = id;
>> +                       nr_chips++;
>>                 }
>>         }
>>
>>         chips = kcalloc(nr_chips, sizeof(struct chip), GFP_KERNEL);
>> -       if (!chips)
>> -               return -ENOMEM;
>> +       if (!chips) {
>> +               rc = -ENOMEM;
>> +               goto out;
>> +       }
>>
>>         for (i = 0; i < nr_chips; i++) {
>>                 chips[i].id = chip[i];
>> -               cpumask_copy(&chips[i].mask, cpumask_of_node(chip[i]));
>> +               cpumask_copy(&chips[i].mask, cpumask_of_node(node[i]));
>>                 INIT_WORK(&chips[i].throttle, powernv_cpufreq_work_fn);
>>                 for_each_cpu(cpu, &chips[i].mask)
>>                         per_cpu(chip_info, cpu) =  &chips[i];
>>         }
>>
>> -       return 0;
>> +out:
>> +       kfree(node);
>> +       kfree(chip);
>> +       return rc;
>>  }
>>
>>  static inline void clean_chip_info(void)
>> -- 
>> 2.8.0.rc3.226.g39d4020
> 

      reply	other threads:[~2016-10-20  7:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-19 22:02 [PATCH] cpufreq: powernv: Use node ID in init_chip_info Emily Shaffer
2016-10-20  3:59 ` Viresh Kumar
2016-10-20  7:03   ` Shilpasri G Bhat [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c113a5cb-6043-e1d0-ccfd-81871d65a1ab@linux.vnet.ibm.com \
    --to=shilpa.bhat@linux.vnet.ibm.com \
    --cc=akshay.adiga@linux.vnet.ibm.com \
    --cc=benh@kernel.crashing.org \
    --cc=ego@linux.vnet.ibm.com \
    --cc=emilyshaffer@google.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=paulus@samba.org \
    --cc=rjw@rjwysocki.net \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).