[V2,3/4] intel_pstate: Ignore scheduler cpufreq callbacks on remote CPUs

Message ID a33ba3746dacce67a7c2e17b64e54ee89f64a3bc.1498712046.git.viresh.kumar@linaro.org
State New
Headers show
Series
  • sched: cpufreq: Allow remote callbacks
Related show

Commit Message

Viresh Kumar June 29, 2017, 5:26 a.m.
From: Steve Muckle <smuckle.linux@gmail.com>


In preparation for the scheduler cpufreq callback happening on remote
CPUs, check for this case in intel_pstate which currently requires the
callback run on the local CPU. Such callbacks are ignored for now.

Signed-off-by: Steve Muckle <smuckle.linux@gmail.com>

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

---
 drivers/cpufreq/intel_pstate.c | 3 +++
 1 file changed, 3 insertions(+)

-- 
2.13.0.71.gd7076ec9c9cb

Comments

Srinivas Pandruvada June 29, 2017, 9:23 p.m. | #1
On Thu, 2017-06-29 at 10:56 +0530, Viresh Kumar wrote:
> From: Steve Muckle <smuckle.linux@gmail.com>

> 

> In preparation for the scheduler cpufreq callback happening on remote

> CPUs, check for this case in intel_pstate which currently requires

> the

> callback run on the local CPU. Such callbacks are ignored for now.

Is it possible that we miss a chance to calculate load periodically at
a predefined interval (10ms default), because the callback happened on
a different CPU?

Thanks,
Srinivas

> 

> Signed-off-by: Steve Muckle <smuckle.linux@gmail.com>

> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

> ---

>  drivers/cpufreq/intel_pstate.c | 3 +++

>  1 file changed, 3 insertions(+)

> 

> diff --git a/drivers/cpufreq/intel_pstate.c

> b/drivers/cpufreq/intel_pstate.c

> index 4ce501148790..7a2a8ee579ef 100644

> --- a/drivers/cpufreq/intel_pstate.c

> +++ b/drivers/cpufreq/intel_pstate.c

> @@ -1755,6 +1755,9 @@ static void intel_pstate_update_util(struct

> update_util_data *data, u64 time,

>  	struct cpudata *cpu = container_of(data, struct cpudata,

> update_util);

>  	u64 delta_ns;

>  

> +	if (smp_processor_id() != data->cpu)

> +		return;

> +

>  	if (flags & SCHED_CPUFREQ_IOWAIT) {

>  		cpu->iowait_boost = int_tofp(1);

>  	} else if (cpu->iowait_boost) {
Viresh Kumar June 30, 2017, 3:27 a.m. | #2
On 29-06-17, 14:23, Srinivas Pandruvada wrote:
> On Thu, 2017-06-29 at 10:56 +0530, Viresh Kumar wrote:

> > From: Steve Muckle <smuckle.linux@gmail.com>

> > 

> > In preparation for the scheduler cpufreq callback happening on remote

> > CPUs, check for this case in intel_pstate which currently requires

> > the

> > callback run on the local CPU. Such callbacks are ignored for now.

> Is it possible that we miss a chance to calculate load periodically at

> a predefined interval (10ms default), because the callback happened on

> a different CPU?


We aren't updating cpu->sample.time for remote callbacks here, so no
we shouldn't miss anything.

-- 
viresh
Rafael J. Wysocki July 12, 2017, 11:27 p.m. | #3
On Thursday, June 29, 2017 02:23:58 PM Srinivas Pandruvada wrote:
> On Thu, 2017-06-29 at 10:56 +0530, Viresh Kumar wrote:

> > From: Steve Muckle <smuckle.linux@gmail.com>

> > 

> > In preparation for the scheduler cpufreq callback happening on remote

> > CPUs, check for this case in intel_pstate which currently requires

> > the

> > callback run on the local CPU. Such callbacks are ignored for now.

> Is it possible that we miss a chance to calculate load periodically at

> a predefined interval (10ms default), because the callback happened on

> a different CPU?


We won't.

The callback will just be invoked more often after this series and the check
this patch is adding to it is actually there in the callers now, so effectively
this just moves the check down the callchain.

It is confusing, though, because the two complementary changes are made by
different patches.

Also, Viresh please note that we have more than one governor callback in
intel_pstate now.

Thanks,
Rafael

Patch hide | download patch | download mbox

diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 4ce501148790..7a2a8ee579ef 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -1755,6 +1755,9 @@  static void intel_pstate_update_util(struct update_util_data *data, u64 time,
 	struct cpudata *cpu = container_of(data, struct cpudata, update_util);
 	u64 delta_ns;
 
+	if (smp_processor_id() != data->cpu)
+		return;
+
 	if (flags & SCHED_CPUFREQ_IOWAIT) {
 		cpu->iowait_boost = int_tofp(1);
 	} else if (cpu->iowait_boost) {