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

From: Borislav Petkov
Date: Wed Jul 03 2024 - 12:17:34 EST


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.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette