From patchwork Mon Jan 16 01:01:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 43915 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp964478wrn; Sun, 15 Jan 2023 17:07:44 -0800 (PST) X-Google-Smtp-Source: AMrXdXunAM+6E4E39eMC5b0eSJOEXuUu17ow2M87oTVrziX1LSQRSSVc0PV0JO0TodIiXq5ucoJu X-Received: by 2002:a05:6a20:2a22:b0:b8:8a94:5bf with SMTP id e34-20020a056a202a2200b000b88a9405bfmr1278996pzh.21.1673831264680; Sun, 15 Jan 2023 17:07:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673831264; cv=none; d=google.com; s=arc-20160816; b=hph6SZf3DQxA+9DSWnoyj8WxrkWNSbt0Xh65Uv/zKgBC56l/oHsjntDy7ypbknIaqB Yb7mdnq+mPmjH58H2s5/3olloUvQYzzcRzl1zfN214PNkmjreTji4jJ4MzR0Ogd4vOyS oy5Dw+n0yKx6NHr/y4rnV7eF/wg7u74FGhOhVsEcf5IwiZTCmmMKyu8acRcJWslVAO+/ UAWZRCTqdwcqOl0u2Ox1147EZLuiK8PVJ/R98k2EZzZUZMkh/t6iuwPjJ+HGVJIbkwmM eqmntKcmdzY3U8+IPtUkPxtQFJQCgG3BZ1bjoLh6lbr0NdxGj1ylFx/gbEffJlxsFuwj /2cA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=tHhCz4k6MsqFldWGTt35hGeLdTBertltyGAk8DkitQI=; b=rmjGdjFbmuAF76rPYwbTBr0lJJ6O4mrCWCvcJXnDgz6d5TA+JL07zmg1daNx3ljBFA RFBrJfrlhTxZGe599U1DZCZxY2WLlZQD0i76YwYyzJFxOnAY1IHpslStJiId0vN3M4ej crm46+2wMJ0mu37SbRMZd526NIrp8nAE/siTlYCdB5DPWQtb9k3XQ4lq4qpMrcty5MlA 2+y3+DM3Ez0AHEoVCPJtK3hT8ELk4ikLI7Bh5/MybXRUNlUR7w8cl+ZKo1SnW0v5KprQ TUcpxSBSns/vXujYI6NvNaHTMeHU2xLPpZNPNO55doYNaQtOSCKOVTjyohafBpA3K1k/ BJ7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=oVMWfsW3; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f21-20020a63f115000000b00489c72b232fsi33094586pgi.707.2023.01.15.17.07.32; Sun, 15 Jan 2023 17:07:44 -0800 (PST) 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=@google.com header.s=20210112 header.b=oVMWfsW3; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231769AbjAPBBu (ORCPT + 99 others); Sun, 15 Jan 2023 20:01:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231706AbjAPBBh (ORCPT ); Sun, 15 Jan 2023 20:01:37 -0500 Received: from mail-pf1-x44a.google.com (mail-pf1-x44a.google.com [IPv6:2607:f8b0:4864:20::44a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECA1D93C3 for ; Sun, 15 Jan 2023 17:01:35 -0800 (PST) Received: by mail-pf1-x44a.google.com with SMTP id k20-20020aa792d4000000b0058347d2f5e3so11675464pfa.15 for ; Sun, 15 Jan 2023 17:01:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=tHhCz4k6MsqFldWGTt35hGeLdTBertltyGAk8DkitQI=; b=oVMWfsW34/mGzPMwBFwgP503Mmst6dTXQwRmf7yhjQV3T611RrXu8SUNd69diz8msL k2m6ORMzKffSio7JKlJDYGbJNzNcYNM/zi4Lh+Neq+n+22h8KgrCElrqrFrNrnrW9Fwt 4Q0aMoJtNkCMGnvh5OijMMjPPrdIaHndXZd6eLelQTfo1IFemkORMu4h77rN+LVcOu6N pgHQSYw04OOZlUZjQ0ilOFIuOJMHbrpCoEgdIhWSmdlrkjyOIUDGbWBQLdvu3u2qmQbX mHHPhWZK+IL4rEZKsQXiNAi2erx1zf9lypve5krMuoHLn300TU+ofqNc6LiwuoX1klx+ 5Kkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=tHhCz4k6MsqFldWGTt35hGeLdTBertltyGAk8DkitQI=; b=du387f7VEWdWlQ8KA40D+84g5U6s1VzcQQEovf4rn5tCXmm7bBQ1ZG2P4b9ih/x+0b X+J5oUMZcxldHHafPVkUJsuGK8aNCeaVEQR3jYrsfm+ui4J8qz4oojHFFF261Bk3Rzy2 jst+DB/Eo+llGD/f4G6VZCscSKXggfgzKbRRGqhVB5RH/ItT1oT3LrnVnFadK7XJxr6/ hQKPFZxyEbx2EWI7W5aytbQVXjBlaAKSKPInHh7eHJH1qCy39w+B6cWbaX2z2EOj2BIp m+Y8CUhxcg2R0DKDrsK0I1MDjKq+zEyJf7iwhpODnbhgngN8X/Nfv5G755RVOrBNNJRw JhoQ== X-Gm-Message-State: AFqh2kqmnsgXxbpQ7WQ14EuEU9nILuWAjtCNXpUbx3gCbfXJ4ofXTNH/ tcfu/7wWCbxSAvTV4+S+oUZIi+owvL/q X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:79e:5e8e:382c:e7ce]) (user=irogers job=sendgmr) by 2002:a17:90b:264d:b0:226:1564:643c with SMTP id pa13-20020a17090b264d00b002261564643cmr5421842pjb.206.1673830895350; Sun, 15 Jan 2023 17:01:35 -0800 (PST) Date: Sun, 15 Jan 2023 17:01:13 -0800 In-Reply-To: <20230116010115.490713-1-irogers@google.com> Message-Id: <20230116010115.490713-2-irogers@google.com> Mime-Version: 1.0 References: <20230116010115.490713-1-irogers@google.com> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog Subject: [PATCH v2 1/3] tools build: Pass libbpf feature only if libbpf 1.0+ From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Andres Freund , Quentin Monnet , Roberto Sassu , Christy Lee , Andrii Nakryiko , Adrian Hunter , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, bpf@vger.kernel.org Cc: Ian Rogers X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755139292063318629?= X-GMAIL-MSGID: =?utf-8?q?1755139292063318629?= libbpf 1.0 represented a cleanup and stabilization of APIs. Simplify development by only passing the feature test if libbpf 1.0 is installed. Signed-off-by: Ian Rogers --- tools/build/feature/test-libbpf.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/build/feature/test-libbpf.c b/tools/build/feature/test-libbpf.c index a508756cf4cc..cd9989f52119 100644 --- a/tools/build/feature/test-libbpf.c +++ b/tools/build/feature/test-libbpf.c @@ -1,6 +1,10 @@ // SPDX-License-Identifier: GPL-2.0 #include +#if !defined(LIBBPF_MAJOR_VERSION) || (LIBBPF_MAJOR_VERSION < 1) +#error At least libbpf 1.0 is required for Linux tools. +#endif + int main(void) { return bpf_object__open("test") ? 0 : -1; From patchwork Mon Jan 16 01:01:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 43916 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp965345wrn; Sun, 15 Jan 2023 17:10:53 -0800 (PST) X-Google-Smtp-Source: AMrXdXvP/Qe0ZZUqv1FyLQ0me/sg6o3l+wmTNHO0htVph93iJ+CUKWXtmlCpvI//WEtbtC+OKVDl X-Received: by 2002:a17:907:6294:b0:86a:1afa:6dd8 with SMTP id nd20-20020a170907629400b0086a1afa6dd8mr15121115ejc.69.1673831453144; Sun, 15 Jan 2023 17:10:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673831453; cv=none; d=google.com; s=arc-20160816; b=hdNKTf0xonIihKaD2ADT0pK6T3Exfqt2Stnx7A/xVdExwQ8Kx1OlIUWoEE4fkn4Ohv jIg1ctM73lI0uzcyQ9mK3WuY7cSbV1rjCmZWhxXc1yRr9ZIVIJKzIGvMvAACGaMj46yr e5m5XHCTM6o/HcUVhsHk4GA80ed4i9FyEYyNyiDHqO9b3d5Cv+PV5KP2aCsGEDcOcsdE bBle2zGlc2YfpS+J6TV+0AGBqjpl6l5YsXII97W2nwJd+tHUGOE2hktzM1EdGT4lfUHX 8dqma+//5KLIg4xG8H4QDHzW8XAYHI/p9WVVZhynE98lFjGFd4wyRw628ZVFx70VZSRV 4n+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=VRrV8udrTURO9JO/oxNuWIRvgc98bYawahAGihNy554=; b=XvoNaYK1cvxrmDHHujKkR2tZD0lGiGsHdbdX2CP074hlN3haR8LSREbLyA4SKe4wNl nF+Ak9heUZBvJgExeRlSEmyewFbz5KectnBWK+Ic1fr0cdjEOb7Lo5uzhhE4CFT6PZHe 3RjgvE/RfpCSjLN6/KAjxiR93jD/bdKtI/vffRwiWn6uzAnX0m5xE6fc61hY0oItfWHN vQqfP+R2TvJNcTBCJjMxg/B0+z0LlJoawHiGlPGNn+ZMOETDB6IzCjWnpuhl2NCzjKNJ ub8OUeCK0e1s45qZPZrv+bjFYTy21Pwj22dS/yb1qRSccClh6XTJXMxnS5fuuhHUbGm8 ikjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=e6dQl1+Q; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hz6-20020a1709072ce600b00867779a2fe2si12076508ejc.138.2023.01.15.17.10.29; Sun, 15 Jan 2023 17:10:53 -0800 (PST) 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=@google.com header.s=20210112 header.b=e6dQl1+Q; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231777AbjAPBCJ (ORCPT + 99 others); Sun, 15 Jan 2023 20:02:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231770AbjAPBBu (ORCPT ); Sun, 15 Jan 2023 20:01:50 -0500 Received: from mail-pl1-x64a.google.com (mail-pl1-x64a.google.com [IPv6:2607:f8b0:4864:20::64a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AF1615541 for ; Sun, 15 Jan 2023 17:01:44 -0800 (PST) Received: by mail-pl1-x64a.google.com with SMTP id s2-20020a170902ea0200b0019247629ee5so19080429plg.17 for ; Sun, 15 Jan 2023 17:01:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=VRrV8udrTURO9JO/oxNuWIRvgc98bYawahAGihNy554=; b=e6dQl1+Q10HiIwzFDsr7u+GFX7EwgiHn6PlxEXX8Q0KNKHqjsU1kXpn3Jfz8gAzQW7 zylf+mfRGHzyxJrAao+mnE5KADUOm6tGbPeywRzSKIc+4KErGCGBcsl/UwpthqBweKFl Z92pG+MG9HF9kU9m6SVVwlznibtelFGBeuPr+CrLNqaUThrg49TS59Yq6NxLGWfLOHv7 TI57D5lVMr4df+UoUq3S2Y/g8DukoigGaA/pPvGaqAgOEeQ6W4dHBfi8U3VQhnRhHkP8 FzruzBS2mdleqFinHa0WvQrghWp1b45HKqdhy/10NGtNrVg1p2ErLru9lTxDtH/HiEzt yPBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=VRrV8udrTURO9JO/oxNuWIRvgc98bYawahAGihNy554=; b=aA26DUuEKcUk4FMBODZQkJy7YQBVbLtn3Ld2v7zr3vh17BayP0mVwiR7IU/y7XYs1U frRGFD6/xeff+X2VT0791HTyasS8BRQYYc6KP6FlqqqH1jIrDcNPnLPIyFZUH1qAHu/a jv4VfG06ylaq4mRe9hOIlhbv8aTK6PJXFA3nCoLZSRXkVXX9SW0sbiIl+aaIWZCJ27Oi PxXi6wco3k+9AAkJFObcXbK0xqHN+JDZy0KylZqZ/RXJVzdRXrzBUWfGL5G0dnP08Egb /65ZTf9Ds+0skS9odgE2RNjWyCr2IvrthpuVb50PSAgcFEmfWQPlB5pEQN1mM8ZkEd8T NL6A== X-Gm-Message-State: AFqh2kojh1o7dhijwq3WcP/1dE4tx7BbdQta9bVYhgfKKCfPH2+yPJ8B AjXJguFw9uuKkPtxy045yg5091lab5Mi X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:79e:5e8e:382c:e7ce]) (user=irogers job=sendgmr) by 2002:a17:90a:ad84:b0:229:45e8:f3a2 with SMTP id s4-20020a17090aad8400b0022945e8f3a2mr520970pjq.46.1673830903833; Sun, 15 Jan 2023 17:01:43 -0800 (PST) Date: Sun, 15 Jan 2023 17:01:14 -0800 In-Reply-To: <20230116010115.490713-1-irogers@google.com> Message-Id: <20230116010115.490713-3-irogers@google.com> Mime-Version: 1.0 References: <20230116010115.490713-1-irogers@google.com> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog Subject: [PATCH v2 2/3] perf build: Remove libbpf pre-1.0 feature tests From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Andres Freund , Quentin Monnet , Roberto Sassu , Christy Lee , Andrii Nakryiko , Adrian Hunter , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, bpf@vger.kernel.org Cc: Ian Rogers X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755139489360160424?= X-GMAIL-MSGID: =?utf-8?q?1755139489360160424?= The feature tests were necessary for libbpf pre-1.0, but as the libbpf implies at least 1.0 we can remove these now. Signed-off-by: Ian Rogers --- tools/build/feature/Makefile | 7 --- .../feature/test-libbpf-bpf_map_create.c | 8 ---- .../test-libbpf-bpf_object__next_map.c | 8 ---- .../test-libbpf-bpf_object__next_program.c | 8 ---- .../build/feature/test-libbpf-bpf_prog_load.c | 9 ---- .../test-libbpf-bpf_program__set_insns.c | 8 ---- .../test-libbpf-btf__load_from_kernel_by_id.c | 8 ---- .../build/feature/test-libbpf-btf__raw_data.c | 8 ---- tools/perf/Makefile.config | 48 ++++--------------- 9 files changed, 10 insertions(+), 102 deletions(-) delete mode 100644 tools/build/feature/test-libbpf-bpf_map_create.c delete mode 100644 tools/build/feature/test-libbpf-bpf_object__next_map.c delete mode 100644 tools/build/feature/test-libbpf-bpf_object__next_program.c delete mode 100644 tools/build/feature/test-libbpf-bpf_prog_load.c delete mode 100644 tools/build/feature/test-libbpf-bpf_program__set_insns.c delete mode 100644 tools/build/feature/test-libbpf-btf__load_from_kernel_by_id.c delete mode 100644 tools/build/feature/test-libbpf-btf__raw_data.c diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile index 690fe97be190..dc9323e01e42 100644 --- a/tools/build/feature/Makefile +++ b/tools/build/feature/Makefile @@ -58,13 +58,6 @@ FILES= \ test-lzma.bin \ test-bpf.bin \ test-libbpf.bin \ - test-libbpf-btf__load_from_kernel_by_id.bin \ - test-libbpf-bpf_prog_load.bin \ - test-libbpf-bpf_map_create.bin \ - test-libbpf-bpf_object__next_program.bin \ - test-libbpf-bpf_object__next_map.bin \ - test-libbpf-bpf_program__set_insns.bin \ - test-libbpf-btf__raw_data.bin \ test-get_cpuid.bin \ test-sdt.bin \ test-cxx.bin \ diff --git a/tools/build/feature/test-libbpf-bpf_map_create.c b/tools/build/feature/test-libbpf-bpf_map_create.c deleted file mode 100644 index b9f550e332c8..000000000000 --- a/tools/build/feature/test-libbpf-bpf_map_create.c +++ /dev/null @@ -1,8 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include - -int main(void) -{ - return bpf_map_create(0 /* map_type */, NULL /* map_name */, 0, /* key_size */, - 0 /* value_size */, 0 /* max_entries */, NULL /* opts */); -} diff --git a/tools/build/feature/test-libbpf-bpf_object__next_map.c b/tools/build/feature/test-libbpf-bpf_object__next_map.c deleted file mode 100644 index 64adb519e97e..000000000000 --- a/tools/build/feature/test-libbpf-bpf_object__next_map.c +++ /dev/null @@ -1,8 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include - -int main(void) -{ - bpf_object__next_map(NULL /* obj */, NULL /* prev */); - return 0; -} diff --git a/tools/build/feature/test-libbpf-bpf_object__next_program.c b/tools/build/feature/test-libbpf-bpf_object__next_program.c deleted file mode 100644 index 8bf4fd26b545..000000000000 --- a/tools/build/feature/test-libbpf-bpf_object__next_program.c +++ /dev/null @@ -1,8 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include - -int main(void) -{ - bpf_object__next_program(NULL /* obj */, NULL /* prev */); - return 0; -} diff --git a/tools/build/feature/test-libbpf-bpf_prog_load.c b/tools/build/feature/test-libbpf-bpf_prog_load.c deleted file mode 100644 index 47f516d63ebc..000000000000 --- a/tools/build/feature/test-libbpf-bpf_prog_load.c +++ /dev/null @@ -1,9 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include - -int main(void) -{ - return bpf_prog_load(0 /* prog_type */, NULL /* prog_name */, - NULL /* license */, NULL /* insns */, - 0 /* insn_cnt */, NULL /* opts */); -} diff --git a/tools/build/feature/test-libbpf-bpf_program__set_insns.c b/tools/build/feature/test-libbpf-bpf_program__set_insns.c deleted file mode 100644 index f3b7f18c8f49..000000000000 --- a/tools/build/feature/test-libbpf-bpf_program__set_insns.c +++ /dev/null @@ -1,8 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include - -int main(void) -{ - bpf_program__set_insns(NULL /* prog */, NULL /* new_insns */, 0 /* new_insn_cnt */); - return 0; -} diff --git a/tools/build/feature/test-libbpf-btf__load_from_kernel_by_id.c b/tools/build/feature/test-libbpf-btf__load_from_kernel_by_id.c deleted file mode 100644 index a17647f7d5a4..000000000000 --- a/tools/build/feature/test-libbpf-btf__load_from_kernel_by_id.c +++ /dev/null @@ -1,8 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include - -int main(void) -{ - btf__load_from_kernel_by_id(20151128); - return 0; -} diff --git a/tools/build/feature/test-libbpf-btf__raw_data.c b/tools/build/feature/test-libbpf-btf__raw_data.c deleted file mode 100644 index 57da31dd7581..000000000000 --- a/tools/build/feature/test-libbpf-btf__raw_data.c +++ /dev/null @@ -1,8 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include - -int main(void) -{ - btf__raw_data(NULL /* btf_ro */, NULL /* size */); - return 0; -} diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index 5b8784675903..5ab7cac48c4a 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -565,54 +565,26 @@ ifndef NO_LIBELF # detecting libbpf without LIBBPF_DYNAMIC, so make VF=1 shows libbpf detection status $(call feature_check,libbpf) + + # Feature test requires libbpf 1.0 so we can assume the following: + CFLAGS += -DHAVE_LIBBPF_BTF__LOAD_FROM_KERNEL_BY_ID + CFLAGS += -DHAVE_LIBBPF_BPF_PROG_LOAD + CFLAGS += -DHAVE_LIBBPF_BPF_OBJECT__NEXT_PROGRAM + CFLAGS += -DHAVE_LIBBPF_BPF_OBJECT__NEXT_MAP + CFLAGS += -DHAVE_LIBBPF_BPF_PROGRAM__SET_INSNS + CFLAGS += -DHAVE_LIBBPF_BTF__RAW_DATA + CFLAGS += -DHAVE_LIBBPF_BPF_MAP_CREATE + ifdef LIBBPF_DYNAMIC ifeq ($(feature-libbpf), 1) EXTLIBS += -lbpf $(call detected,CONFIG_LIBBPF_DYNAMIC) - - $(call feature_check,libbpf-btf__load_from_kernel_by_id) - ifeq ($(feature-libbpf-btf__load_from_kernel_by_id), 1) - CFLAGS += -DHAVE_LIBBPF_BTF__LOAD_FROM_KERNEL_BY_ID - endif - $(call feature_check,libbpf-bpf_prog_load) - ifeq ($(feature-libbpf-bpf_prog_load), 1) - CFLAGS += -DHAVE_LIBBPF_BPF_PROG_LOAD - endif - $(call feature_check,libbpf-bpf_object__next_program) - ifeq ($(feature-libbpf-bpf_object__next_program), 1) - CFLAGS += -DHAVE_LIBBPF_BPF_OBJECT__NEXT_PROGRAM - endif - $(call feature_check,libbpf-bpf_object__next_map) - ifeq ($(feature-libbpf-bpf_object__next_map), 1) - CFLAGS += -DHAVE_LIBBPF_BPF_OBJECT__NEXT_MAP - endif - $(call feature_check,libbpf-bpf_program__set_insns) - ifeq ($(feature-libbpf-bpf_program__set_insns), 1) - CFLAGS += -DHAVE_LIBBPF_BPF_PROGRAM__SET_INSNS - else - dummy := $(error Error: libbpf devel library needs to be >= 0.8.0 to build with LIBBPF_DYNAMIC, update or build statically with the version that comes with the kernel sources); - endif - $(call feature_check,libbpf-btf__raw_data) - ifeq ($(feature-libbpf-btf__raw_data), 1) - CFLAGS += -DHAVE_LIBBPF_BTF__RAW_DATA - endif - $(call feature_check,libbpf-bpf_map_create) - ifeq ($(feature-libbpf-bpf_map_create), 1) - CFLAGS += -DHAVE_LIBBPF_BPF_MAP_CREATE - endif else dummy := $(error Error: No libbpf devel library found, please install libbpf-devel); endif else # Libbpf will be built as a static library from tools/lib/bpf. LIBBPF_STATIC := 1 - CFLAGS += -DHAVE_LIBBPF_BTF__LOAD_FROM_KERNEL_BY_ID - CFLAGS += -DHAVE_LIBBPF_BPF_PROG_LOAD - CFLAGS += -DHAVE_LIBBPF_BPF_OBJECT__NEXT_PROGRAM - CFLAGS += -DHAVE_LIBBPF_BPF_OBJECT__NEXT_MAP - CFLAGS += -DHAVE_LIBBPF_BPF_PROGRAM__SET_INSNS - CFLAGS += -DHAVE_LIBBPF_BTF__RAW_DATA - CFLAGS += -DHAVE_LIBBPF_BPF_MAP_CREATE endif endif From patchwork Mon Jan 16 01:01:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 43917 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp970236wrn; Sun, 15 Jan 2023 17:30:13 -0800 (PST) X-Google-Smtp-Source: AMrXdXuoFwhFIYxh1utoF2/VRTAUNwgm5INxYBnY+yDtxX2iN4bJreO0zZDlXOg+aNB8mSw9pIAr X-Received: by 2002:a17:902:8b81:b0:194:928c:ed45 with SMTP id ay1-20020a1709028b8100b00194928ced45mr2602462plb.39.1673832613154; Sun, 15 Jan 2023 17:30:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673832613; cv=none; d=google.com; s=arc-20160816; b=SmGQ2I73MOtKlARRYseH8bpmGgrhSxJ6mV8CQyNtKPKDwM/umib1RrAZr8o2Vrb2OU UVP1WUn+sMO1Sx63PEHTByLkp9q2RTd0iZhB/EZGp9nVNmxfbtc1oC4/xA04Q67DuRC/ gs3JEdDW1xrwpASB6E/uSqBXOuLivjudOm8d2yo8tsYkRPfVGr2I2F5Q/uLoJpOw0Nha jub47JvHlb/u3FkTmLj9O3iVswgoMeVqssTv8SVJWhSt4d4zp4mNePCiRjMrsK6nq6qZ pB4QTYwQ/mexR9uooc5iSTv50oiYG01xhawJnLkH1WEMV39RwCJMG/EYH4nyN9uUHM79 sFgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=fq9l7at1ooTaJSpkUGZKe7P3obJP6I4kIWy9k7MQBXM=; b=s5khgN7T+E1AEJgdDW6AqVE0C8iqJNFxGTli30ufAvo6xuj+lvr1+027cylw9Nc7Mi L6PcQpn0tVIMt9DZNmc5qPkFc5VNYZwO8a6wlcH6xtFnyW/jD5EoAuYjOuuXj60e+sb+ 62Ce7nLds/Vwj5XJYHTHZ2DDSf9ywdbiq1R5B/kOZrP/j8rLFDsw6me+ea5BqjM8Tc0c K8B+3tZWQ0fA4UhUy1Lqq4F3CuSK5vgkm1iqDxwBoN/tbO8B8izYQ6Jzd71QvLvJqDwH 52kniPlTxhn2YTd+8PCulV62QLYIOd62Y4ywu2MUpY9npzifEye92ZxTk45jx3o63lVq 0MpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="OHrc/Y7A"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w19-20020a170902d3d300b00193363e0dacsi19591777plb.361.2023.01.15.17.29.56; Sun, 15 Jan 2023 17:30:13 -0800 (PST) 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=@google.com header.s=20210112 header.b="OHrc/Y7A"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231735AbjAPBCb (ORCPT + 99 others); Sun, 15 Jan 2023 20:02:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231814AbjAPBCK (ORCPT ); Sun, 15 Jan 2023 20:02:10 -0500 Received: from mail-pl1-x649.google.com (mail-pl1-x649.google.com [IPv6:2607:f8b0:4864:20::649]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46D361554E for ; Sun, 15 Jan 2023 17:01:52 -0800 (PST) Received: by mail-pl1-x649.google.com with SMTP id f8-20020a170902ce8800b00190c6518e21so18912376plg.1 for ; Sun, 15 Jan 2023 17:01:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=fq9l7at1ooTaJSpkUGZKe7P3obJP6I4kIWy9k7MQBXM=; b=OHrc/Y7AlG8ipL/VF8EJAhW/ttvEH2GKjIzii39L+HIHdQ702xNLigbdi5Et+ALdzm irtFcjWnSXcnIUMx1Hsx7zxmjTkTPjzQEl4DrQ2C7vz+NyTYK8UlcSpb10bkrkHLmg6y X8DjtdzNgQ2rmmS/faKieX528UmyMmu1ko80krLwPJ6x4rKbaTV6v5xMio8yHrFZl9ry r+2BHfX1XSbNwQCXkLHBObCfp8ytS3j+PkJXn1pZcb1I/fkwHuuDxS5Uv7/6l6Gfb3Ee Zjnu4wlQoxhBZFym1XwKwSa9cKKMK/E69YtBkges5K0PU4zA29gjIAEdOvyvwHE1gQwN emeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=fq9l7at1ooTaJSpkUGZKe7P3obJP6I4kIWy9k7MQBXM=; b=8SHxBgeFoN79Loqcd8al9kRg3eq038WRDGa9MLWkhANxgZ4+3h/xJiu/0gG4+KWRSl WmpjyUgIGLSSNZdrJhcvAFJpWOrpELHWLo5E078Zckubpx5Ciw/7Q6HRjJga4G524NoK oAnsALcTU3F4vkBNpSRX13ryUTOl0ZRSuWRFvYp90cqMNtClcyzrZUVkE8Ohb5U9id55 Njq1RqV71bS8JKg/koLkVBwGzmZgNDvnVra0vetbxGUwd8eqc1eiixOd6ZiEiOzzpK3e m3wX+OdqIUwbpVrJdiaKLxkV+5897vjmejqJyCY8yeqqHDezWvmmfRyiChYUIJEL4xrW KiMw== X-Gm-Message-State: AFqh2ko2Vk4p3TR55TlIffpT7okhXOdb/eiiVMz9CsZt1gxfS14gt+Ju adS3Gb5Q3/uKiUbYdeP15FdiO3Q7kFLF X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:79e:5e8e:382c:e7ce]) (user=irogers job=sendgmr) by 2002:a63:1666:0:b0:478:e22:c90a with SMTP id 38-20020a631666000000b004780e22c90amr4920876pgw.185.1673830912233; Sun, 15 Jan 2023 17:01:52 -0800 (PST) Date: Sun, 15 Jan 2023 17:01:15 -0800 In-Reply-To: <20230116010115.490713-1-irogers@google.com> Message-Id: <20230116010115.490713-4-irogers@google.com> Mime-Version: 1.0 References: <20230116010115.490713-1-irogers@google.com> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog Subject: [PATCH v2 3/3] perf bpf: Remove pre libbpf 1.0 conditional logic From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Andres Freund , Quentin Monnet , Roberto Sassu , Christy Lee , Andrii Nakryiko , Adrian Hunter , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, bpf@vger.kernel.org Cc: Ian Rogers X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755140706321763070?= X-GMAIL-MSGID: =?utf-8?q?1755140706321763070?= Tests are no longer applicable as libbpf 1.0 can be assumed. Signed-off-by: Ian Rogers --- tools/perf/Makefile.config | 9 ----- tools/perf/util/bpf-event.c | 66 ----------------------------------- tools/perf/util/bpf-loader.c | 18 ---------- tools/perf/util/bpf_counter.c | 18 ---------- 4 files changed, 111 deletions(-) diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index 5ab7cac48c4a..86ab83d48013 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -566,15 +566,6 @@ ifndef NO_LIBELF # detecting libbpf without LIBBPF_DYNAMIC, so make VF=1 shows libbpf detection status $(call feature_check,libbpf) - # Feature test requires libbpf 1.0 so we can assume the following: - CFLAGS += -DHAVE_LIBBPF_BTF__LOAD_FROM_KERNEL_BY_ID - CFLAGS += -DHAVE_LIBBPF_BPF_PROG_LOAD - CFLAGS += -DHAVE_LIBBPF_BPF_OBJECT__NEXT_PROGRAM - CFLAGS += -DHAVE_LIBBPF_BPF_OBJECT__NEXT_MAP - CFLAGS += -DHAVE_LIBBPF_BPF_PROGRAM__SET_INSNS - CFLAGS += -DHAVE_LIBBPF_BTF__RAW_DATA - CFLAGS += -DHAVE_LIBBPF_BPF_MAP_CREATE - ifdef LIBBPF_DYNAMIC ifeq ($(feature-libbpf), 1) EXTLIBS += -lbpf diff --git a/tools/perf/util/bpf-event.c b/tools/perf/util/bpf-event.c index cc7c1f90cf62..025f331b3867 100644 --- a/tools/perf/util/bpf-event.c +++ b/tools/perf/util/bpf-event.c @@ -22,72 +22,6 @@ #include "record.h" #include "util/synthetic-events.h" -#ifndef HAVE_LIBBPF_BTF__LOAD_FROM_KERNEL_BY_ID -struct btf *btf__load_from_kernel_by_id(__u32 id) -{ - struct btf *btf; -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" - int err = btf__get_from_id(id, &btf); -#pragma GCC diagnostic pop - - return err ? ERR_PTR(err) : btf; -} -#endif - -#ifndef HAVE_LIBBPF_BPF_PROG_LOAD -LIBBPF_API int bpf_load_program(enum bpf_prog_type type, - const struct bpf_insn *insns, size_t insns_cnt, - const char *license, __u32 kern_version, - char *log_buf, size_t log_buf_sz); - -int bpf_prog_load(enum bpf_prog_type prog_type, - const char *prog_name __maybe_unused, - const char *license, - const struct bpf_insn *insns, size_t insn_cnt, - const struct bpf_prog_load_opts *opts) -{ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" - return bpf_load_program(prog_type, insns, insn_cnt, license, - opts->kern_version, opts->log_buf, opts->log_size); -#pragma GCC diagnostic pop -} -#endif - -#ifndef HAVE_LIBBPF_BPF_OBJECT__NEXT_PROGRAM -struct bpf_program * -bpf_object__next_program(const struct bpf_object *obj, struct bpf_program *prev) -{ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" - return bpf_program__next(prev, obj); -#pragma GCC diagnostic pop -} -#endif - -#ifndef HAVE_LIBBPF_BPF_OBJECT__NEXT_MAP -struct bpf_map * -bpf_object__next_map(const struct bpf_object *obj, const struct bpf_map *prev) -{ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" - return bpf_map__next(prev, obj); -#pragma GCC diagnostic pop -} -#endif - -#ifndef HAVE_LIBBPF_BTF__RAW_DATA -const void * -btf__raw_data(const struct btf *btf_ro, __u32 *size) -{ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" - return btf__get_raw_data(btf_ro, size); -#pragma GCC diagnostic pop -} -#endif - static int snprintf_hex(char *buf, size_t size, unsigned char *data, size_t len) { int ret = 0; diff --git a/tools/perf/util/bpf-loader.c b/tools/perf/util/bpf-loader.c index 6e9b06cf06ee..44cde27d6389 100644 --- a/tools/perf/util/bpf-loader.c +++ b/tools/perf/util/bpf-loader.c @@ -32,24 +32,6 @@ #include -#ifndef HAVE_LIBBPF_BPF_PROGRAM__SET_INSNS -int bpf_program__set_insns(struct bpf_program *prog __maybe_unused, - struct bpf_insn *new_insns __maybe_unused, size_t new_insn_cnt __maybe_unused) -{ - pr_err("%s: not support, update libbpf\n", __func__); - return -ENOTSUP; -} - -int libbpf_register_prog_handler(const char *sec __maybe_unused, - enum bpf_prog_type prog_type __maybe_unused, - enum bpf_attach_type exp_attach_type __maybe_unused, - const struct libbpf_prog_handler_opts *opts __maybe_unused) -{ - pr_err("%s: not support, update libbpf\n", __func__); - return -ENOTSUP; -} -#endif - /* temporarily disable libbpf deprecation warnings */ #pragma GCC diagnostic ignored "-Wdeprecated-declarations" diff --git a/tools/perf/util/bpf_counter.c b/tools/perf/util/bpf_counter.c index eeee899fcf34..aa78a15a6f0a 100644 --- a/tools/perf/util/bpf_counter.c +++ b/tools/perf/util/bpf_counter.c @@ -312,24 +312,6 @@ static bool bperf_attr_map_compatible(int attr_map_fd) (map_info.value_size == sizeof(struct perf_event_attr_map_entry)); } -#ifndef HAVE_LIBBPF_BPF_MAP_CREATE -LIBBPF_API int bpf_create_map(enum bpf_map_type map_type, int key_size, - int value_size, int max_entries, __u32 map_flags); -int -bpf_map_create(enum bpf_map_type map_type, - const char *map_name __maybe_unused, - __u32 key_size, - __u32 value_size, - __u32 max_entries, - const struct bpf_map_create_opts *opts __maybe_unused) -{ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" - return bpf_create_map(map_type, key_size, value_size, max_entries, 0); -#pragma GCC diagnostic pop -} -#endif - static int bperf_lock_attr_map(struct target *target) { char path[PATH_MAX];