public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/3] cpufreq: add sysfs knob for toggling core performance boost
@ 2010-03-03 20:59 Mark Langsdorf
  2010-03-04 21:27 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Langsdorf @ 2010-03-03 20:59 UTC (permalink / raw)
  To: linux-kernel, cpufreq, bhavna.sarathy, joachim.deguara,
	borislav.petkov

>From 1ba7af20a37b72a4375d3e3ddd33a033f204ee21 Mon Sep 17 00:00:00 2001
From: Mark Langsdorf <mark.langsdorf@amd.com>
Date: Wed, 3 Mar 2010 14:34:47 -0600
Subject: [PATCH 2/2] cpufreq: add sysfs knob for toggling core performance boost

Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
Tested-by: Mark Langsdorf <mark.langsdorf@amd.com>
---
 drivers/cpufreq/cpufreq.c |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 67bc2ec..e0fe93f 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -662,6 +662,30 @@ static ssize_t show_bios_limit(struct cpufreq_policy *policy, char *buf)
 	return sprintf(buf, "%u\n", policy->cpuinfo.max_freq);
 }
 
+static ssize_t store_cpb(struct cpufreq_policy *policy, const char *buf,
+				 size_t count)
+{
+	int ret = -EINVAL;
+	unsigned long val = 0;
+
+	ret = strict_strtoul(buf, 10, &val);
+	if (!ret && (val == 0 || val == 1))
+		policy->flags.cpb = val;
+	else
+		return -EINVAL;
+
+	ret = __cpufreq_driver_target(policy, policy->cur, CPUFREQ_RELATION_H);
+	if (ret)
+		return -EINVAL;
+
+	return count;
+}
+
+static ssize_t show_cpb(struct cpufreq_policy *policy, char *buf)
+{
+	return sprintf(buf, "%u\n", policy->flags.cpb);
+}
+
 #define define_one_ro(_name) \
 static struct freq_attr _name = \
 __ATTR(_name, 0444, show_##_name, NULL)
@@ -688,6 +712,7 @@ define_one_rw(scaling_min_freq);
 define_one_rw(scaling_max_freq);
 define_one_rw(scaling_governor);
 define_one_rw(scaling_setspeed);
+define_one_rw(cpb);
 
 static struct attribute *default_attrs[] = {
 	&cpuinfo_min_freq.attr,
@@ -701,6 +726,7 @@ static struct attribute *default_attrs[] = {
 	&scaling_driver.attr,
 	&scaling_available_governors.attr,
 	&scaling_setspeed.attr,
+	&cpb.attr,
 	NULL
 };
 
-- 
1.6.0.2



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 3/3] cpufreq: add sysfs knob for toggling core performance boost
  2010-03-03 20:59 [PATCH 3/3] cpufreq: add sysfs knob for toggling core performance boost Mark Langsdorf
@ 2010-03-04 21:27 ` Andrew Morton
  2010-03-04 21:49   ` Borislav Petkov
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2010-03-04 21:27 UTC (permalink / raw)
  To: Mark Langsdorf
  Cc: linux-kernel, cpufreq, bhavna.sarathy, joachim.deguara,
	borislav.petkov

On Wed, 3 Mar 2010 14:59:27 -0600
Mark Langsdorf <mark.langsdorf@amd.com> wrote:

> >From 1ba7af20a37b72a4375d3e3ddd33a033f204ee21 Mon Sep 17 00:00:00 2001
> From: Mark Langsdorf <mark.langsdorf@amd.com>
> Date: Wed, 3 Mar 2010 14:34:47 -0600
> Subject: [PATCH 2/2] cpufreq: add sysfs knob for toggling core performance boost
> 
> Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
> Tested-by: Mark Langsdorf <mark.langsdorf@amd.com>

The lack of any changelog in a patch is usually a good sign that the
patch needs a changelog :(

> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 67bc2ec..e0fe93f 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -662,6 +662,30 @@ static ssize_t show_bios_limit(struct cpufreq_policy *policy, char *buf)
>  	return sprintf(buf, "%u\n", policy->cpuinfo.max_freq);
>  }
>  
> +static ssize_t store_cpb(struct cpufreq_policy *policy, const char *buf,
> +				 size_t count)
> +{
> +	int ret = -EINVAL;
> +	unsigned long val = 0;
> +
> +	ret = strict_strtoul(buf, 10, &val);
> +	if (!ret && (val == 0 || val == 1))
> +		policy->flags.cpb = val;
> +	else
> +		return -EINVAL;
> +
> +	ret = __cpufreq_driver_target(policy, policy->cur, CPUFREQ_RELATION_H);
> +	if (ret)
> +		return -EINVAL;
> +
> +	return count;
> +}
> +
> +static ssize_t show_cpb(struct cpufreq_policy *policy, char *buf)
> +{
> +	return sprintf(buf, "%u\n", policy->flags.cpb);
> +}
> +
>  #define define_one_ro(_name) \
>  static struct freq_attr _name = \
>  __ATTR(_name, 0444, show_##_name, NULL)
> @@ -688,6 +712,7 @@ define_one_rw(scaling_min_freq);
>  define_one_rw(scaling_max_freq);
>  define_one_rw(scaling_governor);
>  define_one_rw(scaling_setspeed);
> +define_one_rw(cpb);
>  
>  static struct attribute *default_attrs[] = {
>  	&cpuinfo_min_freq.attr,
> @@ -701,6 +726,7 @@ static struct attribute *default_attrs[] = {
>  	&scaling_driver.attr,
>  	&scaling_available_governors.attr,
>  	&scaling_setspeed.attr,
> +	&cpb.attr,
>  	NULL
>  };

Well I've read the code and I've read the code comments and I've read
the changelogs and I still have no clue what this thing does. 
Apparently it allows me to toggle something called "APERF/MPERF".  I
guess if I were patient enough, teh goog might tell me what that is,
and why I might want it.  But this is all terribly inefficient.

I think you'd find that your feature is more useful and will be used by
more people if you tell them (and us) what it does.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 3/3] cpufreq: add sysfs knob for toggling core performance boost
  2010-03-04 21:27 ` Andrew Morton
@ 2010-03-04 21:49   ` Borislav Petkov
  0 siblings, 0 replies; 3+ messages in thread
From: Borislav Petkov @ 2010-03-04 21:49 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Mark Langsdorf, linux-kernel, cpufreq, bhavna.sarathy,
	joachim.deguara

From: Andrew Morton <akpm@linux-foundation.org>
Date: Thu, Mar 04, 2010 at 01:27:43PM -0800

> The lack of any changelog in a patch is usually a good sign that the
> patch needs a changelog :(

See my earlier mail.

[..]

> Well I've read the code and I've read the code comments and I've read
> the changelogs and I still have no clue what this thing does. 
> Apparently it allows me to toggle something called "APERF/MPERF".  I
> guess if I were patient enough, teh goog might tell me what that is,
> and why I might want it.  But this is all terribly inefficient.
> 
> I think you'd find that your feature is more useful and will be used by
> more people if you tell them (and us) what it does.

Basically, this is a knob for toggling of a core boosting feature
we have in Fam10h, rev.E CPUs. I'll have a proper changelog with a
hopefully understandable explanation soon :).

Thanks.

-- 
Regards/Gruss,
Boris.

-
Advanced Micro Devices, Inc.
Operating Systems Research Center


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-03-04 21:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-03 20:59 [PATCH 3/3] cpufreq: add sysfs knob for toggling core performance boost Mark Langsdorf
2010-03-04 21:27 ` Andrew Morton
2010-03-04 21:49   ` Borislav Petkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox