lkml.org 
[lkml]   [2024]   [Apr]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH v2 09/25] KVM: VMX: Switch FRED RSP0 between host and guest
Date
> >+		if (unlikely(vmx->msr_host_fred_rsp0 == 0))
> >+ vmx->msr_host_fred_rsp0 =
> read_msr(MSR_IA32_FRED_RSP0);
>
> can we just drop this and use "(unsigned long)task_stack_page(current) +
> THREAD_SIZE"
> as host fred rsp0?

I thought about it, however, don't see a strong reason that it's better,
i.e., is RDMSR slower than reading 'stack' from current task_struct?

>
> >+ wrmsrl(MSR_IA32_FRED_RSP0, vmx->msr_guest_fred_rsp0);
>
> any reason to not use wrmsrns?

Good call!


> >+ }
> > #else
> > savesegment(fs, fs_sel);
> > savesegment(gs, gs_sel);
> >@@ -1381,6 +1391,11 @@ static void vmx_prepare_switch_to_host(struct
> vcpu_vmx *vmx)
> > invalidate_tss_limit();
> > #ifdef CONFIG_X86_64
> > wrmsrl(MSR_KERNEL_GS_BASE, vmx->msr_host_kernel_gs_base);
> >+
> >+ if (guest_can_use(&vmx->vcpu, X86_FEATURE_FRED)) {
> >+ vmx->msr_guest_fred_rsp0 = read_msr(MSR_IA32_FRED_RSP0);
> >+ wrmsrl(MSR_IA32_FRED_RSP0, vmx->msr_host_fred_rsp0);
>
> same question.

Will do!

Thanks!
Xin


\
 
 \ /
  Last update: 2024-05-27 16:47    [W:0.258 / U:0.356 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site