Re: [RFC PATCH 3/4] intel_pstate: support scheduler cpufreq callbacks on remote CPUs

From: Rafael J. Wysocki
Date: Mon Apr 25 2016 - 17:34:58 EST


On Thu, Apr 21, 2016 at 4:20 AM, Steve Muckle <steve.muckle@xxxxxxxxxx> wrote:
> On Wed, Apr 20, 2016 at 02:37:18PM +0200, Rafael J. Wysocki wrote:
> ...
>> > @@ -1173,20 +1179,88 @@ static inline void intel_pstate_adjust_busy_pstate(struct cpudata *cpu)
>> > get_avg_frequency(cpu));
>> > }
>> >
>> > +static void _intel_pstate_update_util(struct cpudata *cpu, u64 time)
>>
>> What about calling this intel_pstate_update_cpu()?
>
> Sure will change.
>
> ...
>> > static void intel_pstate_update_util(struct update_util_data *data, u64 time,
>> > unsigned long util, unsigned long max)
>> > {
>> > struct cpudata *cpu = container_of(data, struct cpudata, update_util);
>> > - u64 delta_ns = time - cpu->sample.time;
>> > + s64 delta_ns = time - cpu->sample.time;
>> >
>> > - if ((s64)delta_ns >= pid_params.sample_rate_ns) {
>> > - bool sample_taken = intel_pstate_sample(cpu, time);
>> > + if (delta_ns < pid_params.sample_rate_ns)
>>
>> Why don't you check cpu->ipi_in_progress here too and bail out if it is set?
>>
>> That would allow you to avoid checking the time again below, woulnd't it?
>
> Yeah I think that should work. I can't recall why I thought I needed
> to check the time first, then ipi_in_progress, then the time. As long
> as ipi_in_progress is checked prior to the time, it should be fine.

I actually think that we can just skip all cross-CPU updates in
intel_pstate instead of adding complexity to it.

The governor algorithm here uses feedback registers to estimate
utilization and I don't think it will react to the corss-CPU updates
the way you want plus it is likely to skip them anyway due to the rate
limit.