From nobody Sun Feb 8 16:31:41 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 A02712FE592 for ; Fri, 6 Feb 2026 22:25:16 +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=1770416716; cv=none; b=NXLpmb6fkJHjNwjSV2BfdopGLklRfRHosT378dbgZQYu+G7gRNVVb5RPL6Si8GFv0msyUdlZC8unvE38WwSz47swOvnfIK+4XNcWj9kNzTjm4wFLr3eIIp7hV/QyDOY/9mHGzidclLQyHfstKMykIRTIt59VE3ulg2E5jYzyECI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770416716; c=relaxed/simple; bh=Lszd0UdRB8GQidhdx5Z+Lj/C2pK9X74pxC+as6fOUOI=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=j+alVJXDI6J7zeSGmYnqWPiRFGFNWMWCEe/7suf4dWFxfjURiuvnM4BJmKInLHJjFmdoCaq1IPKN6ZiTZLx2pbk1/1fdSEVoNujM1XjKNgbMhh5EyvLbO6gajEngLENlANCXMABDw/Wms0bmnk0aLKRiz9nIH8L+G1+wnbl3y98= 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=vn+jGuor; 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="vn+jGuor" Received: by mail-dl1-f73.google.com with SMTP id a92af1059eb24-1270e3704d6so2046124c88.0 for ; Fri, 06 Feb 2026 14:25:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1770416716; x=1771021516; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=trHHoM5lxs3R3c1XXOrfjjzTr20GXbuQCFUGYGyaPS8=; b=vn+jGuordLEz5m/xRJC+r4wB1k9fTsiXaW+BGr/X8+FU6ks5SHLg9I60/GDCduF2Bq 7nTvn/aA1FYGParjRgIc1n7KB4qVSlXlzE3GPt69MwNlI1w1de/+VAGOX9wF+jqVE6Gy vXy9Qp7yVLoZtWDRd0FLOM53HNxRSiTH+1uZviqypKYNU3RKLBoMy1qGTRzP3u6srztW JJmdCkZdpW+8PCg81u+aMJF//yD/jAfgJDXHCmHk3qor+pdKamsWfNPm7Z8wdkqYjVwz bKhVi2/rPpprFQJrSjRNS8i6sq8mEjKGuCWtGCx1loLCuP9MPHhkCwTlQHxiIfkrXoyy DL4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770416716; x=1771021516; h=cc: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=trHHoM5lxs3R3c1XXOrfjjzTr20GXbuQCFUGYGyaPS8=; b=jklq0YQWN4UPC7I3zPaV6QoSWYuvTF8XmKQZaQz7rPF5W2VX8c8dbxnS3Q0QNmNkB2 d1Umvr6QNlClFCbte/uYOnerwMJEBFuo4UzmNNPwkuyPAiBhN6Je/KvdAOXQDagMClUn 0cr7sbP7IbdP/sr8z5Zsz0JJYsoPUrMPPdIpRrtocG/p9WSXOwHFijOAsntiCq+Sxgd+ ljQ2JGOwwJF6wk8fpi2qhFpM7i9unvNvK0X6C2mlmqovdYEYd6+l8ZHl+2ex7WLn5V0S G4HSLRN4z+AV7pLj5zPO4o+2YJSC8OllPCl1omwuJ0Isv6NaS8i+jpnYIEawTJSyvfv9 nujA== X-Forwarded-Encrypted: i=1; AJvYcCXsSTM5KYo6oYIHoANG81ziPtQQTo/VxdU9Z6Zji9nZZHMtNEMw8FCeatjvoCna+xxGGFF3IEBfOYXq8IM=@vger.kernel.org X-Gm-Message-State: AOJu0YxO2zODvecg6M4nxsUXrEtoAz49URlg+3NXxWd/OHX79VKAh13d dRMh6OaqFjlQq1pQjmhJh5pJg59Q6/WXoNKbYXpgtDwtTd6B/H2Ms8TD25RfeJfcG3opXdISEcb 7a5J1obd35Q== X-Received: from dlbrb7.prod.google.com ([2002:a05:7022:f007:b0:123:12b9:c4e5]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:6186:b0:124:8d84:1d8f with SMTP id a92af1059eb24-127041695a8mr1587889c88.23.1770416715668; Fri, 06 Feb 2026 14:25:15 -0800 (PST) Date: Fri, 6 Feb 2026 14:25:04 -0800 In-Reply-To: <20260206222509.982489-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: <20260206222509.982489-1-irogers@google.com> X-Mailer: git-send-email 2.53.0.rc2.204.g2597b5adb4-goog Message-ID: <20260206222509.982489-2-irogers@google.com> Subject: [PATCH v8 1/6] Revert "perf tool_pmu: More accurately set the cpus for tool events" From: Ian Rogers To: acme@kernel.org Cc: adrian.hunter@intel.com, ak@linux.intel.com, alexander.shishkin@linux.intel.com, andres@anarazel.de, dapeng1.mi@linux.intel.com, irogers@google.com, james.clark@linaro.org, jolsa@kernel.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux@treblig.org, mingo@redhat.com, namhyung@kernel.org, peterz@infradead.org, thomas.falcon@intel.com, tmricht@linux.ibm.com, yang.lee@linux.alibaba.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This reverts commit d8d8a0b3603a9a8fa207cf9e4f292e81dc5d1008. The setting of a user CPU map can cause an empty intersection when combined with CPU 0 and the event removed. This later triggers a segv in the stat-shadow logic. Let's put back a full online CPU map for now by reverting this patch. Reported-by: Andres Freund Closes: https://lore.kernel.org/linux-perf-users/cgja46br2smmznxs7kbeabs6zg= v3b4olfqgh2fdp5mxk2yom4v@w6jjgov6hdi6/ Signed-off-by: Ian Rogers --- tools/perf/util/parse-events.c | 9 ++------- tools/perf/util/tool_pmu.c | 19 ------------------- tools/perf/util/tool_pmu.h | 1 - 3 files changed, 2 insertions(+), 27 deletions(-) diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index d4647ded340f..f631bf7a919f 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -30,7 +30,6 @@ #include "util/event.h" #include "util/bpf-filter.h" #include "util/stat.h" -#include "util/tool_pmu.h" #include "util/util.h" #include "tracepoint.h" #include @@ -230,12 +229,8 @@ __add_event(struct list_head *list, int *idx, if (pmu) { is_pmu_core =3D pmu->is_core; pmu_cpus =3D perf_cpu_map__get(pmu->cpus); - if (perf_cpu_map__is_empty(pmu_cpus)) { - if (perf_pmu__is_tool(pmu)) - pmu_cpus =3D tool_pmu__cpus(attr); - else - pmu_cpus =3D cpu_map__online(); - } + if (perf_cpu_map__is_empty(pmu_cpus)) + pmu_cpus =3D cpu_map__online(); } else { is_pmu_core =3D (attr->type =3D=3D PERF_TYPE_HARDWARE || attr->type =3D=3D PERF_TYPE_HW_CACHE); diff --git a/tools/perf/util/tool_pmu.c b/tools/perf/util/tool_pmu.c index 37c4eae0bef1..6a9df3dc0e07 100644 --- a/tools/perf/util/tool_pmu.c +++ b/tools/perf/util/tool_pmu.c @@ -2,7 +2,6 @@ #include "cgroup.h" #include "counts.h" #include "cputopo.h" -#include "debug.h" #include "evsel.h" #include "pmu.h" #include "print-events.h" @@ -14,7 +13,6 @@ #include #include #include -#include #include #include #include @@ -111,23 +109,6 @@ const char *evsel__tool_pmu_event_name(const struct ev= sel *evsel) return tool_pmu__event_to_str(evsel->core.attr.config); } =20 -struct perf_cpu_map *tool_pmu__cpus(struct perf_event_attr *attr) -{ - static struct perf_cpu_map *cpu0_map; - enum tool_pmu_event event =3D (enum tool_pmu_event)attr->config; - - if (event <=3D TOOL_PMU__EVENT_NONE || event >=3D TOOL_PMU__EVENT_MAX) { - pr_err("Invalid tool PMU event config %llx\n", attr->config); - return NULL; - } - if (event =3D=3D TOOL_PMU__EVENT_USER_TIME || event =3D=3D TOOL_PMU__EVEN= T_SYSTEM_TIME) - return cpu_map__online(); - - if (!cpu0_map) - cpu0_map =3D perf_cpu_map__new_int(0); - return perf_cpu_map__get(cpu0_map); -} - static bool read_until_char(struct io *io, char e) { int c; diff --git a/tools/perf/util/tool_pmu.h b/tools/perf/util/tool_pmu.h index ea343d1983d3..f1714001bc1d 100644 --- a/tools/perf/util/tool_pmu.h +++ b/tools/perf/util/tool_pmu.h @@ -46,7 +46,6 @@ bool tool_pmu__read_event(enum tool_pmu_event ev, u64 tool_pmu__cpu_slots_per_cycle(void); =20 bool perf_pmu__is_tool(const struct perf_pmu *pmu); -struct perf_cpu_map *tool_pmu__cpus(struct perf_event_attr *attr); =20 bool evsel__is_tool(const struct evsel *evsel); enum tool_pmu_event evsel__tool_event(const struct evsel *evsel); --=20 2.53.0.rc2.204.g2597b5adb4-goog