* [PATCH 0/2] sysfs additions for intel_pstate
@ 2015-01-28 23:03 Kristen Carlson Accardi
2015-01-28 23:03 ` [PATCH 1/2] intel_pstate: expose turbo range to sysfs Kristen Carlson Accardi
2015-01-28 23:03 ` [PATCH 2/2] intel_pstate: Add num_pstates " Kristen Carlson Accardi
0 siblings, 2 replies; 3+ messages in thread
From: Kristen Carlson Accardi @ 2015-01-28 23:03 UTC (permalink / raw)
To: rjw; +Cc: srinivas.pandruvada, linux-pm
Add sysfs interface to expose hardware turbo information to user space.
Kristen Carlson Accardi (2):
intel_pstate: expose turbo range to sysfs
intel_pstate: Add num_pstates to sysfs
Documentation/cpu-freq/intel-pstate.txt | 8 ++++++++
drivers/cpufreq/intel_pstate.c | 31 +++++++++++++++++++++++++++++++
2 files changed, 39 insertions(+)
--
1.9.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] intel_pstate: expose turbo range to sysfs
2015-01-28 23:03 [PATCH 0/2] sysfs additions for intel_pstate Kristen Carlson Accardi
@ 2015-01-28 23:03 ` Kristen Carlson Accardi
2015-01-28 23:03 ` [PATCH 2/2] intel_pstate: Add num_pstates " Kristen Carlson Accardi
1 sibling, 0 replies; 3+ messages in thread
From: Kristen Carlson Accardi @ 2015-01-28 23:03 UTC (permalink / raw)
To: rjw; +Cc: srinivas.pandruvada, linux-pm
This patch adds "turbo_pct" to the intel_pstate sysfs interface.
turbo_pct will display the percentage of the total supported
pstates that are in the turbo range. This value is independent
of whether turbo has been disabled or not.
Signed-off-by: Kristen Carlson Accardi <kristen@linux.intel.com>
---
Documentation/cpu-freq/intel-pstate.txt | 4 ++++
drivers/cpufreq/intel_pstate.c | 18 ++++++++++++++++++
2 files changed, 22 insertions(+)
diff --git a/Documentation/cpu-freq/intel-pstate.txt b/Documentation/cpu-freq/intel-pstate.txt
index 765d7fc..7767ce6 100644
--- a/Documentation/cpu-freq/intel-pstate.txt
+++ b/Documentation/cpu-freq/intel-pstate.txt
@@ -37,6 +37,10 @@ controlling P state selection. These files have been added to
no_turbo: limits the driver to selecting P states below the turbo
frequency range.
+ turbo_pct: displays the percentage of the total performance that
+ is supported by hardware that is in the turbo range. This number
+ is independent of whether turbo has been disabled or not.
+
For contemporary Intel processors, the frequency is controlled by the
processor itself and the P-states exposed to software are related to
performance levels. The idea that frequency can be set to a single
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 742eefb..f558c2e 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -338,6 +338,22 @@ static void __init intel_pstate_debug_expose_params(void)
return sprintf(buf, "%u\n", limits.object); \
}
+static ssize_t show_turbo_pct(struct kobject *kobj,
+ struct attribute *attr, char *buf)
+{
+ struct cpudata *cpu;
+ int total, no_turbo, turbo_pct;
+ uint32_t turbo_fp;
+
+ cpu = all_cpu_data[0];
+
+ total = cpu->pstate.turbo_pstate - cpu->pstate.min_pstate + 1;
+ no_turbo = cpu->pstate.max_pstate - cpu->pstate.min_pstate + 1;
+ turbo_fp = div_fp(int_tofp(no_turbo), int_tofp(total));
+ turbo_pct = 100 - fp_toint(mul_fp(turbo_fp, int_tofp(100)));
+ return sprintf(buf, "%u\n", turbo_pct);
+}
+
static ssize_t show_no_turbo(struct kobject *kobj,
struct attribute *attr, char *buf)
{
@@ -418,11 +434,13 @@ show_one(min_perf_pct, min_perf_pct);
define_one_global_rw(no_turbo);
define_one_global_rw(max_perf_pct);
define_one_global_rw(min_perf_pct);
+define_one_global_ro(turbo_pct);
static struct attribute *intel_pstate_attributes[] = {
&no_turbo.attr,
&max_perf_pct.attr,
&min_perf_pct.attr,
+ &turbo_pct.attr,
NULL
};
--
1.9.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] intel_pstate: Add num_pstates to sysfs
2015-01-28 23:03 [PATCH 0/2] sysfs additions for intel_pstate Kristen Carlson Accardi
2015-01-28 23:03 ` [PATCH 1/2] intel_pstate: expose turbo range to sysfs Kristen Carlson Accardi
@ 2015-01-28 23:03 ` Kristen Carlson Accardi
1 sibling, 0 replies; 3+ messages in thread
From: Kristen Carlson Accardi @ 2015-01-28 23:03 UTC (permalink / raw)
To: rjw; +Cc: srinivas.pandruvada, linux-pm
Add a sysfs interface to display the total number of supported
pstates. This value is independent of whether turbo has been
enabled or disabled.
Signed-off-by: Kristen Carlson Accardi <kristen@linux.intel.com>
---
Documentation/cpu-freq/intel-pstate.txt | 4 ++++
drivers/cpufreq/intel_pstate.c | 13 +++++++++++++
2 files changed, 17 insertions(+)
diff --git a/Documentation/cpu-freq/intel-pstate.txt b/Documentation/cpu-freq/intel-pstate.txt
index 7767ce6..6557507 100644
--- a/Documentation/cpu-freq/intel-pstate.txt
+++ b/Documentation/cpu-freq/intel-pstate.txt
@@ -41,6 +41,10 @@ controlling P state selection. These files have been added to
is supported by hardware that is in the turbo range. This number
is independent of whether turbo has been disabled or not.
+ num_pstates: displays the number of pstates that are supported
+ by hardware. This number is independent of whether turbo has
+ been disabled or not.
+
For contemporary Intel processors, the frequency is controlled by the
processor itself and the P-states exposed to software are related to
performance levels. The idea that frequency can be set to a single
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index f558c2e..3ea9aff 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -354,6 +354,17 @@ static ssize_t show_turbo_pct(struct kobject *kobj,
return sprintf(buf, "%u\n", turbo_pct);
}
+static ssize_t show_num_pstates(struct kobject *kobj,
+ struct attribute *attr, char *buf)
+{
+ struct cpudata *cpu;
+ int total;
+
+ cpu = all_cpu_data[0];
+ total = cpu->pstate.turbo_pstate - cpu->pstate.min_pstate + 1;
+ return sprintf(buf, "%u\n", total);
+}
+
static ssize_t show_no_turbo(struct kobject *kobj,
struct attribute *attr, char *buf)
{
@@ -435,12 +446,14 @@ define_one_global_rw(no_turbo);
define_one_global_rw(max_perf_pct);
define_one_global_rw(min_perf_pct);
define_one_global_ro(turbo_pct);
+define_one_global_ro(num_pstates);
static struct attribute *intel_pstate_attributes[] = {
&no_turbo.attr,
&max_perf_pct.attr,
&min_perf_pct.attr,
&turbo_pct.attr,
+ &num_pstates.attr,
NULL
};
--
1.9.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-01-29 1:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-28 23:03 [PATCH 0/2] sysfs additions for intel_pstate Kristen Carlson Accardi
2015-01-28 23:03 ` [PATCH 1/2] intel_pstate: expose turbo range to sysfs Kristen Carlson Accardi
2015-01-28 23:03 ` [PATCH 2/2] intel_pstate: Add num_pstates " Kristen Carlson Accardi
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.