Re: [PATCH v2] x86/fred: Consolidate the FRED stack pointer assignments
From: Sohil Mehta
Date: Mon Nov 30 2026 - 18:43:18 EST
On 11/30/2026 3:38 PM, Dave Hansen wrote:
> On 11/30/26 15:18, H. Peter Anvin wrote:
>>> BTW, does the KVM code need the MSR value or does it also need to do a
>>> wrmsr()?
>> It *is* doing a wrmsr? The point is that it doesn't need to do a rdmsr.
>
> I was just thinking that the redundancy in the use could be removed by
> moving the wrmsr() into the helper. Instead of:
>
> wrmsrq(MSR_IA32_FRED_RSP1, this_cpu_fred_sp(MSR_IA32_FRED_RSP1));
>
> it might make sense for it to look more like:
>
> build_fred_sp(MSR_IA32_FRED_RSP1);
>
KVM doesn't write to the same MSR as the kernel. KVM reads the value and
writes to the VMCS field HOST_IA32_FRED_RSP1.
> and then do the wrmsr() internally. It might be a bit more compact.