Re: [PATCH v2] x86/fred: Consolidate the FRED stack pointer assignments

From: Sean Christopherson

Date: Tue Dec 01 2026 - 16:53:48 EST


On Mon, Nov 30, 2026, Sohil Mehta wrote:
> On 11/30/2026 3:48 PM, Dave Hansen wrote:
> > On 11/30/26 15:43, Sohil Mehta wrote:
> >> 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.
> >
> > This is all optimization, right? How about the series just does rdmsr()
> > for now. It's the smallest amount of code. Start there. Optimize later.
>
> Yes, we could do the optimization later.
>
> Sean's request originated here:
> https://lore.kernel.org/all/aahchI7oiFrjFAmb@xxxxxxxxxx/
>
> "The simplest approach would be to read the actual MSR. _If_ using a
> per-CPU read provides meaningful performance benefits over RDMSR, ...
> then have the kernel provide a dedicated accessor."
>
> So, I am assuming he is still okay with deferring the optimization.

Yes, absolutely.

> FWIW, I measured the cycle difference between the per-CPU read and the
> MSR read. It was ~6x more with the MSR read but with all the things
> happening during vCPU load 3 MSR reads shouldn't matter much.

It's not even vCPU load, it's specifically task migration (or technically if the
vCPU is run on a different task that was bound to a different pCPU). That's why
I emphasized "if" in my response long ago: the odds of three RDMSRs being meaningful
is basically zero.