[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BN9PR11MB5276D9BADF36A750ED9ACD3D8C769@BN9PR11MB5276.namprd11.prod.outlook.com>
Date: Wed, 15 Dec 2021 10:02:44 +0000
From: "Tian, Kevin" <kevin.tian@...el.com>
To: Thomas Gleixner <tglx@...utronix.de>,
Paolo Bonzini <pbonzini@...hat.com>,
LKML <linux-kernel@...r.kernel.org>
CC: Jing Liu <jing2.liu@...ux.intel.com>,
"Zhong, Yang" <yang.zhong@...el.com>,
"x86@...nel.org" <x86@...nel.org>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"Christopherson,, Sean" <seanjc@...gle.com>,
"Nakajima, Jun" <jun.nakajima@...el.com>
Subject: RE: [patch 4/6] x86/fpu: Add guest support to xfd_enable_feature()
> From: Thomas Gleixner <tglx@...utronix.de>
> Sent: Wednesday, December 15, 2021 5:53 PM
>
> On Wed, Dec 15 2021 at 05:46, Kevin Tian wrote:
> >> From: Thomas Gleixner <tglx@...utronix.de>
> >> + if (guest_fpu) {
> >> + newfps->is_guest = true;
> >> + newfps->is_confidential = curfps->is_confidential;
> >> + newfps->in_use = curfps->in_use;
> >
> > What is the purpose of this 'in_use' field? Currently it's only
> > touched in three places:
> >
> > - set when entering guest;
> > - cleared when exiting to userspace;
> > - checked when freeing a guest FPU;
> >
> > The last one can be easily checked by comparing to current fps.
>
> I added it for paranoia sake because the destruction of the KVM FPU
> state is not necessarily in the context of the vCPU thread. Yes, it
> should not happen...
>
> >> + if (guest_fpu) {
> >> + curfps = xchg(&guest_fpu->fpstate, newfps);
> >
> > This can be a direct value update to guest_fpu->fpstate since
> > curfps has already been acquired in the start.
>
> Indeed.
>
Thanks for confirmation. We'll include those changes in next version.
Thanks
Kevin
Powered by blists - more mailing lists