lkml.org 
[lkml]   [2021]   [Nov]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Thoughts of AMX KVM support based on latest kernel
On Tue, Nov 16, 2021, Thomas Gleixner wrote:
> > One of potential drawbacks of the Option 2 might be additional
> > checks in the host, although we can minimize the impact by having
> > CONFIG_KVM_TBD. We believe that the case
> > "XFD != 0 and XINUSE != 0" should be very infrequent.
>
> I really don't like the idea of having an extra check in switch_to().
>
> Can we start simple and do something like the uncompiled below and see
> how much overhead it creates?
>
> Thanks,
>
> tglx
> ---

...

> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 2686f2edb47c..9425fdbb4806 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -9576,6 +9576,8 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
> vcpu->arch.last_vmentry_cpu = vcpu->cpu;
> vcpu->arch.last_guest_tsc = kvm_read_l1_tsc(vcpu, rdtsc());
>
> + kvm_update_guest_xfd_state();

Is there a reason the XFD switch can't key off TIF_NEED_FPU_LOAD a la the other
FPU stuff? I.e. piggyback this snippet in vcpu_enter_guest():

if (test_thread_flag(TIF_NEED_FPU_LOAD))
switch_fpu_return();
> +
> vcpu->mode = OUTSIDE_GUEST_MODE;
> smp_wmb();
>
>
>

\
 
 \ /
  Last update: 2021-11-16 17:07    [W:0.130 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site