[RFC PATCH] arm64: Cache HW update of Access Flag support

Gabriel Krisman Bertazi krisman at suse.de
Mon Jan 9 07:16:13 PST 2023


Will Deacon <will at kernel.org> writes:

> On Fri, Jan 06, 2023 at 01:38:25PM -0300, Gabriel Krisman Bertazi wrote:
>> +		has_af = cpuid_feature_extract_unsigned_field(
>> +						read_cpuid(ID_AA64MMFR1_EL1),
>>  						ID_AA64MMFR1_EL1_HAFDBS_SHIFT);
>> +	return has_af;
>
> The intention here was to read the value for the _current_ CPU, since it
> might not be the same across the system when big.MISTAKE gets involved.
>
> However, since this is really just a performance optimisation and I
> think that the access flag tends to be uniformly supported in practice
> anyway, the best bet is probably just to read the sanitised version of
> the field using read_sanitised_ftr_reg().
>
> Can you give that a shot, please?

Hey Will,

Thanks for the review.

I reran the benchmark over the weekend and the impact of the bsearch
lookup seems to be <1% worse than my original patch, which is
negligible, IMO.  I will shortly follow up with a v2 applying your
suggestion.

Thanks!


-- 
Gabriel Krisman Bertazi



More information about the linux-arm-kernel mailing list