From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754401AbbCQLf0 (ORCPT ); Tue, 17 Mar 2015 07:35:26 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:44613 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753388AbbCQLfX (ORCPT ); Tue, 17 Mar 2015 07:35:23 -0400 Date: Tue, 17 Mar 2015 12:36:58 +0100 From: Quentin Casasnovas To: Borislav Petkov Cc: Quentin Casasnovas , Oleg Nesterov , Dave Hansen , Ingo Molnar , Andy Lutomirski , Linus Torvalds , Pekka Riikonen , Rik van Riel , Suresh Siddha , LKML , "Yu, Fenghua" , "H. Peter Anvin" Subject: Re: [PATCH RFC 0/2] x86/fpu: avoid "xstate_fault" in xsave_user/xrestore_user Message-ID: <20150317113658.GC19131@chrystal.uk.oracle.com> References: <54F74F59.5070107@intel.com> <20150315164948.GA28149@redhat.com> <20150316223743.GA14575@chrystal.uk.oracle.com> <20150317094750.GD18917@pd.tnic> <20150317100046.GA19131@chrystal.uk.oracle.com> <20150317112014.GG18917@pd.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150317112014.GG18917@pd.tnic> User-Agent: Mutt/1.5.22 (2013-10-16) X-Source-IP: userv0021.oracle.com [156.151.31.71] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 17, 2015 at 12:20:15PM +0100, Borislav Petkov wrote: > On Tue, Mar 17, 2015 at 11:00:46AM +0100, Quentin Casasnovas wrote: > > Fair point, but AFAIUI we can't do check_insn(XSAVES) alone as of today, > > and the "..." in your "check_isns(XSAVEOPT, ...)" code above would still > > need to contain the outputs operands. > > I think we can do this (see diff the end of this mail). > Right, FWIW I think your approach is valid, but not very generic. Re-using the check_insn() and making it more generic so we can widen its use felt like a better approach to me. AIUI, you didn't like my earlier draft because it wasn't very readable, but I think this was just due to the (bad) example I took and by reworking it a bit more, we could end up with the code you previously envisionned: if (static_cpu_has_safe(X86_FEATURE_XSAVEOPT)) return check_insn(XSAVEOPT, xsave_buf, ...); else if (static_cpu_has_safe(X86_FEATURE_XSAVES) return check_insn(XSAVES, xsave_buf, ...); else return check_insn(XSAVE, xsave_buf, ...) Or maybe you were saying the actual macros weren't readable? > [...] > > But including the fault exception table in the macro is already an > improvement IMO. Agreed, it already looks much nicer with your diff. Quentin