From: "Jan Beulich" Subject: Re: [PATCH] x86/xsave: Expose xsave_cntxt_size to avoid reloading xcr0 Date: Wed, 04 Jun 2014 13:32:28 +0100 Message-ID: <538F2DFC0200007800017C1A@mail.emea.novell.com> References: <1401883002-5481-1-git-send-email-andrew.cooper3@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1401883002-5481-1-git-send-email-andrew.cooper3@citrix.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper Cc: Keir Fraser , Xen-devel List-Id: xen-devel@lists.xenproject.org >>> On 04.06.14 at 13:56, wrote: > xstate_ctxt_size(xfeature_mask) is runtime constant after boot. There is no > need to reload xcr0 twice for this basic bounds check. Honestly I'm not in favor of exposing this variable for a not performance critical code path. If we really care about saving a few cycles here, how about having xstate_ctxt_size() check its argument against xfeature_mask and return xsave_cntxt_size if equal? Admittedly that'll need some extra care for the uses of the function in xstate_init(), but it's not horribly difficult to make the current function an internal one, and the global one be a wrapper with that check done first. Jan