* [PATCH v2] x86/fred: Consolidate the FRED stack pointer assignments
@ 2026-11-24 20:06 Sohil Mehta
2026-11-30 22:43 ` Dave Hansen
0 siblings, 1 reply; 10+ messages in thread
From: Sohil Mehta @ 2026-11-24 20:06 UTC (permalink / raw)
To: Dave Hansen, Borislav Petkov
Cc: Thomas Gleixner, Ingo Molnar, x86, H . Peter Anvin, Xin Li,
Andy Lutomirski, Peter Zijlstra, Binbin Wu, Tom Lendacky,
Dave Hansen, Chang S . Bae, Chao Gao, Sean Christopherson,
Paolo Bonzini, Sohil Mehta, kvm, linux-kernel
FRED delivers events on one of four stack levels, and each level has its
own stack pointer MSR. The mapping of stacks to levels is only implied
by the MSR writes. Nothing in the code explicitly states it, or notes
that #MC uses the NMI stack.
Add a helper that makes the connection obvious and returns the
corresponding stack pointer for each RSP MSR. Use it to program all four
FRED RSP MSRs during CPU initialization.
Key the helper on the MSR index rather than the stack level to keep it
simple. Later, the same interface can easily be exported to KVM or
extended for FRED shadow stack MSRs as well.
No functional change intended.
Signed-off-by: Sohil Mehta <sohil.mehta@intel.com>
---
This is a standalone cleanup that was part of the FRED KVM series. Dave
asked me to send things like this up separately for consideration:
https://lore.kernel.org/lkml/1712c0cd-747b-4dce-8231-0c8d75225648@intel.com/
v2:
- Reframe as an x86 cleanup. Drop the export, the KVM heavy changelog
and the unused !CONFIG_X86_FRED stub (Dave).
- Program the level 0 stack pointer MSR through the helper too, so that
all four of them go through it.
- Keep the helper static for now, since all the callers are file-local.
v1: https://lore.kernel.org/lkml/20261124015840.2673975-1-sohil.mehta@intel.com/
---
arch/x86/kernel/fred.c | 29 +++++++++++++++++++++++++----
1 file changed, 25 insertions(+), 4 deletions(-)
diff --git a/arch/x86/kernel/fred.c b/arch/x86/kernel/fred.c
index 1c452a389a70..35f5c27c7198 100644
--- a/arch/x86/kernel/fred.c
+++ b/arch/x86/kernel/fred.c
@@ -25,6 +25,27 @@
DEFINE_PER_CPU(unsigned long, fred_rsp0);
EXPORT_PER_CPU_SYMBOL(fred_rsp0);
+static unsigned long this_cpu_fred_sp(u32 msr)
+{
+ switch (msr) {
+ case MSR_IA32_FRED_RSP0:
+ return __this_cpu_read(fred_rsp0);
+ case MSR_IA32_FRED_RSP1:
+ return __this_cpu_ist_top_va(ESTACK_DB);
+ case MSR_IA32_FRED_RSP2:
+ /*
+ * NMI and #MC both use the NMI stack so ESTACK_MCE is left
+ * unused on a FRED system.
+ */
+ return __this_cpu_ist_top_va(ESTACK_NMI);
+ case MSR_IA32_FRED_RSP3:
+ return __this_cpu_ist_top_va(ESTACK_DF);
+ default:
+ WARN_ONCE(1, "Unexpected FRED stack pointer MSR 0x%x\n", msr);
+ return 0;
+ }
+}
+
void cpu_init_fred_exceptions(void)
{
/*
@@ -53,7 +74,7 @@ void cpu_init_fred_exceptions(void)
* Ater a CPU offline/online cycle, the FRED RSP0 MSR should be
* resynchronized with its per-CPU cache.
*/
- wrmsrq(MSR_IA32_FRED_RSP0, __this_cpu_read(fred_rsp0));
+ wrmsrq(MSR_IA32_FRED_RSP0, this_cpu_fred_sp(MSR_IA32_FRED_RSP0));
wrmsrq(MSR_IA32_FRED_RSP1, 0);
wrmsrq(MSR_IA32_FRED_RSP2, 0);
@@ -84,7 +105,7 @@ void cpu_init_fred_rsps(void)
FRED_STKLVL(X86_TRAP_DF, FRED_DF_STACK_LEVEL));
/* The FRED equivalents to IST stacks... */
- wrmsrq(MSR_IA32_FRED_RSP1, __this_cpu_ist_top_va(ESTACK_DB));
- wrmsrq(MSR_IA32_FRED_RSP2, __this_cpu_ist_top_va(ESTACK_NMI));
- wrmsrq(MSR_IA32_FRED_RSP3, __this_cpu_ist_top_va(ESTACK_DF));
+ wrmsrq(MSR_IA32_FRED_RSP1, this_cpu_fred_sp(MSR_IA32_FRED_RSP1));
+ wrmsrq(MSR_IA32_FRED_RSP2, this_cpu_fred_sp(MSR_IA32_FRED_RSP2));
+ wrmsrq(MSR_IA32_FRED_RSP3, this_cpu_fred_sp(MSR_IA32_FRED_RSP3));
}
base-commit: 135dbd0519cf7f72af120801ec7dbb79275a362d
--
2.43.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2] x86/fred: Consolidate the FRED stack pointer assignments
2026-11-24 20:06 [PATCH v2] x86/fred: Consolidate the FRED stack pointer assignments Sohil Mehta
@ 2026-11-30 22:43 ` Dave Hansen
2026-11-30 23:18 ` H. Peter Anvin
2026-11-30 23:37 ` Sohil Mehta
0 siblings, 2 replies; 10+ messages in thread
From: Dave Hansen @ 2026-11-30 22:43 UTC (permalink / raw)
To: Sohil Mehta, Dave Hansen, Borislav Petkov
Cc: Thomas Gleixner, Ingo Molnar, x86, H . Peter Anvin, Xin Li,
Andy Lutomirski, Peter Zijlstra, Binbin Wu, Tom Lendacky,
Chang S . Bae, Chao Gao, Sean Christopherson, Paolo Bonzini, kvm,
linux-kernel
On 11/24/26 12:06, Sohil Mehta wrote:
> +static unsigned long this_cpu_fred_sp(u32 msr)
> +{
I don't super like where this is going.
The previous code kinda showed in one place how the FRED stack levels
map to the exception stacks:
> /* The FRED equivalents to IST stacks... */
> - wrmsrq(MSR_IA32_FRED_RSP1, __this_cpu_ist_top_va(ESTACK_DB));
> - wrmsrq(MSR_IA32_FRED_RSP2, __this_cpu_ist_top_va(ESTACK_NMI));
> - wrmsrq(MSR_IA32_FRED_RSP3, __this_cpu_ist_top_va(ESTACK_DF));
But the new abstraction hides it completely:
> + wrmsrq(MSR_IA32_FRED_RSP1, this_cpu_fred_sp(MSR_IA32_FRED_RSP1));
> + wrmsrq(MSR_IA32_FRED_RSP2, this_cpu_fred_sp(MSR_IA32_FRED_RSP2));
> + wrmsrq(MSR_IA32_FRED_RSP3, this_cpu_fred_sp(MSR_IA32_FRED_RSP3));
> }
It also says MSR_IA32_FRED_RSPX in a redundant way.
Can this be done without the redundancy? Could it also be done with a
build warning instead of a runtime one? I'd honestly be OK with this
thing going in a header even. It's *tiny*.
BTW, does the KVM code need the MSR value or does it also need to do a
wrmsr()?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2] x86/fred: Consolidate the FRED stack pointer assignments
2026-11-30 22:43 ` Dave Hansen
@ 2026-11-30 23:18 ` H. Peter Anvin
2026-11-30 23:38 ` Dave Hansen
2026-11-30 23:37 ` Sohil Mehta
1 sibling, 1 reply; 10+ messages in thread
From: H. Peter Anvin @ 2026-11-30 23:18 UTC (permalink / raw)
To: Dave Hansen, Sohil Mehta, Dave Hansen, Borislav Petkov
Cc: Thomas Gleixner, Ingo Molnar, x86, Xin Li, Andy Lutomirski,
Peter Zijlstra, Binbin Wu, Tom Lendacky, Chang S . Bae, Chao Gao,
Sean Christopherson, Paolo Bonzini, kvm, linux-kernel
On November 30, 2026 2:43:40 PM PST, Dave Hansen <dave.hansen@intel.com> wrote:
>On 11/24/26 12:06, Sohil Mehta wrote:
>> +static unsigned long this_cpu_fred_sp(u32 msr)
>> +{
>
>I don't super like where this is going.
>
>The previous code kinda showed in one place how the FRED stack levels
>map to the exception stacks:
>
>> /* The FRED equivalents to IST stacks... */
>> - wrmsrq(MSR_IA32_FRED_RSP1, __this_cpu_ist_top_va(ESTACK_DB));
>> - wrmsrq(MSR_IA32_FRED_RSP2, __this_cpu_ist_top_va(ESTACK_NMI));
>> - wrmsrq(MSR_IA32_FRED_RSP3, __this_cpu_ist_top_va(ESTACK_DF));
>
>But the new abstraction hides it completely:
>
>> + wrmsrq(MSR_IA32_FRED_RSP1, this_cpu_fred_sp(MSR_IA32_FRED_RSP1));
>> + wrmsrq(MSR_IA32_FRED_RSP2, this_cpu_fred_sp(MSR_IA32_FRED_RSP2));
>> + wrmsrq(MSR_IA32_FRED_RSP3, this_cpu_fred_sp(MSR_IA32_FRED_RSP3));
>> }
>
>It also says MSR_IA32_FRED_RSPX in a redundant way.
>
>Can this be done without the redundancy? Could it also be done with a
>build warning instead of a runtime one? I'd honestly be OK with this
>thing going in a header even. It's *tiny*.
>
>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.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2] x86/fred: Consolidate the FRED stack pointer assignments
2026-11-30 22:43 ` Dave Hansen
2026-11-30 23:18 ` H. Peter Anvin
@ 2026-11-30 23:37 ` Sohil Mehta
1 sibling, 0 replies; 10+ messages in thread
From: Sohil Mehta @ 2026-11-30 23:37 UTC (permalink / raw)
To: Dave Hansen, Dave Hansen, Borislav Petkov
Cc: Thomas Gleixner, Ingo Molnar, x86, H . Peter Anvin, Xin Li,
Andy Lutomirski, Peter Zijlstra, Binbin Wu, Tom Lendacky,
Chang S . Bae, Chao Gao, Sean Christopherson, Paolo Bonzini, kvm,
linux-kernel
On 11/30/2026 2:43 PM, Dave Hansen wrote:
> On 11/24/26 12:06, Sohil Mehta wrote:
>> +static unsigned long this_cpu_fred_sp(u32 msr)
>> +{
>
> I don't super like where this is going.
>
Changing the order of your questions to make my reply easier:
> BTW, does the KVM code need the MSR value or does it also need to do a
> wrmsr()?
The KVM code only needs the MSR values. It does not do an MSR write.
Every time a vCPU is loaded on a CPU it needs to program it in the VMCS
field HOST_IA32_FRED_RSPX:
vmcs_write64(HOST_IA32_FRED_RSP1, this_cpu_fred_sp(MSR_IA32_FRED_RSP1));
vmcs_write64(HOST_IA32_FRED_RSP2, this_cpu_fred_sp(MSR_IA32_FRED_RSP2));
vmcs_write64(HOST_IA32_FRED_RSP3, this_cpu_fred_sp(MSR_IA32_FRED_RSP3));
KVM could directly read the value from the real MSR but since the kernel
already has this cached per-cpu, it makes sense to read from that
instead. The interface can be keyed on the MSR itself or on a new enum
described below.
> The previous code kinda showed in one place how the FRED stack levels
> map to the exception stacks:
So we have three existing things here that create and use the mapping:
One:
#define FRED_DB_STACK_LEVEL 1UL
#define FRED_NMI_STACK_LEVEL 2UL
#define FRED_MC_STACK_LEVEL 2UL
#define FRED_DF_STACK_LEVEL 3UL
Two:
wrmsrq(MSR_IA32_FRED_RSP1, __this_cpu_ist_top_va(ESTACK_DB));
wrmsrq(MSR_IA32_FRED_RSP2, __this_cpu_ist_top_va(ESTACK_NMI));
wrmsrq(MSR_IA32_FRED_RSP3, __this_cpu_ist_top_va(ESTACK_DF));
Three:
wrmsrq(MSR_IA32_FRED_STKLVLS,
FRED_STKLVL(X86_TRAP_DB, FRED_DB_STACK_LEVEL) |
FRED_STKLVL(X86_TRAP_NMI, FRED_NMI_STACK_LEVEL) |
FRED_STKLVL(X86_TRAP_MC, FRED_MC_STACK_LEVEL) |
FRED_STKLVL(X86_TRAP_DF, FRED_DF_STACK_LEVEL));
The KVM side understandably wants to avoid knowing the details of which
exact stack is mapped to which level. We could introduce a new
abstraction enum (which Xin's v10 code did) to build the above mapping:
enum fred_stack_level {
FRED_STACK_LEVEL_0,
FRED_STACK_LEVEL_1,
FRED_STACK_LEVEL_2,
FRED_STACK_LEVEL_3
};
Then the new helper function could be keyed on that:
static unsigned long this_cpu_fred_rsp(enum fred_stack_level)
But then KVM would need to know and pass this new enum. The
FRED_*_STACK_LEVEL defines seem unnecessary at this point.
>
>> /* The FRED equivalents to IST stacks... */
>> - wrmsrq(MSR_IA32_FRED_RSP1, __this_cpu_ist_top_va(ESTACK_DB));
>> - wrmsrq(MSR_IA32_FRED_RSP2, __this_cpu_ist_top_va(ESTACK_NMI));
>> - wrmsrq(MSR_IA32_FRED_RSP3, __this_cpu_ist_top_va(ESTACK_DF));
>
> But the new abstraction hides it completely:
>
>> + wrmsrq(MSR_IA32_FRED_RSP1, this_cpu_fred_sp(MSR_IA32_FRED_RSP1));
>> + wrmsrq(MSR_IA32_FRED_RSP2, this_cpu_fred_sp(MSR_IA32_FRED_RSP2));
>> + wrmsrq(MSR_IA32_FRED_RSP3, this_cpu_fred_sp(MSR_IA32_FRED_RSP3));
>> }
>
> It also says MSR_IA32_FRED_RSPX in a redundant way.
>
> Can this be done without the redundancy? Could it also be done with a
> build warning instead of a runtime one?
I am not sure. Let me try to figure out if we can do it more
efficiently. I was trying to keep this easily expandable so that kernel
shadow stacks don't need to redo all of this.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2] x86/fred: Consolidate the FRED stack pointer assignments
2026-11-30 23:18 ` H. Peter Anvin
@ 2026-11-30 23:38 ` Dave Hansen
2026-11-30 23:43 ` Sohil Mehta
0 siblings, 1 reply; 10+ messages in thread
From: Dave Hansen @ 2026-11-30 23:38 UTC (permalink / raw)
To: H. Peter Anvin, Sohil Mehta, Dave Hansen, Borislav Petkov
Cc: Thomas Gleixner, Ingo Molnar, x86, Xin Li, Andy Lutomirski,
Peter Zijlstra, Binbin Wu, Tom Lendacky, Chang S . Bae, Chao Gao,
Sean Christopherson, Paolo Bonzini, kvm, linux-kernel
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);
and then do the wrmsr() internally. It might be a bit more compact.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2] x86/fred: Consolidate the FRED stack pointer assignments
2026-11-30 23:38 ` Dave Hansen
@ 2026-11-30 23:43 ` Sohil Mehta
2026-11-30 23:48 ` Dave Hansen
0 siblings, 1 reply; 10+ messages in thread
From: Sohil Mehta @ 2026-11-30 23:43 UTC (permalink / raw)
To: Dave Hansen, H. Peter Anvin, Dave Hansen, Borislav Petkov
Cc: Thomas Gleixner, Ingo Molnar, x86, Xin Li, Andy Lutomirski,
Peter Zijlstra, Binbin Wu, Tom Lendacky, Chang S . Bae, Chao Gao,
Sean Christopherson, Paolo Bonzini, kvm, linux-kernel
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.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2] x86/fred: Consolidate the FRED stack pointer assignments
2026-11-30 23:43 ` Sohil Mehta
@ 2026-11-30 23:48 ` Dave Hansen
2026-12-01 0:02 ` Sohil Mehta
0 siblings, 1 reply; 10+ messages in thread
From: Dave Hansen @ 2026-11-30 23:48 UTC (permalink / raw)
To: Sohil Mehta, H. Peter Anvin, Dave Hansen, Borislav Petkov
Cc: Thomas Gleixner, Ingo Molnar, x86, Xin Li, Andy Lutomirski,
Peter Zijlstra, Binbin Wu, Tom Lendacky, Chang S . Bae, Chao Gao,
Sean Christopherson, Paolo Bonzini, kvm, linux-kernel
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.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2] x86/fred: Consolidate the FRED stack pointer assignments
2026-11-30 23:48 ` Dave Hansen
@ 2026-12-01 0:02 ` Sohil Mehta
2026-12-01 0:06 ` H. Peter Anvin
0 siblings, 1 reply; 10+ messages in thread
From: Sohil Mehta @ 2026-12-01 0:02 UTC (permalink / raw)
To: Dave Hansen, H. Peter Anvin, Dave Hansen, Borislav Petkov
Cc: Thomas Gleixner, Ingo Molnar, x86, Xin Li, Andy Lutomirski,
Peter Zijlstra, Binbin Wu, Tom Lendacky, Chang S . Bae, Chao Gao,
Sean Christopherson, Paolo Bonzini, kvm, linux-kernel
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@google.com/
"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.
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.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2] x86/fred: Consolidate the FRED stack pointer assignments
2026-12-01 0:02 ` Sohil Mehta
@ 2026-12-01 0:06 ` H. Peter Anvin
2026-12-01 10:31 ` David Laight
0 siblings, 1 reply; 10+ messages in thread
From: H. Peter Anvin @ 2026-12-01 0:06 UTC (permalink / raw)
To: Sohil Mehta, Dave Hansen, Dave Hansen, Borislav Petkov
Cc: Thomas Gleixner, Ingo Molnar, x86, Xin Li, Andy Lutomirski,
Peter Zijlstra, Binbin Wu, Tom Lendacky, Chang S . Bae, Chao Gao,
Sean Christopherson, Paolo Bonzini, kvm, linux-kernel
On November 30, 2026 4:02:52 PM PST, Sohil Mehta <sohil.mehta@intel.com> 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@google.com/
>
>"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.
>
>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.
>
>
The one reason I see to avoid rdmsr is the idea of "frustrate an attacker" by resetting fixed-value control registers when convenient.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2] x86/fred: Consolidate the FRED stack pointer assignments
2026-12-01 0:06 ` H. Peter Anvin
@ 2026-12-01 10:31 ` David Laight
0 siblings, 0 replies; 10+ messages in thread
From: David Laight @ 2026-12-01 10:31 UTC (permalink / raw)
To: H. Peter Anvin
Cc: Sohil Mehta, Dave Hansen, Dave Hansen, Borislav Petkov,
Thomas Gleixner, Ingo Molnar, x86, Xin Li, Andy Lutomirski,
Peter Zijlstra, Binbin Wu, Tom Lendacky, Chang S . Bae, Chao Gao,
Sean Christopherson, Paolo Bonzini, kvm, linux-kernel
On Mon, 30 Nov 2026 16:06:43 -0800
"H. Peter Anvin" <hpa@zytor.com> wrote:
> On November 30, 2026 4:02:52 PM PST, Sohil Mehta <sohil.mehta@intel.com> 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@google.com/
> >
> >"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.
> >
> >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.
> >
> >
>
> The one reason I see to avoid rdmsr is the idea of "frustrate an attacker" by resetting fixed-value control registers when convenient.
>
Unless you make writes to the per-cpu variables fault aren't they likely
to be just as easy to overwrite?
David
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2026-12-01 10:32 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-24 20:06 [PATCH v2] x86/fred: Consolidate the FRED stack pointer assignments Sohil Mehta
2026-11-30 22:43 ` Dave Hansen
2026-11-30 23:18 ` H. Peter Anvin
2026-11-30 23:38 ` Dave Hansen
2026-11-30 23:43 ` Sohil Mehta
2026-11-30 23:48 ` Dave Hansen
2026-12-01 0:02 ` Sohil Mehta
2026-12-01 0:06 ` H. Peter Anvin
2026-12-01 10:31 ` David Laight
2026-11-30 23:37 ` Sohil Mehta
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®