[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YZPWsICdDTZ02UDu@google.com>
Date: Tue, 16 Nov 2021 16:05:04 +0000
From: Sean Christopherson <seanjc@...gle.com>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: "Liu, Jing2" <jing2.liu@...el.com>,
Paolo Bonzini <pbonzini@...hat.com>,
LKML <linux-kernel@...r.kernel.org>,
"x86@...nel.org" <x86@...nel.org>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"Nakajima, Jun" <jun.nakajima@...el.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Arjan van de Ven <arjan@...ux.intel.com>,
Jing Liu <jing2.liu@...ux.intel.com>,
"Cooper, Andrew" <andrew.cooper3@...rix.com>,
"Bae, Chang Seok" <chang.seok.bae@...el.com>
Subject: Re: 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();
>
>
>
Powered by blists - more mailing lists