From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on archive.lwn.net X-Spam-Level: X-Spam-Status: No, score=-5.6 required=5.0 tests=DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by archive.lwn.net (Postfix) with ESMTP id F3EE77D043 for ; Mon, 11 Jun 2018 08:18:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754149AbeFKIRm (ORCPT ); Mon, 11 Jun 2018 04:17:42 -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-doc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-doc@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. -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html