* [PATCH v3 03/11] x86/intel_pstate: add new policy fields and a new driver interface
@ 2015-06-11 8:26 Wei Wang
2015-06-18 14:15 ` Jan Beulich
0 siblings, 1 reply; 2+ messages in thread
From: Wei Wang @ 2015-06-11 8:26 UTC (permalink / raw)
To: xen-devel, jbeulich; +Cc: andrew.cooper3, Wei Wang
In order to better support future Intel processors, intel_pstate
changes to use percentage values to tune P-states. The intel_pstate
driver uses its own internal governor, and it is recorded in the
"policy->policy" field. The setpolicy driver interface is used to
configure the intel_pstate internal policy. The __cpufreq_set_policy
needs to be intercepted to use the setpolicy driver if it exists.
The perf_limts struct is included in the per-CPU policy struct, so
that each CPU can be managed individually by the xenpm tool.
Signed-off-by: Wei Wang <wei.w.wang@intel.com>
---
xen/drivers/cpufreq/utility.c | 6 ++++++
xen/include/acpi/cpufreq/cpufreq.h | 15 +++++++++++++++
2 files changed, 21 insertions(+)
diff --git a/xen/drivers/cpufreq/utility.c b/xen/drivers/cpufreq/utility.c
index 519f862..b3fe3c0 100644
--- a/xen/drivers/cpufreq/utility.c
+++ b/xen/drivers/cpufreq/utility.c
@@ -457,6 +457,12 @@ int __cpufreq_set_policy(struct cpufreq_policy *data,
data->min = policy->min;
data->max = policy->max;
+ if (cpufreq_driver->setpolicy) {
+ data->limits.min_perf_pct = policy->limits.min_perf_pct;
+ data->limits.max_perf_pct = policy->limits.max_perf_pct;
+ return cpufreq_driver->setpolicy(data);
+ }
+
if (policy->governor != data->governor) {
/* save old, working values */
struct cpufreq_governor *old_gov = data->governor;
diff --git a/xen/include/acpi/cpufreq/cpufreq.h b/xen/include/acpi/cpufreq/cpufreq.h
index f96c3e4..60caf59 100644
--- a/xen/include/acpi/cpufreq/cpufreq.h
+++ b/xen/include/acpi/cpufreq/cpufreq.h
@@ -41,6 +41,18 @@ struct cpufreq_cpuinfo {
unsigned int transition_latency; /* in 10^(-9) s = nanoseconds */
};
+struct perf_limits {
+ int no_turbo;
+ int turbo_disabled;
+ uint32_t turbo_pct;
+ uint32_t max_perf_pct; /* max performance in percentage */
+ uint32_t min_perf_pct; /* min performance in percentage */
+ uint32_t max_perf;
+ uint32_t min_perf;
+ uint32_t max_policy_pct;
+ uint32_t min_policy_pct;
+};
+
struct cpufreq_policy {
cpumask_var_t cpus; /* affected CPUs */
unsigned int shared_type; /* ANY or ALL affected CPUs
@@ -52,6 +64,8 @@ struct cpufreq_policy {
unsigned int max; /* in kHz */
unsigned int cur; /* in kHz, only needed if cpufreq
* governors are used */
+ unsigned int policy;
+ struct perf_limits limits;
struct cpufreq_governor *governor;
bool_t resume; /* flag for cpufreq 1st run
@@ -145,6 +159,7 @@ struct cpufreq_driver {
char name[CPUFREQ_NAME_LEN];
int (*init)(struct cpufreq_policy *policy);
int (*verify)(struct cpufreq_policy *policy);
+ int (*setpolicy)(struct cpufreq_policy *policy);
int (*update)(int cpuid, struct cpufreq_policy *policy);
int (*target)(struct cpufreq_policy *policy,
unsigned int target_freq,
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v3 03/11] x86/intel_pstate: add new policy fields and a new driver interface
2015-06-11 8:26 [PATCH v3 03/11] x86/intel_pstate: add new policy fields and a new driver interface Wei Wang
@ 2015-06-18 14:15 ` Jan Beulich
0 siblings, 0 replies; 2+ messages in thread
From: Jan Beulich @ 2015-06-18 14:15 UTC (permalink / raw)
To: Wei Wang; +Cc: andrew.cooper3, xen-devel
>>> On 11.06.15 at 10:26, <wei.w.wang@intel.com> wrote:
> --- a/xen/drivers/cpufreq/utility.c
> +++ b/xen/drivers/cpufreq/utility.c
> @@ -457,6 +457,12 @@ int __cpufreq_set_policy(struct cpufreq_policy *data,
> data->min = policy->min;
> data->max = policy->max;
>
> + if (cpufreq_driver->setpolicy) {
> + data->limits.min_perf_pct = policy->limits.min_perf_pct;
> + data->limits.max_perf_pct = policy->limits.max_perf_pct;
For one you leave all other data->limits fields uninitialized - please
use "data->limits = policy->limits". And then I don't see why this
should be done inside the if() - there's no obvious connection
between ->setpolicy being non-NULL and ->limits having meaning
to the driver - this is solely your intended _use_ model.
> --- a/xen/include/acpi/cpufreq/cpufreq.h
> +++ b/xen/include/acpi/cpufreq/cpufreq.h
> @@ -41,6 +41,18 @@ struct cpufreq_cpuinfo {
> unsigned int transition_latency; /* in 10^(-9) s = nanoseconds */
> };
>
> +struct perf_limits {
> + int no_turbo;
> + int turbo_disabled;
Both bool_t I suppose.
> @@ -52,6 +64,8 @@ struct cpufreq_policy {
> unsigned int max; /* in kHz */
> unsigned int cur; /* in kHz, only needed if cpufreq
> * governors are used */
> + unsigned int policy;
This field isn't being used anywhere here. Please add it upon first use.
Jan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-06-18 14:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-11 8:26 [PATCH v3 03/11] x86/intel_pstate: add new policy fields and a new driver interface Wei Wang
2015-06-18 14:15 ` Jan Beulich
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.