All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve Muckle <steve.muckle@linaro.org>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Steve Muckle <steve.muckle@linaro.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Morten Rasmussen <morten.rasmussen@arm.com>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Juri Lelli <Juri.Lelli@arm.com>,
	Patrick Bellasi <patrick.bellasi@arm.com>,
	Michael Turquette <mturquette@baylibre.com>
Subject: Re: [RFC PATCH 3/4] intel_pstate: support scheduler cpufreq callbacks on remote CPUs
Date: Wed, 20 Apr 2016 19:20:15 -0700	[thread overview]
Message-ID: <20160421022015.GA10028@sky.smuckle.net> (raw)
In-Reply-To: <48732338.GBX16FRDRa@vostro.rjw.lan>

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.

> 
> > +		return;
> >  
> > -		if (sample_taken && !hwp_active)
> > -			intel_pstate_adjust_busy_pstate(cpu);
> > +	if (cpu->cpu == smp_processor_id()) {
> > +		_intel_pstate_update_util(cpu, time);
> > +	} else {
> > +		/* The target CPU's rq lock is held. */
> > +		if (cpu->ipi_in_progress)
> > +			return;
> > +
> > +		/* Re-check sample_time which may have advanced. */
> > +		smp_rmb();
> > +		delta_ns = time - READ_ONCE(cpu->sample.time);
> > +		if (delta_ns < pid_params.sample_rate_ns)
> > +			return;
> > +
> > +		cpu->ipi_in_progress = true;
> > +		cpu->time = time;
> > +		irq_work_queue_on(&cpu->irq_work, cpu->cpu);
> >  	}
> >  }
> >  
> > +static inline void intel_pstate_irq_work_sync(unsigned int cpu)
> > +{
> > +	irq_work_sync(&all_cpu_data[cpu]->irq_work);
> > +}
> > +
> > +static inline void intel_pstate_init_irq_work(struct cpudata *cpu)
> > +{
> > +	init_irq_work(&cpu->irq_work, intel_pstate_update_util_remote);
> > +}
> > +#else /* !CONFIG_SMP */
> > +static inline void intel_pstate_irq_work_sync(unsigned int cpu) {}
> > +static inline void intel_pstate_init_irq_work(struct cpudata *cpu) {}
> > +
> > +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);
> > +	s64 delta_ns = time - cpu->sample.time;
> > +
> > +	if (delta_ns < pid_params.sample_rate_ns)
> > +		return;
> > +
> > +	_intel_pstate_update_util(cpu, time);
> > +}
> > +#endif
> > +
> > +
> > +
> 
> The additional two empty lines are not necessary.
> 

Sorry yeah these were unintentional, will remove these and the ones below.

Thanks for the review.

thanks,
Steve

  reply	other threads:[~2016-04-21  2:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-20  2:39 [RFC PATCH 1/4] cpufreq: governor: support scheduler cpufreq callbacks on remote CPUs Steve Muckle
2016-04-20  2:39 ` [RFC PATCH 2/4] cpufreq: schedutil: " Steve Muckle
2016-04-20  2:39 ` [RFC PATCH 3/4] intel_pstate: " Steve Muckle
2016-04-20 12:37   ` Rafael J. Wysocki
2016-04-21  2:20     ` Steve Muckle [this message]
2016-04-25 21:34       ` Rafael J. Wysocki
2016-04-20  2:39 ` [RFC PATCH 4/4] sched/fair: call cpufreq hook for remote wakeups Steve Muckle
2016-04-20 12:26 ` [RFC PATCH 1/4] cpufreq: governor: support scheduler cpufreq callbacks on remote CPUs Rafael J. Wysocki
2016-04-25 19:17   ` Steve Muckle
2016-04-25 21:28     ` Rafael J. Wysocki
2016-04-29 10:38 ` Viresh Kumar
2016-04-29 11:21   ` Rafael J. Wysocki
2016-05-06 20:53     ` Steve Muckle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160421022015.GA10028@sky.smuckle.net \
    --to=steve.muckle@linaro.org \
    --cc=Juri.Lelli@arm.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=morten.rasmussen@arm.com \
    --cc=mturquette@baylibre.com \
    --cc=patrick.bellasi@arm.com \
    --cc=peterz@infradead.org \
    --cc=rafael@kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=vincent.guittot@linaro.org \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.