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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2AEE8C19F2D for ; Thu, 4 Aug 2022 07:13:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239015AbiHDHN2 (ORCPT ); Thu, 4 Aug 2022 03:13:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230001AbiHDHN0 (ORCPT ); Thu, 4 Aug 2022 03:13:26 -0400 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 485D4606A8; Thu, 4 Aug 2022 00:13:25 -0700 (PDT) Received: by mail-ej1-x631.google.com with SMTP id kb8so20678816ejc.4; Thu, 04 Aug 2022 00:13:25 -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=3YvlPtzAAZUqzmZnRdFclgixc3h9aOjUwqn3zpjfevE=; b=LVotmRHO7gz0Ww4OVBW3Kw8b2lDL+zylY6Oi1az/4NELdBMEMnNpO3cOZcRLx86Vw/ fYGEJnf9qR3pzDFHOSisjcbXJi8XGEE2yqsy5UKVE52KeGbWoa8DSni6oFQXSOSv/E1K CmVeKezBXsjRrnFIMPs/KUNpBbwZBr9xfaTpRXhy52QUYM1SA5Pn66fZpbZ7+EJrfRYy ufwTWNS+8K8xakGnLnMgB3a3XZltpUejuMhBvSE0yU7Xvrrmtr7bqoNe8Gb4R1P42cvK vgDGf6FMVgNwxiI/D1SofOsfx6b7mutKfW9XtM7ea0FW9qL1MFQF3DlT0xK1JjRwXHqd FOOA== 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=3YvlPtzAAZUqzmZnRdFclgixc3h9aOjUwqn3zpjfevE=; b=oquVCjCJlfjpwFNJt8cuWUFixwD0JCga6X1dhWH0UU5uOJg5a+aq7QwGSo7WYc7O2O AfdBiX9lizx1OOcY8s43JVziLncY1D6erM1CfVlw/c5azEkaET9iDUnaIs7nTCCLCtEu P3PM4RUhmeVpDy2tSJ2rEVprIOPAf3kB1VP2zKnwcbkXApXHP+c6EfkQU/0wdrRt0pJ8 W/B4gpDTRErZ2UcuzGb0+Me4vqhH/Zd1Jl93A+hjZVecLAv454Dxdd92yxE1AopM7daO 4cRWCsojNp1HBG942zBDH3rxWcrjbBGa9BCncbeKsWCzexpcI/Tt95Jy6NWtEhoNreCu P44w== X-Gm-Message-State: ACgBeo1t8W92jYnEmnOtdiWomexW7lseLkU9dIwzaQO+3p6CMhT6/Wzs pL8GdArm4U6zMqBy9OlecLg= X-Google-Smtp-Source: AA6agR5/2TFW6vMzbPBpIdm0vp1cBA3HIBmNbeh6YfmNg9r7Kpe3LkFSh5Y+0WPVFnBtQXY15K/ZYA== X-Received: by 2002:a17:907:a0c6:b0:72e:ee9a:cf89 with SMTP id hw6-20020a170907a0c600b0072eee9acf89mr396089ejc.43.1659597203811; Thu, 04 Aug 2022 00:13:23 -0700 (PDT) Received: from krava ([193.85.244.190]) by smtp.gmail.com with ESMTPSA id dc3-20020a170906c7c300b0073093eaf53esm11889ejb.131.2022.08.04.00.13.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Aug 2022 00:13:23 -0700 (PDT) From: Jiri Olsa X-Google-Original-From: Jiri Olsa Date: Thu, 4 Aug 2022 09:13:21 +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 v2] libbpf: ensure functions with always_inline attribute are inline Message-ID: References: <20220803151403.793024-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: <20220803151403.793024-1-james.hilliard1@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 03, 2022 at 09:14:03AM -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 > use the __always_inline macro which makes the function inline and > sets the attribute. > > 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 > --- > Changes v1 -> v2: > - use __always_inline macro Acked-by: Jiri Olsa jirka > --- > 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..5fdb93da423b 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 __always_inline typeof(name(0)) \ > ____##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 __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 __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 __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 __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 __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 __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..fdfd235e52c4 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 __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 __always_inline typeof(name(0)) \ > ____##name(struct pt_regs *ctx, ##args) > > #endif /* __USDT_BPF_H__ */ > -- > 2.34.1 >