On Fri, Oct 26, 2018 at 7:49 AM Dave Hansen <dave.hansen@xxxxxxxxx> wrote: > > On 10/26/18 7:45 AM, Matthew Wilcox wrote: > > struct fpu user_fpu; /* 2176 4160 */ > > struct fpu guest_fpu; /* 6336 4160 */ > > Those are *not* supposed to be embedded in any other structures. My bad > for not documenting this better. > > It also seems really goofy that we need an xsave buffer in the > task_struct for user fpu state, then another in the vcpu. Isn't one for > user state enough? > > In any case, I'd suggest getting rid of 'user_fpu', then either moving > 'guest_fpu' to the bottom of the structure, or just make it a 'struct > fpu *' and dynamically allocating it separately. I've written a patch to get rid of user_fpu, as suggested here and will be sending that out shortly. > > To do this, I'd take fpu__init_task_struct_size(), and break it apart a > bit to tell you the size of the 'struct fpu' separately from the size of > the 'task struct'. I've written a 2nd patch to make guest_cpu a 'struct fpu *' and dynamically allocate it separately. The reason I went with this suggestion, rather than moving 'struct fpu' to the bottom of kvm_vcpu_arch is because I believe that solution would still expand the kvm_vcpu_arch by the size of the fpu, according to which fpregs_state was in use.