From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Desaulniers Subject: Re: [PATCH v5] KVM: x86: avoid large stack allocations in em_fxrstor Date: Wed, 31 May 2017 18:05:05 -0700 Message-ID: <20170601010505.jl7dlat3zaaw6osf@lostoracle.net> References: <20170529224858.9942-1-nick.desaulniers@gmail.com> <20170531030838.23182-1-nick.desaulniers@gmail.com> <1815926933.3699401.1496228489339.JavaMail.zimbra@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Radim =?utf-8?B?S3LEjW3DocWZ?= , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org To: Paolo Bonzini Return-path: Received: from mail-pf0-f180.google.com ([209.85.192.180]:33188 "EHLO mail-pf0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751327AbdFABFK (ORCPT ); Wed, 31 May 2017 21:05:10 -0400 Content-Disposition: inline In-Reply-To: <1815926933.3699401.1496228489339.JavaMail.zimbra@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, May 31, 2017 at 07:01:29AM -0400, Paolo Bonzini wrote: > > + size = offsetof(struct fxregs_state, xmm_space[16]); > This still has the same issue (it should be multiplied by 4). I'm still misunderstanding the math here. Why multiplied by four, in this case? 8 * 16 / 4 is used in other cases. Also, previously Radim wrote: >> + size = offsetof(struct fxregs_state, xmm_space[8]); > This should be the size of first 8 XMM registers, but xmm_space is of > type u32, so the correct size is > xmm_space[8 * 16/sizeof(*fx_state.xmm_space)]. So I think my calculation is off in xmm_offset still? Can we make use of well-named variables, in place of these constants? Otherwise the math is hard to follow. > Thanks Nick for the patches and Radim for the reviews! > Paolo Thanks for the code review!