Re: linux-next: build failure after merge of the pm tree

From: Viresh Kumar
Date: Mon Jul 01 2019 - 03:48:54 EST


On 01-07-19, 13:37, Stephen Rothwell wrote:
> In file included from drivers/cpufreq/intel_pstate.c:11:
> drivers/cpufreq/intel_pstate.c: In function 'intel_pstate_update_max_freq':
> drivers/cpufreq/intel_pstate.c:912:31: error: 'struct cpufreq_policy' has no member named 'user_policy'; did you mean 'last_policy'?
> new_policy.max = min(policy->user_policy.max, policy->cpuinfo.max_freq);
^~~~~~~~~~~

Yeah, that was a recent update and I missed this path completely.

> Caused by commit
>
> 218208538ffe ("cpufreq: Add QoS requests for userspace constraints")

@Rafael: I hope merging below to this commit would be the right thing to do ?

--
viresh

-------------------------8<-------------------------
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 9da4dc33b716..99bcdb6d4d83 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1105,7 +1105,7 @@ static int cpufreq_add_policy_cpu(struct cpufreq_policy *policy, unsigned int cp
return ret;
}

-static void refresh_frequency_limits(struct cpufreq_policy *policy)
+void refresh_frequency_limits(struct cpufreq_policy *policy)
{
struct cpufreq_policy new_policy;

@@ -1120,6 +1120,7 @@ static void refresh_frequency_limits(struct cpufreq_policy *policy)

up_write(&policy->rwsem);
}
+EXPORT_SYMBOL(refresh_frequency_limits);

static void handle_update(struct work_struct *work)
{
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index f2ff5de988c1..cc27d4c59dca 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -898,7 +898,6 @@ static void intel_pstate_update_policies(void)
static void intel_pstate_update_max_freq(unsigned int cpu)
{
struct cpufreq_policy *policy = cpufreq_cpu_acquire(cpu);
- struct cpufreq_policy new_policy;
struct cpudata *cpudata;

if (!policy)
@@ -908,11 +907,7 @@ static void intel_pstate_update_max_freq(unsigned int cpu)
policy->cpuinfo.max_freq = global.turbo_disabled_mf ?
cpudata->pstate.max_freq : cpudata->pstate.turbo_freq;

- memcpy(&new_policy, policy, sizeof(*policy));
- new_policy.max = min(policy->user_policy.max, policy->cpuinfo.max_freq);
- new_policy.min = min(policy->user_policy.min, new_policy.max);
-
- cpufreq_set_policy(policy, &new_policy);
+ refresh_frequency_limits(policy);

cpufreq_cpu_release(policy);
}
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index dca2ae358542..d757a56a74dc 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -200,6 +200,7 @@ void cpufreq_cpu_release(struct cpufreq_policy *policy);
int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu);
int cpufreq_set_policy(struct cpufreq_policy *policy,
struct cpufreq_policy *new_policy);
+void refresh_frequency_limits(struct cpufreq_policy *policy);
void cpufreq_update_policy(unsigned int cpu);
void cpufreq_update_limits(unsigned int cpu);
bool have_governor_per_policy(void);