Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4212023imm; Fri, 18 May 2018 00:59:29 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoZ2v+BBHzpRl0yZQjoCzIRjfLp9lAywui91RwU71nOqSsr8az5q787a06ZBC6cz1HS1A1N X-Received: by 2002:a17:902:bc4a:: with SMTP id t10-v6mr8454962plz.343.1526630369760; Fri, 18 May 2018 00:59:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526630369; cv=none; d=google.com; s=arc-20160816; b=nsU1QhBJglMuUdZSBE6u7mWsZ9K5BYnySvr76wqngJVMxHKvmaknrScXUqF85Zt+ZS 2vUhp36Zm3020iRpRGv5bx9PZVHGB126EgQQ8gGIJ5UBz7rWS0ydOcOSDMikfdo8Q0Lb +1x0awawnRLbhZRCKvKAKt4GUOu0KCqfvHJCrG7eNX4MPpc1lgBqYZGSgQda18XtCAzG 1ggPeN6s6RLbYSrhGLvRkgda/dbOMayXq0sioCsGxsf2ZqNzDRgMgbPvWKGtemSywpw7 RrASXqRQXFPsYoM0+dw3tEqOZ/Gl5cVjho5DKTSFJ67SMK5Hs0Kq2ejoyL5C7/qGpndo tyQA== 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=Ezxkz7MZxbPEp7LB9r9zfaQTBS/4DPEobqaYvFIYE5Y=; b=TzotXkAFXLfRnWCZOwo7J9+8kpCGslvj8Q5xCgAA1x8kbbTTJvuwlxzGGaucmFpDgL qfjuJpp46zNywmYWzsXdr18ks9oTIRLLcM8ICUswvgpv/NjEYkRRpdZxzPJZ0bvJ1Z2b qfFGTdBJjP/he8B+fIUWPXnpenH4xk/m9DItYihVkaPwxcxEvwFFrZCEiPi1uwC7vBD5 6DTfOSVCdXIO12O1RTe+31oaX9vVGUp8LmPDrHVv/zH9jKr3Y8hwq2eWfKmYyd6XWcFE +cynkN+Oy7VmN9nQmD1veLSG2nJYP4da8B9VeWFALldYbMjTCOTGi4aMBiQ818xxO2rU d8fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=mdQBsdTg; 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 z14-v6si5558010pgv.514.2018.05.18.00.59.15; Fri, 18 May 2018 00:59:29 -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=bombadil.20170209 header.b=mdQBsdTg; 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 S1751986AbeERH7E (ORCPT + 99 others); Fri, 18 May 2018 03:59:04 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:44284 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750882AbeERH7A (ORCPT ); Fri, 18 May 2018 03:59:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.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=Ezxkz7MZxbPEp7LB9r9zfaQTBS/4DPEobqaYvFIYE5Y=; b=mdQBsdTglmU0t6fYCf6OW1Sbd Vz3P+L3CcbkcQEfQEpcTgxe9azRenEy3nETLbHR729k+cmvabYKpPRddROJ/Cyy/Fv6mqYQKJLcQc ZNscOa00NQHOhuGJ8vFUUtboagxhz0B8zHRDqwTizmdya2Av8q5c7P2JYXkrGFXDZvb+mr9GWn4XM ToNFj8or3zUyhHfCtQZNjoni0zNWDMJoGMjniU4O34/ImCSIlvwXYhLmVJLXC5ACPgwXfKENaRgrW wC5VgnSfQ6/9s9RNPS/Lt/tKkeQiBQ9KL5lp0a3oe/hDpDhaJcopLpbpyu7bpsJuNth+eFkHHYv6Z oVTziucmg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fJaHw-0008Lo-7I; Fri, 18 May 2018 07:58:56 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id EE3262029F1C0; Fri, 18 May 2018 09:58:53 +0200 (CEST) Date: Fri, 18 May 2018 09:58:53 +0200 From: Peter Zijlstra To: Nadav Amit Cc: linux-kernel@vger.kernel.org, x86@kernel.org, nadav.amit@gmail.com, Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Josh Poimboeuf Subject: Re: [PATCH 2/6] x86: bug: prevent gcc distortions Message-ID: <20180518075853.GD12217@hirez.programming.kicks-ass.net> References: <20180517161402.78089-1-namit@vmware.com> <20180517161402.78089-3-namit@vmware.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180517161402.78089-3-namit@vmware.com> 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, May 17, 2018 at 09:13:58AM -0700, Nadav Amit wrote: > +asm(".macro __BUG_FLAGS ins:req file:req line:req flags:req size:req\n" > + "1:\t \\ins\n\t" > + ".pushsection __bug_table,\"aw\"\n" > + "2:\t "__BUG_REL(1b) "\t# bug_entry::bug_addr\n\t" > + __BUG_REL(\\file) "\t# bug_entry::file\n\t" > + ".word \\line" "\t# bug_entry::line\n\t" > + ".word \\flags" "\t# bug_entry::flags\n\t" > + ".org 2b+\\size\n\t" > + ".popsection\n\t" > + ".endm"); > + > +#define _BUG_FLAGS(ins, flags) \ > do { \ > + asm volatile("__BUG_FLAGS \"" ins "\" %c0 %c1 %c2 %c3" \ > + : : "i" (__FILE__), "i" (__LINE__), \ > + "i" (flags), \ > "i" (sizeof(struct bug_entry))); \ > } while (0) This is an awesome hack, but is there really nothing we can do to make it more readable? Esp, that global asm doing the macro definition is a pain to read. Also, can we pretty please used named operands in 'new' code?