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  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:	Mon, 1 Sep 2014 09:12:43 +0000
From:	David Laight <David.Laight@...LAB.COM>
To:	'Shilpa Bhat' <shilpa.bhat@...ux.vnet.ibm.com>,
	Viresh Kumar <viresh.kumar@...aro.org>
CC:	"linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>,
	"Rafael J. Wysocki" <rjw@...ysocki.net>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Preeti U Murthy <preeti@...ux.vnet.ibm.com>,
	"linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>
Subject: RE: [PATCH v2] cpufreq: powernv: Set the cpus to nominal frequency
 during reboot/kexec

From: Shilpa Bhat
> Hi Viresh,
> On Fri, 2014-08-29 at 05:33 +0530, Viresh Kumar wrote:
> > On 28 August 2014 19:36, Shilpasri G Bhat
> > <shilpa.bhat@...ux.vnet.ibm.com> wrote:
> > >
> > > Changes v1->v2:
> > > Invoke .target() driver callback to set the cpus to nominal frequency
> > > in reboot notifier, instead of calling cpufreq_suspend() as suggested
> > > by Viresh Kumar.
> > > Modified the commit message.
> >
> > This changelog will get commited, is this what you want?
> 
> > > +       if (unlikely(rebooting) && new_index != get_nominal_index())
> > > +               return -EBUSY;
> >
> > Have you placed the unlikely only around 'rebooting' intentionally or
> > should it cover whole if statement?
> >
> 
> Yes unlikely() should cover the whole if statement...

Actually it probably shouldn't.
You need to look at the generated code with each different set of 'unlikely()'
to see how gcc processes them.
In this case, if 'rebooting' is false you want to 'fall through' on a statically
predicted 'not taken' branch. You don't ever care about the second clause.
With an 'unlikely' covering the entire statement gcc could easily add a
forwards conditional branch (that will be mis-predicted) for the 'rebooting' test.

(Yes, I spent a lot of time getting gcc to generate branches that were
correctly statically predicted for some code where every cycle mattered.)

	David

Powered by blists - more mailing lists