Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp168296ybe; Wed, 4 Sep 2019 17:21:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqzTt5mGsWBJAYj/dj/1xrMdbNXCaSspAGEytJvVx40EcgdueUyWxFGYnL9XFkfi0oLhn8MN X-Received: by 2002:a63:ea14:: with SMTP id c20mr659063pgi.185.1567642908225; Wed, 04 Sep 2019 17:21:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567642908; cv=none; d=google.com; s=arc-20160816; b=E00Lg/clHFwbTUaCT3Q8vMdCHAdhJdWRGhW1c/HyTKkwoK5+fGOu8Xn/QG7EEafB+C yaQ7bVp9I/bWW9iUS0i6CholCpUrG0Z3BxrcUeobJ6puoMjLQLZi46xFvV1K9e4Bta2Z aGk5X/pfIsOKriX/l4gtGaZ94wi27lW75tjgg+JSvjK2tjAeQUu4S5qYxtXG4hx9oNxI ludIac8oMPjb3m+cui6Ae5t/+FwggscdSQ1atbWPDBrRLKhI4yR24ozRecLx8emUoB7m oJszOTDUPiMBdsyFn9+jceKRCzzXxKThxrb8KXfflQ1kt4DoZ89RD0tS1h+bAGMbua5p YARA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=lvl67MVvuI7hrqwUxQ6/9R19L/ScUzDtg4FInDuKyNs=; b=UkwQs+dB1BVPTi39PXVbY2macHmRTYda1AhJr/2n/9UsliJfGczeKf8w+pjW+0tX8Z zHlhYkMSJoOjJNYTW2DhqQ2X5cb7EelsiP9cnSqIZl4nJ2RMLIR137XGcYOmXXCZcMor lxWk7ePS+MY+PahZhQiQVCteT0BCi3h5HQU1X2WkOOGZFuvRA34/uyr2nMNR4+9XW5iS Eioe5lN+jErIp0CD/m1Idvk69ww4ELn1+fnE7Lc4WXe03hw0RrzqHoPsWgrgm9SWTrW2 qlEPCUZHNge9Ju3YrBOZIxF6WvOjr9jemMWuzVscTmPzxfIShtsuONlonHSHL0ih9qLA iQAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=RFscreOg; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g7si331726pfr.4.2019.09.04.17.21.31; Wed, 04 Sep 2019 17:21:48 -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=pass header.i=@google.com header.s=20161025 header.b=RFscreOg; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730303AbfIEATF (ORCPT + 99 others); Wed, 4 Sep 2019 20:19:05 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:41497 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727722AbfIEATE (ORCPT ); Wed, 4 Sep 2019 20:19:04 -0400 Received: by mail-pg1-f196.google.com with SMTP id x15so338047pgg.8 for ; Wed, 04 Sep 2019 17:19:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=lvl67MVvuI7hrqwUxQ6/9R19L/ScUzDtg4FInDuKyNs=; b=RFscreOg08IfubTlLj2YYhjd0OvNG3zaaPaFHTZbdCE9qdNznzVZhaZ2UKIvwlvkjr 3wVdpNot1KLmfS5xwyOtVNZwTO42xUVmrhtIi5I+eTVXcJOzQUm7FwuSETQypmJPjTlF bGFoZxRct4EUSawtVplUB9tyGqQ4TBIszPJDwUMWTw8mP3UPkXUagFieaKDRAyl60Zht bDD6K4I/k21yxuQK3G85JyC1IEFHUrOpL7+N9AM11LFk7NaE5F/GcWG1PJ77pP5mtUWF aCckbTvvevKqzwE4iWinj1k432oGbcxdo0ICucsmQh5sm5FFkyR2qY/NC1BawKPm3YnD 9WHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=lvl67MVvuI7hrqwUxQ6/9R19L/ScUzDtg4FInDuKyNs=; b=Kzt2Z5Jyqdn1z7Nh5XPoRzZSsSBajEnRA446Ajjr2ioPmMRij1TgMgxzabWyTh+zjh I/jrGv45Ha0ln9RsnERP+u68y/dh4QPZBPwLbFmcT2pTybNBGqAkrw3eGTG2IFyuxhB7 xHN0eEcn1bZjayiVst49mFHeh8Tut88CbGf+HmIxBNnBfSx7CLEulAe/vXJ+eLC93vGk R2NGwNRgE0iH3ACUdfC2Qocg9JVDHP7rttomj1937bsF7BYqVV53Vzb50itvv1HsnyG7 ZAUF9WgfrEPqySL7E9BWXPgIGIU24/c7437asLB+q3ik/SstMU/n/FwHLMn7SI53R4EF dr7Q== X-Gm-Message-State: APjAAAW3qN+XX+DCZXzfwAlyQ3EjRzRIfRRWp/emMvMi+FLMXRpQmKIW NEUbe15/Qo/lASPo/cd1JbgLZlhw0MD3VEgMok7HlA== X-Received: by 2002:aa7:8085:: with SMTP id v5mr439950pff.165.1567642743648; Wed, 04 Sep 2019 17:19:03 -0700 (PDT) MIME-Version: 1.0 References: <20190829083233.24162-1-linux@rasmusvillemoes.dk> <20190830231527.22304-1-linux@rasmusvillemoes.dk> <20190830231527.22304-5-linux@rasmusvillemoes.dk> In-Reply-To: <20190830231527.22304-5-linux@rasmusvillemoes.dk> From: Nick Desaulniers Date: Wed, 4 Sep 2019 17:18:52 -0700 Message-ID: Subject: Re: [PATCH v2 4/6] compiler-gcc.h: add asm_inline definition To: Rasmus Villemoes Cc: "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , LKML , Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" , Nadav Amit , Linus Torvalds , Miguel Ojeda Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 30, 2019 at 4:15 PM Rasmus Villemoes wrote: > > This adds an asm_inline macro which expands to "asm inline" [1] when gcc > is new enough (>= 9.1), and just asm for older gccs and other > compilers. > > Using asm inline("foo") instead of asm("foo") overrules gcc's > heuristic estimate of the size of the code represented by the asm() > statement, and makes gcc use the minimum possible size instead. That > can in turn affect gcc's inlining decisions. > > I wasn't sure whether to make this a function-like macro or not - this > way, it can be combined with volatile as > > asm_inline volatile() > > but perhaps we'd prefer to spell that > > asm_inline_volatile() > > anyway. > > [1] Technically, asm __inline, since both inline and __inline__ > are macros that attach various attributes, making gcc barf if one > literally does "asm inline()". However, the third spelling __inline is > available for referring to the bare keyword. > > Signed-off-by: Rasmus Villemoes > --- > include/linux/compiler-gcc.h | 4 ++++ > include/linux/compiler_types.h | 4 ++++ > 2 files changed, 8 insertions(+) > > diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h > index d7ee4c6bad48..544b87b41b58 100644 > --- a/include/linux/compiler-gcc.h > +++ b/include/linux/compiler-gcc.h > @@ -172,3 +172,7 @@ > #endif > > #define __no_fgcse __attribute__((optimize("-fno-gcse"))) > + > +#if GCC_VERSION >= 90100 Is it too late to ask for a feature test macro? Maybe one already exists? I was not able to find documentation or a bug on `asm inline`. I'm quite curious how you even found or heard of this feature. To the source we must go... > +#define asm_inline asm __inline > +#endif > diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h > index ee49be6d6088..ba8d81b716c7 100644 > --- a/include/linux/compiler_types.h > +++ b/include/linux/compiler_types.h > @@ -198,6 +198,10 @@ struct ftrace_likely_data { > #define asm_volatile_goto(x...) asm goto(x) > #endif > > +#ifndef asm_inline > +#define asm_inline asm > +#endif > + > #ifndef __no_fgcse > # define __no_fgcse > #endif > -- > 2.20.1 > -- Thanks, ~Nick Desaulniers