[PATCH v2 7/8] arm64: alternatives: add alternative_has_feature_*()

Mark Rutland mark.rutland at arm.com
Sat Sep 17 05:52:04 PDT 2022


On Fri, Sep 16, 2022 at 12:13:20PM +0100, Catalin Marinas wrote:
> On Mon, Sep 12, 2022 at 05:22:09PM +0100, Mark Rutland wrote:
> > @@ -465,7 +464,7 @@ static __always_inline bool __cpus_have_const_cap(int num)
> >  {
> >  	if (num >= ARM64_NCAPS)
> >  		return false;
> > -	return static_branch_unlikely(&cpu_hwcap_keys[num]);
> > +	return alternative_has_feature_unlikely(num);
> >  }
> 
> I wonder whether we should move this to "likely" (as a subsequent
> patch). It would save a branch as new CPUs turn up supporting the new
> features. We may want to keep errata workarounds as "unlikely" though as
> they tend not to stick around in future CPUs.

I had assumed we'd add separate likely/unlikely forms that we can use
independently per feature or callsite (since e.g. we want any errata caps to be
unlikely); if we have specific cases we'd like to change I can go spin that
shortly.

Thanks,
Mark.



More information about the linux-arm-kernel mailing list