RE: [PATCH v12 01/37] x86/cpufeatures: Add the cpu feature bit for WRMSRNS

From: Li, Xin3
Date: Mon Nov 13 2023 - 19:43:49 EST


> Then, further down in the patchset, it says:
>
> + if (cpu_feature_enabled(X86_FEATURE_FRED)) {
> + /* WRMSRNS is a baseline feature for FRED. */
>
> but WRMSRNS is not mentioned in the FRED spec "Document Number:
> 346446-005US, Revision: 5.0" which, according to
>
> https://www.intel.com/content/www/us/en/content-details/780121/flexible-
> return-and-event-delivery-fred-specification.html
>
> is the latest.
>
> Am I looking at the wrong one?

No. tglx asked for it:
https://lkml.kernel.org/kvm/87y1h81ht4.ffs@tglx/

>
> And now I'm wondering: when you're adding a separate CPUID bit, then the
> above should be
>
> + if (cpu_feature_enabled(X86_FEATURE_WRMSRNS)) {
> + /* WRMSRNS is a baseline feature for FRED. */

Because we are doing
wrmsrns(MSR_IA32_FRED_RSP0, ...)
here, and X86_FEATURE_WRMSRNS doesn't guarantee MSR_IA32_FRED_RSP0 exists.

Or I missed something?

>
> I see that you're adding a dependency:
>
> + { X86_FEATURE_FRED, X86_FEATURE_WRMSRNS },
>
> which then means you don't need the X86_FEATURE_WRMSRNS definition at all
> and can use X86_FEATURE_FRED only.
>
> So, what's up?

FRED just gets the honor to introduce WRMSRNS and its first usage:
https://lkml.kernel.org/kvm/b05e3092-8ba3-f4e1-b5a3-2125944936fd@xxxxxxxxx/

Another patch set should replace WRMSR with WRMSRNS, with SERIALIZE added
when needed.

Sorry for the late response, it was a long weekend in the US.

Thanks!
Xin