Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2274531imm; Sat, 13 Oct 2018 14:23:03 -0700 (PDT) X-Google-Smtp-Source: ACcGV60bpft0m/AD/IsteGD1GLIsILedAM0I+yMZGo/sCgZMGMZHc4ioHIAn65ro1SgyPgvbCeki X-Received: by 2002:aa7:8305:: with SMTP id t5-v6mr11416017pfm.81.1539465783749; Sat, 13 Oct 2018 14:23:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539465783; cv=none; d=google.com; s=arc-20160816; b=fHc9lYgeikTSXQ4OUr+DYj3GYC5kR96UpO5bxPAiuIYVQdJK0RUn76ncaH0K8BVrpN t1GTQezwLvx8k0J0Bq4kWyHXrKMFwd3atnL04nc9smizG6n2ACDP1S9ssTZRiGnV4HwD 0By6s+mOkdgcA3jV+7EjBLNpaUwfWBsvO76iPyoR3yxsfYWFdMgPmTLntVPvZNHP1nX0 m3bpGmJFbhJM1uxkQBHcWNwyjEZrhY+JnFKqzcE8PmpcYqHuHr4wkl1k9pkeH0norpdh 70jkxiZ4WvnTyUHOc2iCB0dOJlKrPSlfkmP99XBxQeIIdI5xgBD1oILW37NfwPbM3re6 ExpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=2ksrMqhtNAbbRisbc0CDvt7vhM7FyevUhi1aFbBuGl0=; b=TN+ufyO/lJkByvzi7qB0ZTeScCn3IEt0IBOm1Gv6QflSNwHs8HQAO4MDp0k+FwDEnZ PaGozJf/bVaDU0J7Saiij7u6fecOM3SxtG7MZ5Gv6tNCFis/YfEoNDogMbMfASm3bhV/ VrhKH5XALfoiY5Eq6NVhI6Nnq+he88XWJf+VPbKxltQxDeov+guPKUe+CNC5uqh04myQ nOzdHXfFxJlivmOFigfJjKfhRLRADuIfG0WE/uDitvFHQ7zmuN/PIZzSR3zE6rAtqo4b PQFEzV+hb5eEEu6X2IIomCex81aLrgDqUXUXvqNj1a9/lZ12sLUQmbXb+4EMsPgZhCrM jW5w== ARC-Authentication-Results: i=1; mx.google.com; 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 j190-v6si4911319pgc.149.2018.10.13.14.22.48; Sat, 13 Oct 2018 14:23:03 -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; 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 S1726260AbeJNE7T (ORCPT + 99 others); Sun, 14 Oct 2018 00:59:19 -0400 Received: from bran.ispras.ru ([83.149.199.196]:23789 "EHLO smtp.ispras.ru" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725734AbeJNE7S (ORCPT ); Sun, 14 Oct 2018 00:59:18 -0400 X-Greylist: delayed 395 seconds by postgrey-1.27 at vger.kernel.org; Sun, 14 Oct 2018 00:59:18 EDT Received: from monopod.intra.ispras.ru (monopod.intra.ispras.ru [10.10.3.121]) by smtp.ispras.ru (Postfix) with ESMTP id 51A00203CD; Sun, 14 Oct 2018 00:14:02 +0300 (MSK) Date: Sun, 14 Oct 2018 00:14:02 +0300 (MSK) From: Alexander Monakov To: Borislav Petkov cc: Segher Boessenkool , Ingo Molnar , Richard Biener , Michael Matz , gcc@gcc.gnu.org, Nadav Amit , Ingo Molnar , linux-kernel@vger.kernel.org, x86@kernel.org, Masahiro Yamada , Sam Ravnborg , Alok Kataria , Christopher Li , Greg Kroah-Hartman , "H. Peter Anvin" , Jan Beulich , Josh Poimboeuf , Juergen Gross , Kate Stewart , Kees Cook , linux-sparse@vger.kernel.org, Peter Zijlstra , Philippe Ombredanne , Thomas Gleixner , virtualization@lists.linux-foundation.org, Linus Torvalds , Chris Zankel , Max Filippov , linux-xtensa@linux-xtensa.org, Andrew Morton Subject: Re: PROPOSAL: Extend inline asm syntax with size spec In-Reply-To: <20181013193335.GD31650@zn.tnic> Message-ID: References: <20181008073128.GL29268@gate.crashing.org> <20181009145330.GT29268@gate.crashing.org> <20181010072240.GB103159@gmail.com> <20181010080324.GV29268@gate.crashing.org> <20181010081906.GA5533@zn.tnic> <20181010185432.GB29268@gate.crashing.org> <20181010191427.GF5533@zn.tnic> <20181013193335.GD31650@zn.tnic> User-Agent: Alpine 2.20.13 (LNX 116 2015-12-14) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Sat, 13 Oct 2018, Borislav Petkov wrote: > > Thoughts, suggestions, etc are most welcome. I apologize for coming in late here with an alternative proposal, but would you be happy if GCC gave you a way to designate a portion of the asm template string that shouldn't be counted as its cost because it doesn't go into the .text section? This wouldn't interact with your redefinitions of the inline keyword, and you could do something like (assuming we go with %` ... %` delimiters) [if gcc-9 or compatible] #define ASM_NONTEXT_START "%`\n" #define ASM_NONTEXT_END "%`\n" [else] #define ASM_NONTEXT_START "\n" #define ASM_NONTEXT_END "\n" [endif] #define _BUG_FLAGS(ins, flags) \ do { \ asm volatile("1:\t" ins "\n" \ ASM_NONTEXT_START \ ".pushsection __bug_table,\"aw\"\n" \ "2:\t" __BUG_REL(1b) "\t# bug_entry::bug_addr\n" \ "\t.word %c0" "\t# bug_entry::flags\n" \ "\t.org 2b+%c1\n" \ ".popsection" \ ASM_NONTEXT_END \ : : "i" (flags), \ "i" (sizeof(struct bug_entry))); \ } while (0) I think it's nicer because it also allows the compiler to estimate asm length for branch range optimization more accurately. Alexander