From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934520AbbCQJu0 (ORCPT ); Tue, 17 Mar 2015 05:50:26 -0400 Received: from cantor2.suse.de ([195.135.220.15]:36929 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932486AbbCQJtZ (ORCPT ); Tue, 17 Mar 2015 05:49:25 -0400 Date: Tue, 17 Mar 2015 10:47:50 +0100 From: Borislav Petkov To: Quentin Casasnovas Cc: 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: <20150317094750.GD18917@pd.tnic> References: <54F74F59.5070107@intel.com> <20150315164948.GA28149@redhat.com> <20150316223743.GA14575@chrystal.uk.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20150316223743.GA14575@chrystal.uk.oracle.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 16, 2015 at 11:37:44PM +0100, Quentin Casasnovas wrote: ... > __user_insn("btl [var2], %0 \n\t", > , /* no outputs, no need for dummy arg */ > SINGLE_ARG("r" (var1), [var2] "r" (var2)), /* two inputs */ > "cc"); So this becomes pretty unreadable IMO. And we shouldn't go nuts with optimizing this and sacrifice readability a lot. TBH, I'd much prefer: if (static_cpu_has_safe(X86_FEATURE_XSAVEOPT)) { check_insn(XSAVEOPT, ...); return; } if (static_cpu_has_safe(X86_FEATURE_XSAVES)) { check_insn(XSAVES); return; } check_insn(XSAVE, ...) which is pretty clear. 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. -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply. --