Received: by 2002:a05:6830:16d2:b0:61c:ac69:ca1b with SMTP id l18csp196301otr; Thu, 4 Aug 2022 00:26:58 -0700 (PDT) X-Google-Smtp-Source: AA6agR5zwF2CNae4fJqFaTrMnRv7xuJFOAXvColNGMHUXjzqvGRoYl26p7WQQ32JrKr7GhRz0Gwt X-Received: by 2002:a17:90b:1c8e:b0:1f1:b5a9:20c3 with SMTP id oo14-20020a17090b1c8e00b001f1b5a920c3mr675566pjb.47.1659598018643; Thu, 04 Aug 2022 00:26:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659598018; cv=none; d=google.com; s=arc-20160816; b=jSviSRXn8XJ3SJW22/c0+qC8BVYJx+/D+EXQ9BYFFd3dOg97nOMK+5PHr8lOyzEEau 6mRoOwMJHZbm7k9gZrUF0Uj7BEdKPqizMAOqJ1AP51DOluRaF9WxMzZ9pymkwO2Y1Ltb S5u+Cb8apH6YnLtlZrIZOW+oxCYC7zEqtgHV6fsJjCjb+7ZIj7xHnNf+e7mZ+bBr7dDr L+IhNIstO0+0rmPKBUuCeVsFhZlIlqeZnULFBcWuELATDs77tY6x5wdChG47wY9e1Rmz p0nCbJLGdq1a3tkzRIQWlgxDxIIb4LorEzaXTo2XPyfzGjP39+YT7t2EGdpcI2n0Fs1W x0+g== 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=3YvlPtzAAZUqzmZnRdFclgixc3h9aOjUwqn3zpjfevE=; b=Qgwnbgj6m7zjTqhMbYExwzQpfIa/VsXZ2uWciTZLNorPBp7C/lYf6Utl1oq6xDE3ut S5U1zHunb1W6UmZioOW1RCrIF0NdAY8OG6cHa7BP4Kg0zmXXx7IEJCx+YtKMPpRuLCQ5 v53QNgQ7VkIZiSuBrDEl1nYlc9kz1si0NGmL1sQqFCilDtoG2hWH6og6ma2Ve9fZ92re xWSauuyG3YAk2fuwHk7whbRD0apPxNKDYsAzIMSYnTZtqxAuPLO5FmxC83UQBRExmRxA w1m+XMGlGciz5FYU0PakIILkRDxrI+aOEVtXpFT/y9PS/BMgV19/nPOgJLHtyqa7CXXD 0fiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=LVotmRHO; 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 o25-20020aa79799000000b00528c6c7bd34si196283pfp.53.2022.08.04.00.26.44; Thu, 04 Aug 2022 00:26:58 -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=LVotmRHO; 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 S239001AbiHDHN2 (ORCPT + 99 others); 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-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> 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 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 >