From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754582AbbCQKGJ (ORCPT ); Tue, 17 Mar 2015 06:06:09 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:20124 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752297AbbCQKGC (ORCPT ); Tue, 17 Mar 2015 06:06:02 -0400 Date: Tue, 17 Mar 2015 11:07:36 +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: <20150317100736.GB19131@chrystal.uk.oracle.com> References: <54F74F59.5070107@intel.com> <20150315164948.GA28149@redhat.com> <20150316223743.GA14575@chrystal.uk.oracle.com> <20150317094750.GD18917@pd.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150317094750.GD18917@pd.tnic> User-Agent: Mutt/1.5.22 (2013-10-16) X-Source-IP: acsinet22.oracle.com [141.146.126.238] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 17, 2015 at 10:47:50AM +0100, Borislav Petkov wrote: > > We can even go a step further and add a static_cpu_has_safe thing which > checks two features instead of one. The penalty we'd get is a single > inconditional JMP which in the face of XSAVE* is nothing. > What was the argument against adding a check_alternative_input(...) so the ex_table entry are managed inside the macro directly? It leaves less room for errors and would still be reable IMO: err = check_alternative_input_2(XSAVE, XSAVESOPT, X86_FEATURE_XSAVEOPT XSAVES, X86_FEATURE_XSAVES, , , ); if (err) do_something(); That hypothetical check_alternative_input_2() would call a rework of check_insn() supporting an arbitrary numbers of inputs, outputs and clobbers as drafted in my previous e-mail. Quentin