From: Chanwoo Choi <cw00.choi@samsung.com>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: rjw@sisk.pl, linux-kernel@vger.kernel.org,
linux-pm@vger.kernel.org, cpufreq@vger.kernel.org,
kyungmin.park@samsung.com, myungjoo.ham@samsung.com
Subject: Re: [PATCH v3] cpufreq: stats: Add 'load_table' debugfs file to show accumulated data of CPUs
Date: Thu, 27 Jun 2013 19:32:06 +0900 [thread overview]
Message-ID: <51CC14A6.6070800@samsung.com> (raw)
In-Reply-To: <CAKohpo=oZS8U1ZZ4Kbiz2yf_LLEMTr5HsrWFt_LiBkmRqKfdvQ@mail.gmail.com>
On 06/27/2013 07:23 PM, Viresh Kumar wrote:
> On 27 June 2013 15:44, Chanwoo Choi <cw00.choi@samsung.com> wrote:
>> On 06/26/2013 05:04 PM, Viresh Kumar wrote:
>>> On 24 June 2013 14:32, Chanwoo Choi <cw00.choi@samsung.com> wrote:
>
>>> Maybe 10 to 1000.. Lets give others a chance to see long logs :)
>>>
>>
>> OK, I'll extend the maximum value from 100 to 1000.
>
> 10-1000 please.
OK.
>>>> + freq.old = freq.new = policy->cur;
>>>
>>> No need to set freq.new here.
>>
>> If cpufreq governor don't change cpu frequency on specific situation,
>> cpufreq SoC driver won't send CPUFREQ_POSTCHANGE. In case of this situation,
>> I store current cpu frequency to freq.new field.
>
> You are doing this at the time of LOADCHECK notification :)
>
> stat->load_table[last_idx].new = freq->old;
>
OK, I'll fix it.
>>>> +static ssize_t load_table_read(struct file *file, char __user *user_buf,
>>>> + size_t count, loff_t *ppos)
>>>> +{
>>>> + struct cpufreq_policy *policy = file->private_data;
>>>> + struct cpufreq_stats *stat = per_cpu(cpufreq_stats_table, policy->cpu);
>>>> + struct cpufreq_freqs *load_table = stat->load_table;
>>>> + ssize_t len = 0;
>>>> + char *buf;
>>>> + int i, cpu, ret;
>>>> +
>>>> + buf = kzalloc(MAX_LINE_SIZE * stat->load_max_index, GFP_KERNEL);
>>>> + if (!buf)
>>>> + return 0;
>>>
>>> Above use of stat->load_max_index must be inside locks I guess. Otherwise
>>> you may allocate memory for 10 lines and by the time lock is taken, we
>>> already have 12 entries. And so, below loop will go beyond array limits.
>>>
>>
>> I store CONFIG_NR_CPU_LOAD_STORAGE to stat->load_max_index in cpufreq_stats_create_debugfs()
>> So, stat->load_max_index value isn't always 10.
>>
>> If I misunderstood for your comment, I'd like you to explain more detailed about this comment.
>
> No you didn't but looking second time at the code, i couldn't find a
> problem with it.
>
> You allocate memory for max entries and so shouldn't be a problem.
>
OK,
I'll send v4 patch. Thanks.
Best Regards,
Chanwoo Choi
prev parent reply other threads:[~2013-06-27 10:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-24 9:02 [PATCH v3] cpufreq: stats: Add 'load_table' debugfs file to show accumulated data of CPUs Chanwoo Choi
2013-06-26 0:10 ` Chanwoo Choi
2013-06-26 8:04 ` Viresh Kumar
2013-06-27 10:14 ` Chanwoo Choi
2013-06-27 10:23 ` Viresh Kumar
2013-06-27 10:32 ` Chanwoo Choi [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=51CC14A6.6070800@samsung.com \
--to=cw00.choi@samsung.com \
--cc=cpufreq@vger.kernel.org \
--cc=kyungmin.park@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=myungjoo.ham@samsung.com \
--cc=rjw@sisk.pl \
--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