LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] cpufreq: powernv: Remove global pstate ramp-down timer in POWER9
@ 2018-04-25 6:14 Shilpasri G Bhat
2018-04-25 6:25 ` Viresh Kumar
2018-07-19 6:07 ` Michael Ellerman
0 siblings, 2 replies; 3+ messages in thread
From: Shilpasri G Bhat @ 2018-04-25 6:14 UTC (permalink / raw)
To: rjw, viresh.kumar
Cc: benh, mpe, linux-pm, linuxppc-dev, linux-kernel, svaidy,
Shilpasri G Bhat
POWER9 doesnot support global pstate requests for the chip. So remove
the timer logic which slowly ramps down the global pstate in P9
platforms.
Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>
---
drivers/cpufreq/powernv-cpufreq.c | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/drivers/cpufreq/powernv-cpufreq.c b/drivers/cpufreq/powernv-cpufreq.c
index 0591874..71f8682 100644
--- a/drivers/cpufreq/powernv-cpufreq.c
+++ b/drivers/cpufreq/powernv-cpufreq.c
@@ -750,8 +750,13 @@ static int powernv_cpufreq_target_index(struct cpufreq_policy *policy,
cur_msec = jiffies_to_msecs(get_jiffies_64());
- spin_lock(&gpstates->gpstate_lock);
freq_data.pstate_id = idx_to_pstate(new_index);
+ if (!gpstates) {
+ freq_data.gpstate_id = freq_data.pstate_id;
+ goto no_gpstate;
+ }
+
+ spin_lock(&gpstates->gpstate_lock);
if (!gpstates->last_sampled_time) {
gpstate_idx = new_index;
@@ -801,6 +806,7 @@ static int powernv_cpufreq_target_index(struct cpufreq_policy *policy,
spin_unlock(&gpstates->gpstate_lock);
+no_gpstate:
/*
* Use smp_call_function to send IPI and execute the
* mtspr on target CPU. We could do that without IPI
@@ -835,6 +841,13 @@ static int powernv_cpufreq_cpu_init(struct cpufreq_policy *policy)
kernfs_put(kn);
}
+ policy->freq_table = powernv_freqs;
+ policy->fast_switch_possible = true;
+
+ if (pvr_version_is(PVR_POWER9))
+ return 0;
+
+ /* Initialise Gpstate ramp-down timer only on POWER8 */
gpstates = kzalloc(sizeof(*gpstates), GFP_KERNEL);
if (!gpstates)
return -ENOMEM;
@@ -849,15 +862,14 @@ static int powernv_cpufreq_cpu_init(struct cpufreq_policy *policy)
msecs_to_jiffies(GPSTATE_TIMER_INTERVAL);
spin_lock_init(&gpstates->gpstate_lock);
- policy->freq_table = powernv_freqs;
- policy->fast_switch_possible = true;
return 0;
}
static int powernv_cpufreq_cpu_exit(struct cpufreq_policy *policy)
{
/* timer is deleted in cpufreq_cpu_stop() */
- kfree(policy->driver_data);
+ if (policy->driver_data)
+ kfree(policy->driver_data);
return 0;
}
@@ -990,7 +1002,8 @@ static void powernv_cpufreq_stop_cpu(struct cpufreq_policy *policy)
freq_data.pstate_id = idx_to_pstate(powernv_pstate_info.min);
freq_data.gpstate_id = idx_to_pstate(powernv_pstate_info.min);
smp_call_function_single(policy->cpu, set_pstate, &freq_data, 1);
- del_timer_sync(&gpstates->timer);
+ if (gpstates)
+ del_timer_sync(&gpstates->timer);
}
static unsigned int powernv_fast_switch(struct cpufreq_policy *policy,
--
1.8.3.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] cpufreq: powernv: Remove global pstate ramp-down timer in POWER9
2018-04-25 6:14 [PATCH] cpufreq: powernv: Remove global pstate ramp-down timer in POWER9 Shilpasri G Bhat
@ 2018-04-25 6:25 ` Viresh Kumar
2018-07-19 6:07 ` Michael Ellerman
1 sibling, 0 replies; 3+ messages in thread
From: Viresh Kumar @ 2018-04-25 6:25 UTC (permalink / raw)
To: Shilpasri G Bhat
Cc: rjw, benh, mpe, linux-pm, linuxppc-dev, linux-kernel, svaidy
On 25-04-18, 11:44, Shilpasri G Bhat wrote:
> POWER9 doesnot support global pstate requests for the chip. So remove
> the timer logic which slowly ramps down the global pstate in P9
> platforms.
>
> Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>
> ---
> drivers/cpufreq/powernv-cpufreq.c | 23 ++++++++++++++++++-----
> 1 file changed, 18 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/cpufreq/powernv-cpufreq.c b/drivers/cpufreq/powernv-cpufreq.c
> index 0591874..71f8682 100644
> --- a/drivers/cpufreq/powernv-cpufreq.c
> +++ b/drivers/cpufreq/powernv-cpufreq.c
> @@ -750,8 +750,13 @@ static int powernv_cpufreq_target_index(struct cpufreq_policy *policy,
>
> cur_msec = jiffies_to_msecs(get_jiffies_64());
>
> - spin_lock(&gpstates->gpstate_lock);
> freq_data.pstate_id = idx_to_pstate(new_index);
> + if (!gpstates) {
> + freq_data.gpstate_id = freq_data.pstate_id;
> + goto no_gpstate;
> + }
> +
> + spin_lock(&gpstates->gpstate_lock);
>
> if (!gpstates->last_sampled_time) {
> gpstate_idx = new_index;
> @@ -801,6 +806,7 @@ static int powernv_cpufreq_target_index(struct cpufreq_policy *policy,
>
> spin_unlock(&gpstates->gpstate_lock);
>
> +no_gpstate:
> /*
> * Use smp_call_function to send IPI and execute the
> * mtspr on target CPU. We could do that without IPI
> @@ -835,6 +841,13 @@ static int powernv_cpufreq_cpu_init(struct cpufreq_policy *policy)
> kernfs_put(kn);
> }
>
> + policy->freq_table = powernv_freqs;
> + policy->fast_switch_possible = true;
> +
> + if (pvr_version_is(PVR_POWER9))
> + return 0;
> +
> + /* Initialise Gpstate ramp-down timer only on POWER8 */
> gpstates = kzalloc(sizeof(*gpstates), GFP_KERNEL);
> if (!gpstates)
> return -ENOMEM;
> @@ -849,15 +862,14 @@ static int powernv_cpufreq_cpu_init(struct cpufreq_policy *policy)
> msecs_to_jiffies(GPSTATE_TIMER_INTERVAL);
> spin_lock_init(&gpstates->gpstate_lock);
>
> - policy->freq_table = powernv_freqs;
> - policy->fast_switch_possible = true;
> return 0;
> }
>
> static int powernv_cpufreq_cpu_exit(struct cpufreq_policy *policy)
> {
> /* timer is deleted in cpufreq_cpu_stop() */
> - kfree(policy->driver_data);
> + if (policy->driver_data)
> + kfree(policy->driver_data);
>
> return 0;
> }
> @@ -990,7 +1002,8 @@ static void powernv_cpufreq_stop_cpu(struct cpufreq_policy *policy)
> freq_data.pstate_id = idx_to_pstate(powernv_pstate_info.min);
> freq_data.gpstate_id = idx_to_pstate(powernv_pstate_info.min);
> smp_call_function_single(policy->cpu, set_pstate, &freq_data, 1);
> - del_timer_sync(&gpstates->timer);
> + if (gpstates)
> + del_timer_sync(&gpstates->timer);
> }
>
> static unsigned int powernv_fast_switch(struct cpufreq_policy *policy,
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
--
viresh
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: cpufreq: powernv: Remove global pstate ramp-down timer in POWER9
2018-04-25 6:14 [PATCH] cpufreq: powernv: Remove global pstate ramp-down timer in POWER9 Shilpasri G Bhat
2018-04-25 6:25 ` Viresh Kumar
@ 2018-07-19 6:07 ` Michael Ellerman
1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2018-07-19 6:07 UTC (permalink / raw)
To: Shilpasri G Bhat, rjw, viresh.kumar
Cc: linux-pm, linux-kernel, Shilpasri G Bhat, linuxppc-dev
On Wed, 2018-04-25 at 06:14:55 UTC, Shilpasri G Bhat wrote:
> POWER9 doesnot support global pstate requests for the chip. So remove
> the timer logic which slowly ramps down the global pstate in P9
> platforms.
>
> Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/dcb14337e0f2adb227c376e6327ef0
cheers
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-07-19 6:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-25 6:14 [PATCH] cpufreq: powernv: Remove global pstate ramp-down timer in POWER9 Shilpasri G Bhat
2018-04-25 6:25 ` Viresh Kumar
2018-07-19 6:07 ` Michael Ellerman
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).