Re: [PATCH v1 2/4] x86/fred: Write to FRED MSRs with wrmsrns()

H. Peter Anvin
2024-07-05T02:46:03Z

On July 3, 2024 9:17:05 AM PDT, Borislav Petkov <bp@alien8.de> wrote:
>On Wed, Jul 03, 2024 at 09:06:55AM -0700, H. Peter Anvin wrote:
>> I believe tglx declared to use them unconditionally since FRED depends on
>> WRMSRNS (and the kernel enforces that.)
>>
>> Using an alternative would make wrmsrns() a more useful construct in
>> general, though.
>
>We can't use them unconditionally and we don't need an alternative just for
>that - a simple
>
> if (cpu_feature_enabled(X86_FEATURE_WRMSRNS))
> wrmsrns()
> else
> wrmsr()
>
>would be perfectly fine.
>

Except that that would be more cleanly spelled wrmsrns()... let's just abstract the whole thing away and let the user use wrmsrns() whenever serialization is not necessary.