On 10/26/2026 9:04 AM, Sean Christopherson wrote:

> And we'd want to keep the optimizations to elide writes when vCPUs are using 
> the
> same value(s).  So, compile tested only...
> 

Will test this out on real hardware with the MSR_STAR change below.

>  
> +static bool kvm_is_msr_used_in_host(u32 msr)
> +{
> +     if (!cpu_feature_enabled(X86_FEATURE_FRED))
> +             return true;
> +
> +     switch (msr) {
> +     case MSR_STAR:

AFAIU, MSR_STAR is still used with FRED so it shouldn't be included
here. The Spec says in section 4.4:

IA32_STAR:
- Existing use: this MSR is used by the existing operation of SYSCALL
and SYSRET.
- FRED use: FRED event delivery loads the CS and SS selectors with
values derived from IA32_STAR[47:32] (see Section 5.3). ERETU uses the
value of IA32_STAR[63:48] to determine how to load the CS and SS
registers (see Section 6.2.1).

It is expected that operating systems will set IA32_STAR[33:32] to 00B
and IA32_STAR[49:48] to 11B.

Likewise, the kernel also writes to MSR_STAR during syscall_init() and
it has a comment saying: "Except the IA32_STAR MSR, there is NO need to
setup SYSCALL and SYSENTER MSRs for FRED, .."


> +     case MSR_LSTAR:
> +     case MSR_CSTAR:
> +     case MSR_SYSCALL_MASK:
> +             return false;
> +     default:
> +             break;
> +     }
> +     return true;
> +}
> +

Reply via email to