From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D87E0C28CF8 for ; Sat, 13 Oct 2018 21:21:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9CA5420693 for ; Sat, 13 Oct 2018 21:21:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9CA5420693 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ispras.ru Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726289AbeJNE7T (ORCPT ); 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