From: Gautham R Shenoy <ego@linux.vnet.ibm.com>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: rjw@rjwysocki.net, linaro-kernel@lists.linaro.org,
cpufreq@vger.kernel.org, linux-pm@vger.kernel.org,
linux-kernel@vger.kernel.org, srivatsa.bhat@linux.vnet.ibm.com,
ego@linux.vnet.ibm.com, svaidy@linux.vnet.ibm.com,
l.majewski@samsung.com
Subject: Re: [PATCH] cpufreq: set value of CPUFREQ_BOOST_FREQ to 0xABABABAB
Date: Mon, 24 Mar 2014 14:22:39 +0530 [thread overview]
Message-ID: <20140324085239.GA30828@in.ibm.com> (raw)
In-Reply-To: <78187ea173460c871eef31432ec2a80ec657fe30.1395643393.git.viresh.kumar@linaro.org>
On Mon, Mar 24, 2014 at 12:18:14PM +0530, Viresh Kumar wrote:
> Ideally, .driver_data field of struct cpufreq_frequency_table must not be used
> by core at all. But during a recent change if its value is same as
> CPUFREQ_BOOST_FREQ macro, then it is treated specially by core.
>
> The value of this macro was set to ~2 earlier, i.e. 0xFFFFFFFD. In case some
> driver is using this field for its own data and sets this field to -3, then with
> two's complement that value will also become 0xFFFFFFFD.
>
> To fix this issue, lets change value of this flag to a very uncommon value which
> shouldn't be used by any driver unless they want to use BOOST
> feature
>
> Along with this update comments to make this more clear.
>
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
>
> Gautham/Vaidy: I hope this fixes the problem we discussed for your
> patchset.
Since the type of .driver_data is "unsigned int", the cpufreq core
seems to be assuming that the value cannot be -ve. So, drivers should
be storing -ve values in these fields at their own risk. Because apart
from determining whether the corresponding frequency is a boost
frequency or not, the cpufreq core seems to be using the .driver_data
field in pr_debugs(). The value of .driver_data formatted as "%u" is
not useful in these pr_debugs, if the driver stores -ve value in this
field.
On the other hand, if we change the type of .driver_data to "int" then
restricting the driver to not use specific values is unreasonable
since .driver_data field is supposed to be private to the driver and
the core is not supposed to intepret it. In which case we should
be having a separate field for determining if the frequency is a BOOST
frequency or not.
So while it fixes the problem for us, I don't think this patch fixes
the problem in general for the reasons mentioned above.
--
Thanks and Regards
gautham.
>
> include/linux/cpufreq.h | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
> index c48e595..9f25d9d 100644
> --- a/include/linux/cpufreq.h
> +++ b/include/linux/cpufreq.h
> @@ -455,12 +455,18 @@ extern struct cpufreq_governor cpufreq_gov_conservative;
> * FREQUENCY TABLE HELPERS *
> *********************************************************************/
>
> +/* Special Values of .frequency field */
> #define CPUFREQ_ENTRY_INVALID ~0
> #define CPUFREQ_TABLE_END ~1
> -#define CPUFREQ_BOOST_FREQ ~2
> +/* Special Values of .driver_data field */
> +#define CPUFREQ_BOOST_FREQ 0xABABABAB
>
> struct cpufreq_frequency_table {
> - unsigned int driver_data; /* driver specific data, not used by core */
> + /*
> + * driver specific data, not used by core unless it is set to
> + * CPUFREQ_BOOST_FREQ.
> + */
> + unsigned int driver_data;
> unsigned int frequency; /* kHz - doesn't need to be in ascending
> * order */
> };
> --
> 1.7.12.rc2.18.g61b472e
>
next prev parent reply other threads:[~2014-03-24 8:52 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-24 6:48 [PATCH] cpufreq: set value of CPUFREQ_BOOST_FREQ to 0xABABABAB Viresh Kumar
2014-03-24 8:21 ` Lukasz Majewski
2014-03-24 8:33 ` Viresh Kumar
2014-03-24 8:52 ` Gautham R Shenoy [this message]
2014-03-28 8:53 ` [PATCH] cpufreq: create another field .flags in cpufreq_frequency_table Viresh Kumar
2014-03-28 10:14 ` [PATCH] cpufreq: use kzalloc() to allocate memory for cpufreq_frequency_table Viresh Kumar
2014-03-28 10:44 ` Gautham R Shenoy
2014-03-28 13:29 ` Joe Perches
2014-03-28 13:32 ` Viresh Kumar
2014-03-28 10:19 ` [PATCH] cpufreq: create another field .flags in cpufreq_frequency_table Lukasz Majewski
2014-03-28 10:33 ` Viresh Kumar
2014-03-28 10:43 ` Gautham R Shenoy
2014-03-28 8:55 ` [PATCH] cpufreq: set value of CPUFREQ_BOOST_FREQ to 0xABABABAB Viresh Kumar
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=20140324085239.GA30828@in.ibm.com \
--to=ego@linux.vnet.ibm.com \
--cc=cpufreq@vger.kernel.org \
--cc=l.majewski@samsung.com \
--cc=linaro-kernel@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--cc=srivatsa.bhat@linux.vnet.ibm.com \
--cc=svaidy@linux.vnet.ibm.com \
--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).