lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 20 Apr 2016 19:20:15 -0700
From:	Steve Muckle <steve.muckle@...aro.org>
To:	"Rafael J. Wysocki" <rjw@...ysocki.net>
Cc:	Steve Muckle <steve.muckle@...aro.org>,
	"Rafael J. Wysocki" <rafael@...nel.org>,
	Viresh Kumar <viresh.kumar@...aro.org>,
	linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org,
	Peter Zijlstra <peterz@...radead.org>,
	Ingo Molnar <mingo@...hat.com>,
	Vincent Guittot <vincent.guittot@...aro.org>,
	Morten Rasmussen <morten.rasmussen@....com>,
	Dietmar Eggemann <dietmar.eggemann@....com>,
	Juri Lelli <Juri.Lelli@....com>,
	Patrick Bellasi <patrick.bellasi@....com>,
	Michael Turquette <mturquette@...libre.com>
Subject: Re: [RFC PATCH 3/4] intel_pstate: support scheduler cpufreq
 callbacks on remote CPUs

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ