From nobody Mon Feb 9 13:00:57 2026 Received: from mail-dl1-f73.google.com (mail-dl1-f73.google.com [74.125.82.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D907330DD08 for ; Sat, 7 Feb 2026 08:24:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770452694; cv=none; b=lXj5gFABUP3jdUNNgzzEFydg6D3SAfp156kXd8C/U8SJ9lyA+b59nxMaDRKlnKYsplqz+NjjNKn9V+RKBjq7t+Z2A32M+Rzngk4sTDtnrUJyTYSIbDElmrDIikZOk/onGbuzTW/PMH8hIz41sHbcbzpeaSQ7Re70daHnaBAG840= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770452694; c=relaxed/simple; bh=rH5/T6FT365KFZmlKnO8FVcvnpa30Sdy8DDRsLNiNPk=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Content-Type; b=Fs+kvBRxyI7AO3dbnaDBhOtlL68yRELCUvaliQ6jIzBbj6VrLxU1+wuIVDDTpEFZyG9F8/i5k3PrhnojwR6KWuJ5zZkVUe/SKNeUDYiOWwCtLL69nNxuFAa2w8RAgO7kPgh5pLr+NVzK83dKElAHQABtqogRwbDH5+RkvrrioyI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=tur3aFjv; arc=none smtp.client-ip=74.125.82.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="tur3aFjv" Received: by mail-dl1-f73.google.com with SMTP id a92af1059eb24-1270dcd11c1so908663c88.0 for ; Sat, 07 Feb 2026 00:24:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1770452693; x=1771057493; darn=vger.kernel.org; h=to:from:subject:message-id:references:mime-version:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=7d6a//qLSGe67LfY/IQ7qyHIlWhv3Mm2rhpPsBvuHso=; b=tur3aFjviSYOuDgvGlfi203e6LyqHbaXXWjwOlR9Tt0mFOFmoL80sP+FNFADeEPYXm KOiwl8C4ZKKCD+NulodA6wyf7dFwZHxlIeXSsqM8fUIzjfint/XM9ABDKrS6URCHZhWD 2DiHcepKwhJ5fx6Aeuoy6xK+EGJPrCmcE9rhTL4lcaFvQD6/hjwntz6XeU7AjalFLFGv 3CWKX12HnKZynZRGP3ziGc7B0DCaYiusmNWYlhw8KT9z7PtODri6oPs9H0WZPFw14JEO cFMkzy566QWeTE/FEdyCMD4g+uw+CrPL8CBKazae79syTrYjqcgpzISQSWwwo4OOPp8+ c/tQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770452693; x=1771057493; h=to:from:subject:message-id:references:mime-version:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=7d6a//qLSGe67LfY/IQ7qyHIlWhv3Mm2rhpPsBvuHso=; b=OHoX55wdANUo/pvdlSA2N8w4SvgtXI72XO7gzZCyN5OEjvSBzr2ewnm9TT97RZ4CsD WC9tSaHewmjym4AZArWuD1xLb0VbqTzmRpMqWd9IA6oD2Skj2mCvjIEc/7HBEdQbVQAI Phku4ANZylmngrhdb/Ajsb6R5U/TqzsuTQRb5f9lXe5YpYfRAAnYbjc9o+rW+tV28cpD oyGXZT+D5SpYAcu9KJf0paygqBcWmJeAALsuOoBM2Exne1yJwBFFai0FuNev1eKz8Mzg iOZY/6gUNH+Jqtwy6oJqQrd8o1WLfG5ZKFTh4fWNfqu90tnXE3ks54FASEhH5RvcHGPQ efUA== X-Forwarded-Encrypted: i=1; AJvYcCWLoDmWO9S+J33DoilMME0iDGhLi/NVARfoFobR2DXItpEeI7CtHRiptgPxOigGdhwhTwNeA2RSXlqFqY8=@vger.kernel.org X-Gm-Message-State: AOJu0YzuEYtnQnVslijp9M/2/Ilx9/U1E2PPy5IRv5EG8aefm5q9sejJ GBj3nNY7oHGzVZLFSdU0jfkKA7aC3TPw0v3unKpPlksgU51/0qKj5NCzoe2sJSd4zFatQhQ9/TO JZkZg09tZRQ== X-Received: from dlbpk3.prod.google.com ([2002:a05:7022:3843:b0:11b:d8a1:4048]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:1b0b:b0:127:c88:d597 with SMTP id a92af1059eb24-1270c88da04mr1886807c88.10.1770452693030; Sat, 07 Feb 2026 00:24:53 -0800 (PST) Date: Sat, 7 Feb 2026 00:24:27 -0800 In-Reply-To: <20260207082428.1742209-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260207082428.1742209-1-irogers@google.com> X-Mailer: git-send-email 2.53.0.239.g8d8fc8a987-goog Message-ID: <20260207082428.1742209-5-irogers@google.com> Subject: [PATCH v1 4/5] perf bpf_map: Remove unused code From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , Eric Biggers , Palmer Dabbelt , Stephen Brennan , Haibo Xu , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" bpf_map__fprintf is unused so delete it, the header file declaring it and the now unused static helper functions. Signed-off-by: Ian Rogers --- tools/perf/builtin-trace.c | 1 - tools/perf/util/Build | 1 - tools/perf/util/bpf_map.c | 70 -------------------------------------- tools/perf/util/bpf_map.h | 23 ------------- 4 files changed, 95 deletions(-) delete mode 100644 tools/perf/util/bpf_map.c delete mode 100644 tools/perf/util/bpf_map.h diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 311d9da9896a..2aaa3ff452ac 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c @@ -21,7 +21,6 @@ #include #include #endif -#include "util/bpf_map.h" #include "util/rlimit.h" #include "builtin.h" #include "util/cgroup.h" diff --git a/tools/perf/util/Build b/tools/perf/util/Build index 89de23dec401..70cc91d00804 100644 --- a/tools/perf/util/Build +++ b/tools/perf/util/Build @@ -170,7 +170,6 @@ perf-util-y +=3D mutex.o perf-util-y +=3D sharded_mutex.o perf-util-y +=3D intel-tpebs.o =20 -perf-util-$(CONFIG_LIBBPF) +=3D bpf_map.o perf-util-$(CONFIG_PERF_BPF_SKEL) +=3D bpf_counter.o perf-util-$(CONFIG_PERF_BPF_SKEL) +=3D bpf_counter_cgroup.o perf-util-$(CONFIG_PERF_BPF_SKEL) +=3D bpf_ftrace.o diff --git a/tools/perf/util/bpf_map.c b/tools/perf/util/bpf_map.c deleted file mode 100644 index 442f91b4e8e1..000000000000 --- a/tools/perf/util/bpf_map.c +++ /dev/null @@ -1,70 +0,0 @@ -// SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) - -#include "util/bpf_map.h" -#include -#include -#include -#include -#include -#include -#include -#include - -static bool bpf_map__is_per_cpu(enum bpf_map_type type) -{ - return type =3D=3D BPF_MAP_TYPE_PERCPU_HASH || - type =3D=3D BPF_MAP_TYPE_PERCPU_ARRAY || - type =3D=3D BPF_MAP_TYPE_LRU_PERCPU_HASH || - type =3D=3D BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE; -} - -static void *bpf_map__alloc_value(const struct bpf_map *map) -{ - if (bpf_map__is_per_cpu(bpf_map__type(map))) - return malloc(round_up(bpf_map__value_size(map), 8) * - sysconf(_SC_NPROCESSORS_CONF)); - - return malloc(bpf_map__value_size(map)); -} - -int bpf_map__fprintf(struct bpf_map *map, FILE *fp) -{ - void *prev_key =3D NULL, *key, *value; - int fd =3D bpf_map__fd(map), err; - int printed =3D 0; - - if (fd < 0) - return fd; - - err =3D -ENOMEM; - key =3D malloc(bpf_map__key_size(map)); - if (key =3D=3D NULL) - goto out; - - value =3D bpf_map__alloc_value(map); - if (value =3D=3D NULL) - goto out_free_key; - - while ((err =3D bpf_map_get_next_key(fd, prev_key, key) =3D=3D 0)) { - int intkey =3D *(int *)key; - - if (!bpf_map_lookup_elem(fd, key, value)) { - bool boolval =3D *(bool *)value; - if (boolval) - printed +=3D fprintf(fp, "[%d] =3D %d,\n", intkey, boolval); - } else { - printed +=3D fprintf(fp, "[%d] =3D ERROR,\n", intkey); - } - - prev_key =3D key; - } - - if (err =3D=3D ENOENT) - err =3D printed; - - free(value); -out_free_key: - free(key); -out: - return err; -} diff --git a/tools/perf/util/bpf_map.h b/tools/perf/util/bpf_map.h deleted file mode 100644 index c2f7c13cba23..000000000000 --- a/tools/perf/util/bpf_map.h +++ /dev/null @@ -1,23 +0,0 @@ -// SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) -#ifndef __PERF_BPF_MAP_H -#define __PERF_BPF_MAP_H 1 - -#include -struct bpf_map; - -#ifdef HAVE_LIBBPF_SUPPORT - -int bpf_map__fprintf(struct bpf_map *map, FILE *fp); - -#else - -#include - -static inline int bpf_map__fprintf(struct bpf_map *map __maybe_unused, FIL= E *fp __maybe_unused) -{ - return 0; -} - -#endif // HAVE_LIBBPF_SUPPORT - -#endif // __PERF_BPF_MAP_H --=20 2.53.0.239.g8d8fc8a987-goog