Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp232534imn; Wed, 3 Aug 2022 01:20:39 -0700 (PDT) X-Google-Smtp-Source: AA6agR7Ondf9bHqABohFKiRj/QF4yU29zaDx2uz/zeJxFitu+XDGJITt3dbnsCm50JKYCGsmxGre X-Received: by 2002:a63:e25:0:b0:41c:30f7:c39c with SMTP id d37-20020a630e25000000b0041c30f7c39cmr9372093pgl.147.1659514839729; Wed, 03 Aug 2022 01:20:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659514839; cv=none; d=google.com; s=arc-20160816; b=khEv8Ke16BY9W5lCX8bN6mTMeDyRk1HoK8k+1BtbLogzdzvpRABde0Bh+qbZuEdN1w 8ct4g/94rlyvLpXkJ168In2Uj1h0YH/wuJb4PAuF8hSvHSHAlbvpmKDeewGPS0Khk3tP Qypf2jDM7O7ZklrNlWVYsE0wtyJ09gdGu9wKxdIVHtHm07c/zcv0n3ZqHkP1aiwTAybZ uCtMcYAzjktKoQLRvZ9hAZ7Xq471fTadyYL/9MZOkFZgJvShmFMXagbfux3g7T0NxWH9 JCNArGq+PcsDQsLdZt3UJabRs/oqVfafUZW1FlOkaeeBU1xZeny9NOYYi50wHyOhEn9S XM0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:date:from:dkim-signature; bh=l1hEI332NfT1JuaXAK4dv586CJr0lsUfuhuRLOyrE/U=; b=cUBsw8DPSSarB8fVlCeFhOzD97z9iGF0DidpMYmsIYoqn64JUJShummAhs6oWC6nhr 8hyUU8dEGQr/csIQWYgFGKN9tSgMUedBjjsJtluWd8eWbEKEBch+6v+4BAkzryXY4JzQ rJbUTPi6wrtNMekT7EmzIdpFfCWJyy2TWVIhL8Y6XfFlHSRKiTh2ybHya98G1GF6/X25 3nF3oPSP/1URCQM0gF8Yz/dzSfTokGgHa8xJC2Ox14FnxLPl+1lFnCFTezlL6DlCa5Sl Vc3xvkM33tLS7eEzFVvdyK12ZCqQR943gFH/02c+g53+k+U8HiOnJwovhZK3rWRhCLj6 WwMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=PNxl3iOh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u82-20020a627955000000b0052d295558desi11428977pfc.373.2022.08.03.01.20.24; Wed, 03 Aug 2022 01:20:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=PNxl3iOh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235905AbiHCITo (ORCPT + 99 others); Wed, 3 Aug 2022 04:19:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233565AbiHCITk (ORCPT ); Wed, 3 Aug 2022 04:19:40 -0400 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EFE160D0; Wed, 3 Aug 2022 01:19:39 -0700 (PDT) Received: by mail-ed1-x532.google.com with SMTP id w3so4842773edc.2; Wed, 03 Aug 2022 01:19:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:date:from:from:to :cc; bh=l1hEI332NfT1JuaXAK4dv586CJr0lsUfuhuRLOyrE/U=; b=PNxl3iOhkhoiomYAywGEUu6Or+U6/6U9qXaRBf+w5tOTvR7gDSZyLXxg85QTFLXOzZ /3nOjeXG+5+i9nscnGlJnMU9w9li4lA1MZiISFbWjRsY6F2WWvDMKMN0QJOOzT3XT2nv x0QmWevrvXfttf65MqnOUbrnBl7vZbFMJfV/ZeLxGNBKfRGvjRUg0wWuXmkuvYIHE89M 8bDQxO7PS3hoEa0R/CkH2AoiMVX/lMgeLR/s7Y4tubC+rpYQRlIv2OZcrgdIcha6Z+CM 0nRrGOxbTf8Eo4gHzyqNCGvo2AZcWCy/xB1/Qb74N1rhrQ9zD8zxMw9PflMkPUKXJRYO m1Gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:date:from :x-gm-message-state:from:to:cc; bh=l1hEI332NfT1JuaXAK4dv586CJr0lsUfuhuRLOyrE/U=; b=PFL5xFTvq4zUk7Yf2HGD+EnHHTKH5ePgaLFFcO40M6E8gdHA7noA1I90fnToF49469 4yjSlqCAm7UMnSMcGqF8n+IT7gvHfIKf7fW6r1ON1KFXbTMpd9njSqppK6hNT5pUHNj0 FR1LdKwpCNRwaMXgLgh+ReQBdhgqmy+JpyqkioZXzGLar9tUsXfiw7MWcFEU6svUg3gF fYVVwSECoICEPA6Ct2qqZWsACx81xpUJllkUeyeRjoBrqFQS3RKDoZKyHDwcv37TuvkD hXva+NHIhsXHSaLHZJg+jwvby4n+C38LLM4xNWyOMINzVwyKcwotxdYEZt/2QiHs12tl CN8Q== X-Gm-Message-State: AJIora+hsZKXF454xuPvxdHChx2HYdo6uFkByGFVjKBmqTCn3JnaBG8i qB4KOovmeKOS4JhM60aiXhyeO75afJWK8Q== X-Received: by 2002:a05:6402:430e:b0:43d:1cf6:61ec with SMTP id m14-20020a056402430e00b0043d1cf661ecmr23564547edc.194.1659514777992; Wed, 03 Aug 2022 01:19:37 -0700 (PDT) Received: from krava ([193.85.244.190]) by smtp.gmail.com with ESMTPSA id o17-20020a170906769100b007308bdef04bsm2813733ejm.103.2022.08.03.01.19.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Aug 2022 01:19:37 -0700 (PDT) From: Jiri Olsa X-Google-Original-From: Jiri Olsa Date: Wed, 3 Aug 2022 10:19:35 +0200 To: James Hilliard Cc: bpf@vger.kernel.org, Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , linux-kernel@vger.kernel.org Subject: Re: [PATCH] libbpf: ensure functions with always_inline attribute are inline Message-ID: References: <20220802232741.481145-1-james.hilliard1@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220802232741.481145-1-james.hilliard1@gmail.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 02, 2022 at 05:27:41PM -0600, James Hilliard wrote: > GCC expects the always_inline attribute to only be set on inline > functions, as such we should make all functions with this attribute > inline. > > Fixes errors like: > /home/buildroot/bpf-next/tools/testing/selftests/bpf/tools/include/bpf/bpf_tracing.h:439:1: error: ‘always_inline’ function might not be inlinable [-Werror=attributes] > 439 | ____##name(unsigned long long *ctx, ##args) > | ^~~~ > > Signed-off-by: James Hilliard > --- > tools/lib/bpf/bpf_tracing.h | 14 +++++++------- > tools/lib/bpf/usdt.bpf.h | 4 ++-- > 2 files changed, 9 insertions(+), 9 deletions(-) > > diff --git a/tools/lib/bpf/bpf_tracing.h b/tools/lib/bpf/bpf_tracing.h > index 43ca3aff2292..ae67fcee912c 100644 > --- a/tools/lib/bpf/bpf_tracing.h > +++ b/tools/lib/bpf/bpf_tracing.h > @@ -426,7 +426,7 @@ struct pt_regs; > */ > #define BPF_PROG(name, args...) \ > name(unsigned long long *ctx); \ > -static __attribute__((always_inline)) typeof(name(0)) \ > +static inline __attribute__((always_inline)) typeof(name(0)) \ could you use __always_inline that does exactly that? jirka > ____##name(unsigned long long *ctx, ##args); \ > typeof(name(0)) name(unsigned long long *ctx) \ > { \ > @@ -435,7 +435,7 @@ typeof(name(0)) name(unsigned long long *ctx) \ > return ____##name(___bpf_ctx_cast(args)); \ > _Pragma("GCC diagnostic pop") \ > } \ > -static __attribute__((always_inline)) typeof(name(0)) \ > +static inline __attribute__((always_inline)) typeof(name(0)) \ > ____##name(unsigned long long *ctx, ##args) > > struct pt_regs; > @@ -460,7 +460,7 @@ struct pt_regs; > */ > #define BPF_KPROBE(name, args...) \ > name(struct pt_regs *ctx); \ > -static __attribute__((always_inline)) typeof(name(0)) \ > +static inline __attribute__((always_inline)) typeof(name(0)) \ > ____##name(struct pt_regs *ctx, ##args); \ > typeof(name(0)) name(struct pt_regs *ctx) \ > { \ > @@ -469,7 +469,7 @@ typeof(name(0)) name(struct pt_regs *ctx) \ > return ____##name(___bpf_kprobe_args(args)); \ > _Pragma("GCC diagnostic pop") \ > } \ > -static __attribute__((always_inline)) typeof(name(0)) \ > +static inline __attribute__((always_inline)) typeof(name(0)) \ > ____##name(struct pt_regs *ctx, ##args) > > #define ___bpf_kretprobe_args0() ctx > @@ -484,7 +484,7 @@ ____##name(struct pt_regs *ctx, ##args) > */ > #define BPF_KRETPROBE(name, args...) \ > name(struct pt_regs *ctx); \ > -static __attribute__((always_inline)) typeof(name(0)) \ > +static inline __attribute__((always_inline)) typeof(name(0)) \ > ____##name(struct pt_regs *ctx, ##args); \ > typeof(name(0)) name(struct pt_regs *ctx) \ > { \ > @@ -540,7 +540,7 @@ static __always_inline typeof(name(0)) ____##name(struct pt_regs *ctx, ##args) > #define BPF_KSYSCALL(name, args...) \ > name(struct pt_regs *ctx); \ > extern _Bool LINUX_HAS_SYSCALL_WRAPPER __kconfig; \ > -static __attribute__((always_inline)) typeof(name(0)) \ > +static inline __attribute__((always_inline)) typeof(name(0)) \ > ____##name(struct pt_regs *ctx, ##args); \ > typeof(name(0)) name(struct pt_regs *ctx) \ > { \ > @@ -555,7 +555,7 @@ typeof(name(0)) name(struct pt_regs *ctx) \ > return ____##name(___bpf_syscall_args(args)); \ > _Pragma("GCC diagnostic pop") \ > } \ > -static __attribute__((always_inline)) typeof(name(0)) \ > +static inline __attribute__((always_inline)) typeof(name(0)) \ > ____##name(struct pt_regs *ctx, ##args) > > #define BPF_KPROBE_SYSCALL BPF_KSYSCALL > diff --git a/tools/lib/bpf/usdt.bpf.h b/tools/lib/bpf/usdt.bpf.h > index 4f2adc0bd6ca..2bd2d80b3751 100644 > --- a/tools/lib/bpf/usdt.bpf.h > +++ b/tools/lib/bpf/usdt.bpf.h > @@ -232,7 +232,7 @@ long bpf_usdt_cookie(struct pt_regs *ctx) > */ > #define BPF_USDT(name, args...) \ > name(struct pt_regs *ctx); \ > -static __attribute__((always_inline)) typeof(name(0)) \ > +static inline __attribute__((always_inline)) typeof(name(0)) \ > ____##name(struct pt_regs *ctx, ##args); \ > typeof(name(0)) name(struct pt_regs *ctx) \ > { \ > @@ -241,7 +241,7 @@ typeof(name(0)) name(struct pt_regs *ctx) \ > return ____##name(___bpf_usdt_args(args)); \ > _Pragma("GCC diagnostic pop") \ > } \ > -static __attribute__((always_inline)) typeof(name(0)) \ > +static inline __attribute__((always_inline)) typeof(name(0)) \ > ____##name(struct pt_regs *ctx, ##args) > > #endif /* __USDT_BPF_H__ */ > -- > 2.34.1 >