From patchwork Mon Jan 9 20:34:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 41094 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2368259wrt; Mon, 9 Jan 2023 12:38:46 -0800 (PST) X-Google-Smtp-Source: AMrXdXu0z1x9lynq6dpXyg07dNMcLvPdh0mUlV2tnb9QyIlJAlrwYvJb0CAAB6Q6sEoSZWLgzyai X-Received: by 2002:a17:906:b7ce:b0:84d:411d:64a4 with SMTP id fy14-20020a170906b7ce00b0084d411d64a4mr5279857ejb.38.1673296726337; Mon, 09 Jan 2023 12:38:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673296726; cv=none; d=google.com; s=arc-20160816; b=VoIg8r1BoQqejW9aHT+h6DA/TnhlBpZB0bOXw+ccJ9IC2f8wh1JB0VFrq8KlqrtOQP mGWXC+t6hJe76LgNWKnxtG2X95kfSAMDiQuryu7EbKM/uLqI+JrgZQVVr7Ok5fJmFIbb y7MlaNG9scAB175qgQxTYqNs/57SQiJrb3tKCgSjT/HyqKgDQyrkCgiHkE2XACXLzj02 mjdoocBWG61bEl/pJu+yQXU86rvP3OT86XPwkVb7lvClrblTn4VEB+3GubSyvxsZW4gS kWkCft+HbyTzLOyKN72H5+FAwMCmBs7Jda+N970v4KikiBinBDnodalVLLlm2Q57y4eh +uRA== 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=YNTy83+Z0Fm1TAZ+zv1q6jji4aMgR5k08+Um3FFLZ7r4FF00E/jIvNcdmQI9OPfbU/ iIF0kXYDwmjZZkoIEEkXj2gt/+595fLTMLDlNYApHJzYKNzIMn9pNcFhX4FlT32vVrf+ NYp+Lb1a4R6kb/HB0IWtHbU5cpsFNpHlIu9b+09oK4/zS4pR3xw+cLxC2W7XKeTno01J pEjZw90sOetNPsa8tiNMmUHke8izHJvlXgOJqkwtqT+3wi8jbv1H/lOCyszsFH2hDhQg IQ+BFMx5hcvj7c+WEnweSuqadn/GsGWTPpdb+hh4FB30bXsjNYIHyUhs0594xkFw6qbc xVNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=jYreWH3G; 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 hu9-20020a170907a08900b007ae1052554esi10674144ejc.898.2023.01.09.12.38.21; Mon, 09 Jan 2023 12:38:46 -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=jYreWH3G; 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 S237300AbjAIUev (ORCPT + 99 others); Mon, 9 Jan 2023 15:34:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235310AbjAIUet (ORCPT ); Mon, 9 Jan 2023 15:34:49 -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 4A4A2625DC for ; Mon, 9 Jan 2023 12:34:48 -0800 (PST) Received: by mail-pf1-x44a.google.com with SMTP id k127-20020a628485000000b0058029fb70a3so3967874pfd.19 for ; Mon, 09 Jan 2023 12:34:48 -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=jYreWH3G8qj8aqLI2lf2fojvZ1VbNj626aIjavkpLCvO0HobsS7JXqXnaJI+xr+DL2 D6r06OX4moENxNPfWztM6ExFvIWlwX19QTFwl7izchuAdcEpyvhIGQ4+wuDlN6NfePKf Sx1p9CGyBRPgtBal6aqpiqUF4+PPgboVUxnv+ha4A7fWoL7RyVxRe70QOeLBkeGwaZY4 KQlctpFPDPKMZX5uoc3ALB1Hi5plVOwuSqDre0tG6b67mSnZigwASw46MPZu8Lbd5XxZ WvsOZwmrEsZjLvYvnTam4OKDbZvtYUA2R/uP6EkmwOei0TNH+/RMfzFON69/IJKklj0R ij0g== 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=rMS0iww/MIs/bhVfIZqqH7LQZcpMdnMDI6i58KBLk500jaxrm6edBlEhIE9F/v0eOS wgQ5gxAE7PkfY4buFq+5CsBu+3tQc4NBa0WDQ4lt3e6pIENAiInlm0xVBN3hTpWJB7ll k3GNzYiZB64sXpglB/xke/ep2wEi4OjxIMHMiGKMUSkROZVc5wyH0mEVhDFYa4+duKIa bXVIVp4utanOULBZMaWMgQ4yNuI98gkydynXO+ophnStE0TZUPzRcF+Qx+jResSUnJYO JuHt6hJEndxU8BdBCkEovY015iZokgVDIv5sF2Dta0e9vVSBGuOSWuE/H48fv/L3NQPD /A7w== X-Gm-Message-State: AFqh2kqAPwu/AYpoc2MiLZg+W49emQXQJ7l5KrCAGLd+ssbns5YwVKJn tTMCPKL6P8LaLFrnYdE+hdINohQJHlsD X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:59e7:81ad:bc43:d9dc]) (user=irogers job=sendgmr) by 2002:a17:90b:1002:b0:226:9980:67f3 with SMTP id gm2-20020a17090b100200b00226998067f3mr156078pjb.1.1673296487423; Mon, 09 Jan 2023 12:34:47 -0800 (PST) Date: Mon, 9 Jan 2023 12:34:22 -0800 In-Reply-To: <20230109203424.1157561-1-irogers@google.com> Message-Id: <20230109203424.1157561-2-irogers@google.com> Mime-Version: 1.0 References: <20230109203424.1157561-1-irogers@google.com> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog Subject: [PATCH v1 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=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?1754578787789334347?= X-GMAIL-MSGID: =?utf-8?q?1754578787789334347?= 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 9 20:34:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 41091 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2367784wrt; Mon, 9 Jan 2023 12:37:26 -0800 (PST) X-Google-Smtp-Source: AMrXdXsWdPLoObqDCUmVvt1xCuxBrekdfGr4tFVDTGrQkELb0Jhkth+2nKz43HtLuvdxG5x62J4D X-Received: by 2002:aa7:d403:0:b0:498:f82c:7068 with SMTP id z3-20020aa7d403000000b00498f82c7068mr6828538edq.35.1673296646476; Mon, 09 Jan 2023 12:37:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673296646; cv=none; d=google.com; s=arc-20160816; b=EqKMRIUtQ+eafqzuRvkM28wjepxkfY+TgH9AgXineA12Le/DF+GgHwkVsYpJUXeEBS GyUSu7r6VtZJwEkhMFb72dnTfUhtjD1CmYEUY3pyRIX3Ykfcl1dXzp01KxOkRrHWk3Ox aAdGw6wvy4zrJJkZI+PYx7Wx0YaRJx6dS7sAZsTIHPkrgjD28K2B0vvolk2MIqS7wVI9 jGf5oJJXz7c9tqFoaxhkjaPcwpVKbGXRK3mD+gygMq+9XOEH2MBGhBCWylOaoWO/b6h+ vtSt91z7ABmrkq3OtX5uw/odVZqtaYXekzg/4bVuabhZ94CVOfqh1CLNUrcnviKR/u4E b97Q== 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=2khZ+quYNpCJzdtw6oMn43k0U7G9Lbi6luDGhG8S4qA=; b=fdjP7xKjPPsyFuwDxfYF3Lcj/UK+AuIY6og8E2wVTVthzsmE568tkYu51lk4CFOQak UYix89BpWm8wij2xr44NmhujD3ZiXCt9K6/24U4x1yNjefWa8oGGlE0A+FLV92zFWbuu Ddl9A91hsVkOD8M7i8qmCddLG+2opgg++NRjtsxhUm1LTw8DnwxDe5b453m1BuoJovn6 gJ0r3Q64/4A0O0IjQmZUKJN6mYvZkHnw9IZ6pFPuYDbVUPkKUUEwQtpGPO2YqE8RzbDt S8EnFGDafVPYXaDLLn6tEFU3MEgUYhc3yAzuPfWAgI9qtFCRKy9Z6hrpWu3TPhm1wTps Tvjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=raiy5wp5; 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 c12-20020a0564021f8c00b00487575d238asi9543777edc.55.2023.01.09.12.37.02; Mon, 09 Jan 2023 12:37:26 -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=raiy5wp5; 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 S234464AbjAIUfE (ORCPT + 99 others); Mon, 9 Jan 2023 15:35:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235170AbjAIUfA (ORCPT ); Mon, 9 Jan 2023 15:35:00 -0500 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C86B461440 for ; Mon, 9 Jan 2023 12:34:56 -0800 (PST) Received: by mail-yb1-xb49.google.com with SMTP id 11-20020a25050b000000b007b7968a6423so10255758ybf.13 for ; Mon, 09 Jan 2023 12:34:56 -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=2khZ+quYNpCJzdtw6oMn43k0U7G9Lbi6luDGhG8S4qA=; b=raiy5wp5U9GrX48SAiGlvw4axiO2faRoXtK7evJFvPH9PfiVtTCPXcPikZjzCfCYsI 18F4w1mF9pQzzMu399Ms6GL2SDoGgvGhlYvahPjs8UgVFcTK8+LochZpEq8RSl8x+YXL qUPPr8QCuqxH2Anih11R3N/Ltawh+ZnEma2GM0XaUAHmhxN6NBb1TizCt9yN8mNsQs9A OPkK8lOA17L8e209m+KKsU0gV6zshuvtUrJ1J3Po54/IR71feNkx8QckowfUC+Gu2dvl EyXWkeWzbZVqvqnWlnp1Daj9ODihNxtY7v2qCmQt2sCEy7EtHWcXJOfan1f7zPnkJpX6 a/qA== 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=2khZ+quYNpCJzdtw6oMn43k0U7G9Lbi6luDGhG8S4qA=; b=mQ9/ZwWvYsbJUZIBg2Qvx6d1davWTZZTNvnq4jFo3MwQIInWcss7L4g6X2D/U82k8P 0LkmsVTmTitUX2V9O8/RJtAjcRt3HjM0vNUxxMNxW1xj3gSu+2b5QPbdPRAxTZpuWwG4 1BC4L1yedq8LlZBjrI60LoRo71ZcEpEtVTPsWidu6ONdbgjqIJE2WU8kEcoR+vvS2PBw r7Tab3jB+OPhMplHUHjbD3KuXOb5o1VN5wRBDm++APStJIjyx0cig3MUjNW1wx0cCqpw 2JTVHMF+/yEWYEu1itwnr0nkU0/MB6IGF9tl5Fy2axhKJto2pHIQFeBu0U2vu8wxmox6 kAFA== X-Gm-Message-State: AFqh2kqdiaRiHFMPNU0qZEPLTQ3SN/Xucst/A/y2jVTJ1ofzOIKPeDPy yCHbg9U5cWH4JFivrqWJG88FLgE+HFQ+ X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:59e7:81ad:bc43:d9dc]) (user=irogers job=sendgmr) by 2002:a25:e808:0:b0:7b8:507e:26dc with SMTP id k8-20020a25e808000000b007b8507e26dcmr845197ybd.440.1673296496062; Mon, 09 Jan 2023 12:34:56 -0800 (PST) Date: Mon, 9 Jan 2023 12:34:23 -0800 In-Reply-To: <20230109203424.1157561-1-irogers@google.com> Message-Id: <20230109203424.1157561-3-irogers@google.com> Mime-Version: 1.0 References: <20230109203424.1157561-1-irogers@google.com> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog Subject: [PATCH v1 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=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?1754578704400739876?= X-GMAIL-MSGID: =?utf-8?q?1754578704400739876?= 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 | 46 ++++--------------- 9 files changed, 10 insertions(+), 100 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 7c00ce0a7464..399e03338613 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -565,52 +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 - 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 9 20:34:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 41093 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2367933wrt; Mon, 9 Jan 2023 12:37:48 -0800 (PST) X-Google-Smtp-Source: AMrXdXtkEIAC8yhMp+Vg4iR0DL14T81XWzhue4ZlUiDXOa4olZ3eBRjm+FFtH7iUC43LhWT0wWH2 X-Received: by 2002:a17:906:cc4f:b0:84d:12cc:8c19 with SMTP id mm15-20020a170906cc4f00b0084d12cc8c19mr14249071ejb.45.1673296668479; Mon, 09 Jan 2023 12:37:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673296668; cv=none; d=google.com; s=arc-20160816; b=Or2mJDxQhlJKZcSCLeCGMslIwA2K6IfUsc35QxzOvVjSWHZv09mhpsmVFBlk7aeMrf tbe32QPOJghnlpOwXLoYWlKBKDcjlV0VIlbE1ugwqZu+ZKGNLpn+876gCsSk0lT6ILk5 W1T+EBxbD3vhiDbJwZOY67Wi2VlrVzjjH1O4jzEBdnExOXE7zgjOPv5cFjC84zkZoKLv elQR/jpWaS/8MLmE2npWF3qsa/0gR+dySKNni4QR0jihC9C/HTbUwNl5WLUHYbkhY3qp F6OdJn1Zq+bfbOGDaJ+7rr1CHOfzORlfF70B/C9eAv4vIcRtaBAZ9HMC5DPgWnN03m9a S17g== 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=r8To9c/RhjeU3UhCcJpilZYbO96GcFeqlarqkyf14xk=; b=d9wF7hkMcoxHsb86kKxjqTpw+tc7UHrMe3Vp+gdhn8Ksu0opdLUU5CvDrvClj2YWB1 xhMFmxlK5DssbiuA2WA4v2Ehm2xESdq0nfJ2H+WtH5YLCM/F55/5qSlYSKn0rnrR1ygL V27WLFHJfl2x1g2ISnb8xGyFNYGSwl1r5f4imbsTWQWZi+vBnZ2P5t6DC5mTTSpoSqHv Fdw4SkrvRqlo2ANAugRCnQe/iOp68N8udlwcXTN6ag4+AIareParBStCSsC73rSoeJ9/ mRpRTn2T4CuoLEkl81GO9FdtESsqr0O9nW3rovq4LSzXopiZEyRR2siNuE8+/wIf0RBP ZzvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=pBt0bIyd; 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 nd8-20020a170907628800b007807e1f3d9dsi10090805ejc.842.2023.01.09.12.37.24; Mon, 09 Jan 2023 12:37:48 -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=pBt0bIyd; 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 S234961AbjAIUfO (ORCPT + 99 others); Mon, 9 Jan 2023 15:35:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234370AbjAIUfF (ORCPT ); Mon, 9 Jan 2023 15:35:05 -0500 Received: from mail-pj1-x104a.google.com (mail-pj1-x104a.google.com [IPv6:2607:f8b0:4864:20::104a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0E0C6086A for ; Mon, 9 Jan 2023 12:35:04 -0800 (PST) Received: by mail-pj1-x104a.google.com with SMTP id c2-20020a17090a8d0200b002269fb8d787so7864354pjo.0 for ; Mon, 09 Jan 2023 12:35:04 -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=r8To9c/RhjeU3UhCcJpilZYbO96GcFeqlarqkyf14xk=; b=pBt0bIydFOwdKSVmC67SAEC38M3pJdN4Rbbk1sSIr2dLWuKG+E4cAAfIKa+hVPgR6l PSMauWXMYX2UXWlVwJj1DCeuZNq1JrwyrNZVSR0hHDv1QPkudW0vfVXPam8RusLj2wzi twBqKGWkBWo30T5upazEELk5+hstDV4f920U2q7L11Rbpgi+FsLPFzRRLRDXBX4MtcQ3 Z8q3/1FewblD5NeUTT4cKaKavnfexeYXt4hAE5zVgo2DbZNcvLYZbYPtRbL1qHABKurK aPy9TiloeqQbRXNC5zkauL0/6zt5hGuvCIQ628aVBWXXlUe+UOT4ywnNnnuhT12g2vtX hv8g== 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=r8To9c/RhjeU3UhCcJpilZYbO96GcFeqlarqkyf14xk=; b=UmW5zzDeaRQ3UR6MfeoQ+/gv5PrervTrl/mnHqWyWlSfnt/llEwtuQckXapJaX9vVY rCoRvI1Bne5HZZymR25ZIae1Z4oLtWZjoDrCDfwCd/IEuSp6eOxB0vVo5cnSDLns6hW3 zUevLqYLfkUSlYWfDlFbEigkGXVTzHfz0l2sGUqRTXhToH9xBXdG5Jlm7303NeSr5yLk YTjRZiTi5MvR25jaX27DROWawa9lABti/eaHwxqbZrC7VQ+MkDCpHogSWb4MRu0vLHwg YaCDpadSCMRzTHh6QU0vLk5Q7Lel68/RBaggQ/GEqGwQ9aufmFjSlCRjDZmTFw1O5t32 Aopg== X-Gm-Message-State: AFqh2krsNan0Lq7LooJ71qU1cMIHQtQ18ZWAF8E+2rRdEAC4iXdvylA3 Xxug/K1hgPX3amUE4yaYU88qnlMjZy/o X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:59e7:81ad:bc43:d9dc]) (user=irogers job=sendgmr) by 2002:a17:90a:b288:b0:227:f19:eb19 with SMTP id c8-20020a17090ab28800b002270f19eb19mr507224pjr.44.1673296504559; Mon, 09 Jan 2023 12:35:04 -0800 (PST) Date: Mon, 9 Jan 2023 12:34:24 -0800 In-Reply-To: <20230109203424.1157561-1-irogers@google.com> Message-Id: <20230109203424.1157561-4-irogers@google.com> Mime-Version: 1.0 References: <20230109203424.1157561-1-irogers@google.com> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog Subject: [PATCH v1 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=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?1754578727201061369?= X-GMAIL-MSGID: =?utf-8?q?1754578727201061369?= 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 399e03338613..2197970bd503 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];