[PATCH v2] cpufreq: powernv: Set the cpus to nominal frequency during reboot/kexec

David Laight David.Laight at ACULAB.COM
Mon Sep 1 19:12:43 EST 2014


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 at linux.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



More information about the Linuxppc-dev mailing list