lkml.org 
[lkml]   [2021]   [Dec]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [patch 4/6] x86/fpu: Add guest support to xfd_enable_feature()
Date
On Wed, Dec 15 2021 at 05:46, Kevin Tian wrote:
>> From: Thomas Gleixner <tglx@linutronix.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,

tglx

\
 
 \ /
  Last update: 2021-12-15 10:54    [W:0.076 / U:0.424 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site