Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3773952imm; Mon, 11 Jun 2018 01:19:26 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJt2Sa/pKRD4tRF8/lI1TeGMlhO77bgMI1w6OCx9xIZFSkUnOso83wfPxFY4gkdXrwrP/O+ X-Received: by 2002:a17:902:aa83:: with SMTP id d3-v6mr17554061plr.323.1528705166257; Mon, 11 Jun 2018 01:19:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528705166; cv=none; d=google.com; s=arc-20160816; b=OsxEB5cm9HIUs8nFLstRDE6/g8YQxTkx3dSX9jY2lU3P/tyrnmP4XXzRzw3cB4ZHO/ vIztio0yvL7spErLzSzPFpO7rOypiqCYY+4BgDB1h0rfjOPlQdSsVwB1iznTfScB6FQa wDGhP+yUKnzbdYpfbNrwoEqWEIH+1ArjMkEq5Z/P+vDEMH+fMI3gx+aYhQHwnjtbRHGO 7NGh43TfQmQNypwT45p4dhTG0u+GQoro8rzoCtq6YYDbYXQsAmY3kS6e1+LPPUVsByTy dilso6GlTIccZz/eToE68oH/5wnvi/p+HDCeNnG7iw1xLvblR+LpD328ZGe79Q+YLzjw W6Og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=6BMWYUn12JKyHvd/D7ydLx4ChhZ9FP/umOV3TpOFp2w=; b=Dq0aAAe3IXTkPiJ9tZePVftWnJNeJl+Gg+HxDjN5110JVCwPsSy14LZQpdn+eXEnVP oFOJwfU1FKjL72P7hbYxdaKfA1QLSHRaDutIpYqlAHeMGgH1Ym59vFDXTYIcPmOCm/dW bhxMzFbGF41e6L/Hgc4OyPze3sGTLT9OyJHH6ADTsRh1Uajancaeq0CsG81zJj1bC9vK bqiPzPcav+YvPy/X9Bn5IHhnc1FLAjAjAZxmw9NHdefJv8kvQep/CoOuJnF8ImhDtNnI JpYo/uBpDif/mGck1qZIn1tZfRCF3uBnbk41m5+t8ICnIj8Sb2UtWsw6rDkbIZ0/BGpB YKNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=mkut4LyW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n4-v6si21374330plp.128.2018.06.11.01.19.11; Mon, 11 Jun 2018 01:19:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=mkut4LyW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754157AbeFKIRn (ORCPT + 99 others); Mon, 11 Jun 2018 04:17:43 -0400 Received: from merlin.infradead.org ([205.233.59.134]:56734 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754146AbeFKIRk (ORCPT ); Mon, 11 Jun 2018 04:17:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=6BMWYUn12JKyHvd/D7ydLx4ChhZ9FP/umOV3TpOFp2w=; b=mkut4LyWjRaeNFd2N7nVTvosS 3QYp0Kqcgl922ouu9CycSjXn6yult5uQWQSV8AVBQuHNGa+ShUmcnuGz9Ccyrkh9/loteI4YaCD7k DSd0HVUfF251aUJx8H0MnEvctmlPn7npf6aG4VwxvlCAAv0rbC9GtnIOPJ+GGklMqBMk+ikxZB4MD pxNvQYKEMhPfdif1uymAfpP906YoCEPTUYR0AgJoAbcvwUifVsmzlfbVbNWfIFL2YXC76N1oP86Mj 5vctuOaMfo+oi31iLoVzsm9K6GXHbe7lZx3LFjIiD7vL1Q3fq7SZ/uu3vxm+SujkYWpDGsgxlq+7b ynA9/easQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fSI0g-0004s9-40; Mon, 11 Jun 2018 08:17:06 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id D149F201EA7B1; Mon, 11 Jun 2018 10:17:04 +0200 (CEST) Date: Mon, 11 Jun 2018 10:17:04 +0200 From: Peter Zijlstra To: Andy Lutomirski Cc: Yu-cheng Yu , LKML , linux-doc@vger.kernel.org, Linux-MM , linux-arch , X86 ML , "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , "H. J. Lu" , "Shanbhogue, Vedvyas" , "Ravi V. Shankar" , Dave Hansen , Jonathan Corbet , Oleg Nesterov , Arnd Bergmann , mike.kravetz@oracle.com Subject: Re: [PATCH 02/10] x86/cet: Introduce WRUSS instruction Message-ID: <20180611081704.GI12180@hirez.programming.kicks-ass.net> References: <20180607143807.3611-1-yu-cheng.yu@intel.com> <20180607143807.3611-3-yu-cheng.yu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 07, 2018 at 09:40:02AM -0700, Andy Lutomirski wrote: > On Thu, Jun 7, 2018 at 7:41 AM Yu-cheng Yu wrote: > Peterz, isn't there some fancy better way we're supposed to handle the > error return these days? > > + asm volatile("1:.byte 0x66, 0x0f, 0x38, 0xf5, 0x37\n" > > + "xor %[err],%[err]\n" > > + "2:\n" > > + ".section .fixup,\"ax\"\n" > > + "3: mov $-1,%[err]; jmp 2b\n" > > + ".previous\n" > > + _ASM_EXTABLE(1b, 3b) > > + : [err] "=a" (err) > > + : [val] "S" (val), [addr] "D" (addr) > > + : "memory"); So the alternative is something like: __visible bool ex_handler_wuss(const struct exception_table_entry *fixup, struct pt_regs *regs, int trapnr) { regs->ip = ex_fixup_addr(fixup); regs->ax = -1L; return true; } int err = 0; asm volatile("1: INSN_WUSS\n" "2:\n" _ASM_EXTABLE_HANDLE(1b, 2b, ex_handler_wuss) : "=a" (err) : "S" (val), "D" (addr)); But I'm not at all sure that's actually better.