Re: [PATCHv2 2/2] arm64: cpufeature: use static_branch_enable_cpuslocked()
From: Will Deacon
Date: Fri Apr 28 2017 - 06:07:46 EST
On Fri, Apr 28, 2017 at 11:02:30AM +0100, Mark Rutland wrote:
> On Thu, Apr 27, 2017 at 07:01:04PM +0100, Will Deacon wrote:
> > On Thu, Apr 27, 2017 at 06:44:37PM +0100, Mark Rutland wrote:
> > > diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c
> > > index f6cc67e..379ad8d 100644
> > > --- a/arch/arm64/kernel/cpu_errata.c
> > > +++ b/arch/arm64/kernel/cpu_errata.c
> > > @@ -175,9 +175,20 @@ void verify_local_cpu_errata_workarounds(void)
> > > }
> > > }
> > >
> > > -void update_cpu_errata_workarounds(void)
> > > +/*
> > > + * Secondary CPUs are booted with the waker holding the
> > > + * CPU hotplug lock, hence we don't need to lock it here again.
> > > + */
> > > +void update_secondary_cpu_errata_workarounds(void)
> > > +{
> > > + update_cpu_capabilities(arm64_errata, "enabling workaround for");
> > > +}
> > > +
> > > +void update_boot_cpu_errata_workarounds(void)
> > > {
> > > + get_online_cpus();
> > > update_cpu_capabilities(arm64_errata, "enabling workaround for");
> > > + put_online_cpus();
> > > }
> >
> > These functions seem to have unhelpful names, especially when compared to
> > the naming scheme used by the core code. I'd prefer to have:
> >
> > update_cpu_errata_workarounds: just calls update_cpu_capabilities
> >
> > update_cpu_errata_workarounds_cpuslocked: does get_online_cpus(), then calls
> > update_cpu_errata_workarounds, then does put_online_cpus();
>
> That's the opposite polarity to the other _cpuslocked functions, where
> _cpuslocked means that the lock is already held (and should not be taken
> by the _cpuslocked function itself.
>
> So I'll make those changes, but I'll swap that so:
> update_cpu_errata_workarounds() does:
>
> get_online_cpus()
> update_cpu_errata_workarounds_cpuslocked()
> put_online_cpus()
>
> > With that change:
> >
> > Acked-by: Will Deacon <will.deacon@xxxxxxx>
>
> I assume that will stand with the above change. Please shout if not!
Haha, yes, I got it downside-up. Thanks for working out what I meant.
Will