Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4224958imm; Fri, 18 May 2018 01:14:34 -0700 (PDT) X-Google-Smtp-Source: AB8JxZred7TawEnHWZEX5QtkRahzChagTI1S2l6ryNrNBaCg07uotfmpeekeMbG2g0IIk+Wiqrm4 X-Received: by 2002:a62:981d:: with SMTP id q29-v6mr8444892pfd.65.1526631274043; Fri, 18 May 2018 01:14:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526631274; cv=none; d=google.com; s=arc-20160816; b=n/PkQZDrUsfeCOpyDru7VPnXckoeCmQ5BhdoV8CFRZXs9rr7iOT2Hsqcd0l6bDTTaN AlXR0AqKyzmk6vmwPesSs7kbERfav/0rhXS17WF5pp3BY85nK9BOijot17PFkxBcT8en ipsjjGRPqovdk1Lq9FClCgfikOPGEfLxQw6SYAbduccIVpVmTz5Z3/gAiZ4IVWepyl1J CH3w3bL4qsMX0DdRwIiucSRwk8Y1J3OXFX97JncswcQ3mxjw38vmxXjSQVF/ULTLtZhQ jOQ8VcTgVRtLUG8XaROOXkyHOj/dh2bn9O5b+KuR8BI6hVSjJerrvjwq2nJsKt1FVyDK x8LA== 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=7aZteVoloZKWnEIwNytYV5+WvKuoAC9fTNDy66zmly0=; b=ZX7+5/SsyE3vBRyEI+mQ+33rPTsxaZPUXlRGbqrkk3q8b+5PoqCYtpIolzVWWfOeYF yUGA1lEQc4FXRxRP3BEM4BJ0yAXS9K/G5/8/KLr7abHavibeB4T12kHn+hkFmIadKMv7 sgo0BusyQGTJ+NHOwk4Gt/7yTlQzT6CC62w80xVm7M0X2IDguP6Byg55YoAKw6x2sWRO xwbRx5KvKSZz5iA0yQA01dFtWhGtvVmVnF35CFDuOTsGPw4t32y8OYu2dBzWf6U5eApJ xyLzN86Be4ianqTxn8Z/DLiutTtPtqZwut+Xgm2f1uzIeddXoG+uicrF3RNdtoFVWJqU uP8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=R72KPFof; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z9-v6si7411663pll.423.2018.05.18.01.14.19; Fri, 18 May 2018 01:14:34 -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=@gmail.com header.s=20161025 header.b=R72KPFof; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751921AbeERIOB (ORCPT + 99 others); Fri, 18 May 2018 04:14:01 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:51324 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751452AbeERIN7 (ORCPT ); Fri, 18 May 2018 04:13:59 -0400 Received: by mail-wm0-f66.google.com with SMTP id j4-v6so12718167wme.1 for ; Fri, 18 May 2018 01:13:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=7aZteVoloZKWnEIwNytYV5+WvKuoAC9fTNDy66zmly0=; b=R72KPFofzOZlT5e0FI57utD7Nm8llx4UB27AGUQVH0OsfeETehk23oHZlZ67mnt1Ci hsNW9VbBWFA0GLBY7Urc05Acd/bztyzUwWVCv3XYDBODZBeHKzXUPfTLs+yh/H2ygHBY LvpzLn7frn1j/z0gqHkmrHGss1ADcqUINNYsuhjv7S/sj6pfrjAb3VHXbiyrX0r1vvB3 lPDg0+ayhatEo0kU6QdwZhylaQckH6R/cuXEZXHVGPhNYgYlfSrYaDo3I2mWyWA6A6yA AgGH2637dHeAgEuOKJpY+Sws2jPqSg5NmOglUEoRrCJQBwybaQfFBoOIHUzfuvLPF5DQ pNRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=7aZteVoloZKWnEIwNytYV5+WvKuoAC9fTNDy66zmly0=; b=OhG8lOKuZPVfQu1Lff4p6oSl6jk2kF2P09cSFawlj9h9m2vYcffKTjLwiy0qI8sH2G KEs/YBpdLxRWMFhiF3m0bPX8Xv0pnAiWnKYxByqjT6pcCZXY6USsD2E17jDtpr0bHPEE yD1mO2VqMGQ7iGkR7gCj6XgoEOeMnx+LwoRVEFgBSMK94n/zo+oSfWUDxdi7bwr6Vw1U QMDFRryc9XOLAJQHm+BYOE5hTdieyjf8187IsQ116EfiWp4GqNAmZJg0lC750g5zrY6D DhCQGvGTYro7cQ7Aw5vepbdGErDqz2iqJSsnsRXILURc7mthhYv/XX+RcYGGCovLSg2e uVZw== X-Gm-Message-State: ALKqPwcb460LlukWjHBo4e/jTHBz8z8VgUf5lCrpOHGpx+3tHB5LgfI2 zHp5rU1sE0FeYfFsGnGaORw= X-Received: by 2002:a1c:130d:: with SMTP id 13-v6mr3933308wmt.109.1526631237881; Fri, 18 May 2018 01:13:57 -0700 (PDT) Received: from gmail.com (2E8B0CD5.catv.pool.telekom.hu. [46.139.12.213]) by smtp.gmail.com with ESMTPSA id w31-v6sm19293840wrb.93.2018.05.18.01.13.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 May 2018 01:13:57 -0700 (PDT) Date: Fri, 18 May 2018 10:13:54 +0200 From: Ingo Molnar To: Peter Zijlstra Cc: Nadav Amit , linux-kernel@vger.kernel.org, x86@kernel.org, nadav.amit@gmail.com, Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Josh Poimboeuf , Linus Torvalds , Andy Lutomirski , Borislav Petkov , Peter Zijlstra , Denys Vlasenko Subject: Re: [PATCH 2/6] x86: bug: prevent gcc distortions Message-ID: <20180518081354.GA11379@gmail.com> References: <20180517161402.78089-1-namit@vmware.com> <20180517161402.78089-3-namit@vmware.com> <20180518075853.GD12217@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180518075853.GD12217@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Peter Zijlstra wrote: > 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? Yes, that's my main worry too about all these inlining changes: the very, very marked reduction in the readability of assembly code. It's bad to an extent that I'm questioning the wisdom of pandering to a compiler limitation to begin with? How about asking GCC for an attribute where we can specify the inlined size of an asm() function? Even if we'll just approximate it due to some vagaries of actual code generation related to how arguments interact with GCC, an explicit byte value will do a heck of a better job of it than some sort of implied, vague 'number of newlines' heuristics ... Thanks, Ingo