From nobody Wed Apr 1 22:34:21 2026 Received: from mail-dy1-f202.google.com (mail-dy1-f202.google.com [74.125.82.202]) (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 AC2BA2F3C1F for ; Wed, 1 Apr 2026 05:52:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775022733; cv=none; b=B9Jq6C5JROJcw63D30llbpNreska2JnzNQ0dcvq36OQ0kydhNUzDrAJrCTOWQAuLPYqMPAlm4/BLkNNKREaDZVZsZxdqy77gOXxILARGV92CqMlpgklqdkKY4LFrk8H96Duu/K7iUKkxMIkEl/al/x1rq1mNHPntJOfuYVpjc8U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775022733; c=relaxed/simple; bh=M6LerUGQ/FegXHi0SxaTfjtXEbJdYcXQ+sl9wiXh/SQ=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=o26nyB0Aru4niZC1Zjp2PpgNJ8qucDsKWnj/yO90fcrU5uiGvrxi6bB1B3cETnWHlxqukg15yA8VO7SMSMI5MU92JA0VeL7k8mwNO9/B7XiDcXxygdNbIE8LGbUzvvf9J9M8Ie+29BYznFdNXhi0ApTifJOafehifw/r+rOCCbw= 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=YY4aStpi; arc=none smtp.client-ip=74.125.82.202 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="YY4aStpi" Received: by mail-dy1-f202.google.com with SMTP id 5a478bee46e88-2bda35eab74so774941eec.0 for ; Tue, 31 Mar 2026 22:52:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1775022732; x=1775627532; 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=0+JPhC0NfmjsreQ1S+6TmS21rrwcvm5mWtScohYKt4w=; b=YY4aStpiM/U9RYVlOTtSutUfCmdWmsnn7o4nWKGi49Ofr2iReqJfH40H6TRaY/77K9 f4t6KnCY0sCdo6zt+gV1ooWipvTkGdxNlxcrcL8upaU16n6JF9Vc7sSsCjk8Gb8NPo1b EByH0hyyiol0EkEy7sJYuznCizgFMBun5ArKP2vqORf82dZ1+9lr0U4CU3oegGWHqM8o kyEqdHCo36HvyCYKJlZg6jvOyLRurG34glO2npB+r9VoggYuD6oPQL5KvA8A9cyVDOyU RKj1xKxRSG/0hDCJoQjhIAo+T0pNG2eauuTPV6KPlLIOWELF2WLAV3OmdMfPOy/cJvf/ DPyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775022732; x=1775627532; 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=0+JPhC0NfmjsreQ1S+6TmS21rrwcvm5mWtScohYKt4w=; b=sOa0Uu7jAO22WvsQ7Q5qW312QuLSL73RCunbMQUdGKvUZbKyqxWX/XZfSPOgatLuAh lRF63d9nvkU3jXM0Zc4tYohfkdQDwJEbLTGvLfZPjRKbL/EvShyUiiXecsmWNbXrTfLB nEzRwKCtbsR7mlR9Cz5AmYyZzM8HKBBDOTPIeYFq0I43dOj97Ody0Fe1MKKqpqpqlXYl rWZ7/8E+6Xw5AoimC5BmKr84vYfFDbv9aXz6P3ziNJU37f0ZYqR8YttcuD0pKDiw+88e DhC6ImXJzUR4Zcv9jYF5JyCmclD/NzrVY+bQIV5VNaun6ssSMECWLQwQ/pPejKKjlMqn ohMw== X-Forwarded-Encrypted: i=1; AJvYcCX4Q8P8LlP0HrIqbkFUgkQ953Bc7H25WM6u7KQsGuWAQdU46dqkDIHBD1NBsaLl+uiIlNJODblRBjoszTk=@vger.kernel.org X-Gm-Message-State: AOJu0YwcSJh/zoqi8pbWN+2vWjqSFTg30aUGqZpcznRFJXn0lsT/2wec WYWrC4J/JeBN/0YkGcxnBMWqzBLVZeilb2ASE8WcL8+q3E2o5d0NhHzFsHNLLc4h7yqGtC18TwU JVnW7zSU98Q== X-Received: from dybpk4.prod.google.com ([2002:a05:7301:4284:b0:2c5:c691:e8a3]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7300:6c1f:b0:2c4:8990:393a with SMTP id 5a478bee46e88-2c7bd4704ddmr3282942eec.19.1775022731687; Tue, 31 Mar 2026 22:52:11 -0700 (PDT) Date: Tue, 31 Mar 2026 22:52:00 -0700 In-Reply-To: <20260401055206.43187-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: <20260228065953.3226283-1-irogers@google.com> <20260401055206.43187-1-irogers@google.com> X-Mailer: git-send-email 2.53.0.1118.gaef5881109-goog Message-ID: <20260401055206.43187-2-irogers@google.com> Subject: [PATCH v3 1/7] perf clockid: Add missing include From: Ian Rogers To: acme@kernel.org, namhyung@kernel.org Cc: irogers@google.com, adrian.hunter@intel.com, alexander.shishkin@linux.intel.com, ashelat@redhat.com, ctshao@google.com, derek.foreman@collabora.com, howardchu95@gmail.com, hrishikesh123s@gmail.com, james.clark@linaro.org, jolsa@kernel.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, mingo@redhat.com, peterz@infradead.org, swapnil.sapkal@amd.com, thomas.falcon@intel.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" clockid_t is declared in time.h but the include is missing. Reordering header files may result in build breakages. Add the include to avoid this. Signed-off-by: Ian Rogers --- tools/perf/util/clockid.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/clockid.h b/tools/perf/util/clockid.h index 9b49b4711c76..33dbd8673c1c 100644 --- a/tools/perf/util/clockid.h +++ b/tools/perf/util/clockid.h @@ -1,8 +1,9 @@ /* SPDX-License-Identifier: GPL-2.0 */ - #ifndef __PERF_CLOCKID_H #define __PERF_CLOCKID_H =20 +#include + struct option; int parse_clockid(const struct option *opt, const char *str, int unset); =20 --=20 2.53.0.1118.gaef5881109-goog From nobody Wed Apr 1 22:34:21 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 B2E5332937A for ; Wed, 1 Apr 2026 05:52:14 +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=1775022735; cv=none; b=U67ctPG17s9hjHeubvrNoMklhaEM5dBmSIww0KVKKZwWoGHbbSibscsbp5RJuO1Oq6hm3V7nuOYHByVaTWgRzjXyUOMiRvK04z8TmSkCi4VpRrcI7tEJB5362Qz+elDJHrsSGG45hc6bGV29+DBeiBmnMlPgYgSqhmt7XRM9irQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775022735; c=relaxed/simple; bh=ur1ihC43xddQznk7Ns8aDDmFgrqkWiVi+eSJlMQwVr4=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=kXxg5Bd+HhHdoGT5LtWEwwYj5hDCS7PnZBeP77ueSp7uz7dAtCSlwxt2sTyF22dkjiISp0CbgsPy6j9UYpQYyaubqEutJiM1cjTES7znrVsitLnqsTqChDYU/0l5WpoBqsuFl42p5+4PLY/4wfU50Av/S2OSkagwHMh14MZwgAI= 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=Qe56PJv6; 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="Qe56PJv6" Received: by mail-dl1-f73.google.com with SMTP id a92af1059eb24-126e8ee6227so7996439c88.0 for ; Tue, 31 Mar 2026 22:52:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1775022734; x=1775627534; 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=CzUE8o/xisKqOKJCzk2aXjzNBdGN2jfwbKU3R/mLXoE=; b=Qe56PJv6TEezovrVclkcs2pRGutqd9Uk+KIPKEvvRke1xckjAtAXbSgp4hvO27Zx+S Ega5ydgrrHfYkbwrJmNqX1Jh0HiNm3pNETOmbI7xj6z1arJQMuRoNLXPeN0MsVaSkR// VkeX07YKXg1dKvpE3YT6OIqDLkFVhg7YmiSG0JgyyRXQ2Ic+LTF3zMpblL8MhSuFzTOz E+FkP0Bd0YG8PlyitxObm++o4nWSVCuWIyhuJx5RLE2sx8taFKFURONNrh7Lp3Tz4WfC InhyVytvHK6+OaoP0VLpKzSJp5iw7rOhC+t2lEM+bDhmQ3Kn99HC6WBHpGuDymxSmaRr khzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775022734; x=1775627534; 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=CzUE8o/xisKqOKJCzk2aXjzNBdGN2jfwbKU3R/mLXoE=; b=ejt2SG2xlqLRFCIGXz/g/oIZkurcL5o25hV8kbHZ5X2ZZAsdSSui3qDcCHKzYMrwjI xZsAUMzQGg/OlfjRrzM5mXEkSKmwffTo0CDz4aDGT2H5ApqImYJ5ZAyqjjscttx+Qk4V 2+eJBtcxjPvLMRI3PcnfBl+4fay8DwaL/yv1apBUqmb4wl3mI5FKjR/Ye1mgzpAI30mG f6iT0cCg2N/Z2XAP1D2C5M8bRpobGQSYIpomFbhd7ErIrm3fAFsgz01RkIG1jG/kuqy9 BhCXp+GvN0Zlv2R/nxoPUjoq7esm5gFHdNMi3o7ngzooMMtFPGKWwagzzWbHzPHgX5aV +aGg== X-Forwarded-Encrypted: i=1; AJvYcCV13hBh1wlSKlFE7NJuVhW+MuZZp/4p1LrfK9sto7mZPJo2gY26ym82ImzEHKknv0YYuO4lelJ421NGif8=@vger.kernel.org X-Gm-Message-State: AOJu0YwuttxXFCpzLDuaEf9E4AjM3lIf8skcfBFy6D5ApYVghkgP0rFa ifxAxOyfeeF7Nya0Lk1+srFy5bnGZpmoDYyfZyLxMyZy7UxIpCgwB9x2MApA4hSYvSVghY1UWJ4 IULBfazy3Eg== X-Received: from dlbvg26.prod.google.com ([2002:a05:7022:7f1a:b0:128:ee69:eb75]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:602:b0:128:ccb7:7fa3 with SMTP id a92af1059eb24-12be6587e81mr1348386c88.34.1775022733680; Tue, 31 Mar 2026 22:52:13 -0700 (PDT) Date: Tue, 31 Mar 2026 22:52:01 -0700 In-Reply-To: <20260401055206.43187-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: <20260228065953.3226283-1-irogers@google.com> <20260401055206.43187-1-irogers@google.com> X-Mailer: git-send-email 2.53.0.1118.gaef5881109-goog Message-ID: <20260401055206.43187-3-irogers@google.com> Subject: [PATCH v3 2/7] perf header: Add utility to convert feature number to a string From: Ian Rogers To: acme@kernel.org, namhyung@kernel.org Cc: irogers@google.com, adrian.hunter@intel.com, alexander.shishkin@linux.intel.com, ashelat@redhat.com, ctshao@google.com, derek.foreman@collabora.com, howardchu95@gmail.com, hrishikesh123s@gmail.com, james.clark@linaro.org, jolsa@kernel.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, mingo@redhat.com, peterz@infradead.org, swapnil.sapkal@amd.com, thomas.falcon@intel.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" For logging and debug messages it can be convenient to convert a feature number to a name. Add header_feat__name for this and reuse the data already within the feat_ops struct. Signed-off-by: Ian Rogers --- tools/perf/util/header.c | 7 +++++++ tools/perf/util/header.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index 9142a8ba4019..fe5d21dde04f 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c @@ -3770,6 +3770,13 @@ struct header_print_data { bool full; /* extended list of headers */ }; =20 +const char *header_feat__name(unsigned int id) +{ + if (id < HEADER_LAST_FEATURE) + return feat_ops[id].name; + return "INVALID"; +} + static int perf_file_section__fprintf_info(struct perf_file_section *secti= on, struct perf_header *ph, int feat, int fd, void *data) diff --git a/tools/perf/util/header.h b/tools/perf/util/header.h index cc40ac796f52..ca22030a1434 100644 --- a/tools/perf/util/header.h +++ b/tools/perf/util/header.h @@ -132,6 +132,8 @@ struct perf_header_feature_ops { =20 extern const char perf_version_string[]; =20 +const char *header_feat__name(unsigned int id); + int perf_session__read_header(struct perf_session *session); int perf_session__write_header(struct perf_session *session, struct evlist *evlist, --=20 2.53.0.1118.gaef5881109-goog From nobody Wed Apr 1 22:34:21 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 94AD732A3C9 for ; Wed, 1 Apr 2026 05:52: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=1775022737; cv=none; b=STlcM7qCslnTwjG1W0J6g/xLxheffGHf86wb7AeR1nWRb3EJTsdsH8v+w6tyd+0YvfwdVZ272Zb3TUR8mughGaLym0t08iL88/rS/UnDcYOag4TbjvoIpF6xezM6yQm4j1JXVfh9p5Sm2Y5OiWotQNNLDqsrF094tNs6z9kZq2g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775022737; c=relaxed/simple; bh=etWLpPUbAL9PbGn2PsAzD1vzOgdSqQ+V+536k9PjEfA=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=aPhQR5EEmsLA0Z5uqCNRHsEt2jBsXr76ejNhbqdbnyfIu1qk2j/KOBnzagPmCdYHdKCM/AFKINOt0bFCCzKLIy+cCUzx2HttDUWRlPw4ik74hgUrO39nQy4KACG1p+k22qio0kVlET6Cf7sM1V225NfPzhAZb6gb45CHvCZ1gdE= 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=fguTCcAR; 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="fguTCcAR" Received: by mail-dl1-f73.google.com with SMTP id a92af1059eb24-127337c8e52so11418443c88.1 for ; Tue, 31 Mar 2026 22:52:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1775022736; x=1775627536; 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=WMSD5CIynbKr+BJ31meFhjj49c+zZqPVABuWE4dY/sQ=; b=fguTCcARQzzg7D5v4oX3OL9t0cGqUNMKHPWvYPqnpE7ng9CO5r9kzBc9Pv6jKCGoSm r1SruYbYTvcyvgH5HwsAc18OLrtHsxXcxgyXjPUGM68sKPzKDUrUHethZarYTVKavwoM DvMjLcbwQ1CYz6wF+yrM8pW53m5oZs1idi0ZLu5k8eEZK96iRrrpGoi5ECBkJt+ADOM1 Qab+A7VoW5EuCopYxlsQu7iudq1f86ULCHwpXYAD4p4KvAWJNcP0LaQwLt45NwX8Ef/z F5762UmqjsU66XhMetv4vNddTBEYMw00LQ0YYnH269kCQ9K44fpURsccGkAugDimKO5j GTjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775022736; x=1775627536; 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=WMSD5CIynbKr+BJ31meFhjj49c+zZqPVABuWE4dY/sQ=; b=S3TzIG1WM9NbrPqWKWJ3aRLtoHudloqjCeMVd3acj112WJt/Nz/iaRNBt/mQzP49Zx vVj1o8gZ9HWHG7PVkrAMNGDVb07ntcEXCDEfxRIijqXaFjgQXYDXiMV5mgKBPnQ59PQq k8a7E7zTF8Kvz10P3WmGOXhJFquSJB/JrCD4WqeC0LLG1PfXDgmf3FLLUOz6nX+ObGMi wI439qMKI4Cr64mSEs6V9pqGfkxWwUPsEhu15FTD2qUFLOj+EzHMI/Yb1S9lY2cIkHC/ mox8bA+Lf/I0D2AwTQ4itwjnssbqsS9fFICnmjE7GVWcOBeCO38K+F7rXZYJr2AotmOO c4dQ== X-Forwarded-Encrypted: i=1; AJvYcCV1wBtmIHPRY8vSWA3Kydd/ZvTwEZauYGkLhW+LP/TwxctOxbmMc8myfSmOfpvSsshk/wvN1wYlROwUStA=@vger.kernel.org X-Gm-Message-State: AOJu0YwINL/xiXyZuTyISTzAiy22BsvE9VIPTp29QM0pcJGTmSWRc2m/ 8SQHTj+IqGUeala3eG2rFnw/7nzzYr1E4N++m9CNZLTh5fxMKNn+uGlLboht5eCWNoQ9ybdsY4i G1hSIqcPVhw== X-Received: from dlbvv5.prod.google.com ([2002:a05:7022:5f05:b0:12a:6a54:c33e]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:2220:b0:128:d438:cad with SMTP id a92af1059eb24-12be65577b5mr1511311c88.18.1775022735419; Tue, 31 Mar 2026 22:52:15 -0700 (PDT) Date: Tue, 31 Mar 2026 22:52:02 -0700 In-Reply-To: <20260401055206.43187-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: <20260228065953.3226283-1-irogers@google.com> <20260401055206.43187-1-irogers@google.com> X-Mailer: git-send-email 2.53.0.1118.gaef5881109-goog Message-ID: <20260401055206.43187-4-irogers@google.com> Subject: [PATCH v3 3/7] perf session: Extra logging for failed to process events From: Ian Rogers To: acme@kernel.org, namhyung@kernel.org Cc: irogers@google.com, adrian.hunter@intel.com, alexander.shishkin@linux.intel.com, ashelat@redhat.com, ctshao@google.com, derek.foreman@collabora.com, howardchu95@gmail.com, hrishikesh123s@gmail.com, james.clark@linaro.org, jolsa@kernel.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, mingo@redhat.com, peterz@infradead.org, swapnil.sapkal@amd.com, thomas.falcon@intel.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Print log information in ordered event processing so that the cause of finished round failing is clearer. Print the event name along with its number when an event isn't processed. Add extra detail about where the failure happened. The following log lines come from running `perf data convert`. Before: 0xa250 [0x10]: failed to process type: 80 After: 0xa250 [0x10]: piped event processing failed for event of type: FEATURE (= 80) Signed-off-by: Ian Rogers --- tools/perf/util/session.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 4b465abfa36c..492515789d3d 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -131,10 +131,17 @@ static int ordered_events__deliver_event(struct order= ed_events *oe, { struct perf_session *session =3D container_of(oe, struct perf_session, ordered_events); + int ret =3D perf_session__deliver_event(session, event->event, + session->tool, event->file_offset, + event->file_path); =20 - return perf_session__deliver_event(session, event->event, - session->tool, event->file_offset, - event->file_path); + if (ret) { + pr_err("%#" PRIx64 " [%#x]: ordered event processing failed (%d) for eve= nt of type: %s (%d)\n", + event->file_offset, event->event->header.size, ret, + perf_event__name(event->event->header.type), + event->event->header.type); + } + return ret; } =20 struct perf_session *__perf_session__new(struct perf_data *data, @@ -2110,8 +2117,10 @@ static int __perf_session__process_pipe_events(struc= t perf_session *session) } =20 if ((skip =3D perf_session__process_event(session, event, head, "pipe")) = < 0) { - pr_err("%#" PRIx64 " [%#x]: failed to process type: %d\n", - head, event->header.size, event->header.type); + pr_err("%#" PRIx64 " [%#x]: piped event processing failed for event of t= ype: %s (%d)\n", + head, event->header.size, + perf_event__name(event->header.type), + event->header.type); err =3D -EINVAL; goto out_err; } @@ -2225,8 +2234,10 @@ static int __perf_session__process_decomp_events(str= uct perf_session *session) if (size < sizeof(struct perf_event_header) || (skip =3D perf_session__process_event(session, event, decomp->file_p= os, decomp->file_path)) < 0) { - pr_err("%#" PRIx64 " [%#x]: failed to process type: %d\n", - decomp->file_pos + decomp->head, event->header.size, event->header.typ= e); + pr_err("%#" PRIx64 " [%#x]: decompress event processing failed for even= t of type: %s (%d)\n", + decomp->file_pos + decomp->head, event->header.size, + perf_event__name(event->header.type), + event->header.type); return -EINVAL; } =20 @@ -2382,8 +2393,9 @@ reader__read_event(struct reader *rd, struct perf_ses= sion *session, if (size < sizeof(struct perf_event_header) || (skip =3D rd->process(session, event, rd->file_pos, rd->path)) < 0) { errno =3D -skip; - pr_err("%#" PRIx64 " [%#x]: failed to process type: %d [%m]\n", + pr_err("%#" PRIx64 " [%#x]: processing failed for event of type: %s (%d)= [%m]\n", rd->file_offset + rd->head, event->header.size, + perf_event__name(event->header.type), event->header.type); err =3D skip; goto out; --=20 2.53.0.1118.gaef5881109-goog From nobody Wed Apr 1 22:34:21 2026 Received: from mail-dy1-f202.google.com (mail-dy1-f202.google.com [74.125.82.202]) (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 73E4D32A3DE for ; Wed, 1 Apr 2026 05:52:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775022741; cv=none; b=kJS8jgAODLCzdrXfzI30eWjLu+owItgtHw93bT5tqrIfksc7JiAZts9HJQKO55y+E3Cqv6eblvwCtTXkpwKeHMU3+l/errw+CNIYK6AKFk+pGP17Cq/Etf3vcup09gqfzEA6tQ9FWD6jQe6oKMvPPD+qbj90W1gNQALJ4YU3wHI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775022741; c=relaxed/simple; bh=PXM+BLwlZ8CCfZa0qDaNhAQlRAUx8C2oC9SfyX2/JQY=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=sMhpbohXqTjnZYaKW0DQqWdw0CglL7Vy54wESpzVBrQ0etNoJeMExx87lFXytmDRbwC08CsuKN5P5Inq3F9jfyp4rUKanDTcJ5/F6HGbgJgoFG/23ra0Cb/F/+cr66w2aX08XhcmSkzVO4uFGF3TG2BxLknSanHSevO/wowaVLc= 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=dkpR6jOG; arc=none smtp.client-ip=74.125.82.202 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="dkpR6jOG" Received: by mail-dy1-f202.google.com with SMTP id 5a478bee46e88-2c0f6593ef5so8397925eec.1 for ; Tue, 31 Mar 2026 22:52:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1775022738; x=1775627538; 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=NyjU7aHUz6ttRQBqlC/pmKlD/QIAVmXTvilBeudkytQ=; b=dkpR6jOG1HQMOUHH0YoDzheoe4LtRx0F6q4zBzhqEBi6AG0aQgOvLavuyNGkFtCUP+ wlL+J36/kn5wqcrhNoifKOw0HxoulWrmw3uTOnnz8mk0D3ScJzVvPg1hV3DQEFMUTK8M XnkX+hdJXXx3a+AOFEvCDWLUJQdKb99qLSeyXjTiFHRntH/JuL0bAw6NOMgvqRrpPcd4 K9G1anjpwea99JAzPuUWoyfVCvLV2yABie9orZm4ZkoJgjBk+Li+k4+6+t9LLGEq9HGF jlDzjjrq7hf2NvmOGqUnDZffeBANZmvXn4phE28CI0h8Y8RWfYWZBk1nYPeRci8fPGOS WE+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775022738; x=1775627538; 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=NyjU7aHUz6ttRQBqlC/pmKlD/QIAVmXTvilBeudkytQ=; b=hZGNXWHVN3dEc9cTHYCaHt2CHi1OL7fvf9XesExJsZMOxpyYffea/LUrdRKKX60Ozn DtYJV6sMhzHsZ6paehVN8VTsZDZwx0x1zC+nzUuCYMCdWzih6hvlpbMo27cMU2PxcWg/ yV8AwqUEyhUDVBbCXVMwzYmxKUnylW9+0ocqaDE8F0vTQtde+MNetksG7NwzVP8yWMSi QFRH6SGdDfj4F8543KsZmict38QlrXdbUrYo8kWA+plp2ihFHnjw87bIFvvSBwbVfE9/ oj/qyaRif4EwTQOH2f3A19K5ZZpZZAPzGv0g4sqidBc1NFc8ZApFfFFFGAKkaOL2mZVY Lo5w== X-Forwarded-Encrypted: i=1; AJvYcCXRng1qcXijKSa4cCIBe6krx1HKeDgT9ls68xcNW+0Q7Do05MwIvvnIGdF/+b8KrD0fZykPpJ7pVJ+XEr4=@vger.kernel.org X-Gm-Message-State: AOJu0YyB3rMlQSaorZPfRBj4TlWJ/MVFeR+1r4muR7D60+/LTgurDnek w+fOKPIGxNeIt9sYE5/8pqMPJth6GXiUx9lKlivQuQhCdyg5+7K4WNtYw1e7QigES/toc6TC1Zh M4bG11Ib6HQ== X-Received: from dyfv12.prod.google.com ([2002:a05:7300:824c:b0:2c9:d825:6f2a]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:693c:3013:b0:2c4:ec89:be4 with SMTP id 5a478bee46e88-2c9333adfc9mr1282518eec.33.1775022737447; Tue, 31 Mar 2026 22:52:17 -0700 (PDT) Date: Tue, 31 Mar 2026 22:52:03 -0700 In-Reply-To: <20260401055206.43187-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: <20260228065953.3226283-1-irogers@google.com> <20260401055206.43187-1-irogers@google.com> X-Mailer: git-send-email 2.53.0.1118.gaef5881109-goog Message-ID: <20260401055206.43187-5-irogers@google.com> Subject: [PATCH v3 4/7] perf header: Refactor pipe mode end marker handling From: Ian Rogers To: acme@kernel.org, namhyung@kernel.org Cc: irogers@google.com, adrian.hunter@intel.com, alexander.shishkin@linux.intel.com, ashelat@redhat.com, ctshao@google.com, derek.foreman@collabora.com, howardchu95@gmail.com, hrishikesh123s@gmail.com, james.clark@linaro.org, jolsa@kernel.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, mingo@redhat.com, peterz@infradead.org, swapnil.sapkal@amd.com, thomas.falcon@intel.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" In non-pipe/data mode the header has a 256-bit bitmap representing whether a feature is enabled or not. In pipe mode features are written out in perf_event__synthesize_features as PERF_RECORD_HEADER_FEATURE events with a special zero sized marker for the last feature. If a new feature is added the last feature marker event appears as that feature from old pipe mode perf data. As the event is zero sized it will fail to be processed and generally terminate perf. Add a last_feat variable to the header that in non-pipe/data mode is just HEADER_LAST_FEATURE. In pipe mode compute the last_feat by handling zero sized feature events, assuming they are the marker and updating last_feat accordingly. Potentially a feature event could be zero sized and so still process the feature event, just ignore the error if it fails. As perf_event__process_feature can properly handle pipe mode data, migrate users to it except for report that still wants to group events and stop header printing with the last feature marker. Make perf_event__process_feature non-fatal in the case of a newer feature than this version of perf's HEADER_LAST_FEATURE, which was the behavior all users wanted. Signed-off-by: Ian Rogers --- tools/perf/builtin-annotate.c | 11 +----- tools/perf/builtin-report.c | 27 ++++++------- tools/perf/builtin-script.c | 11 +----- tools/perf/util/data-convert-bt.c | 9 ++--- tools/perf/util/data-convert-json.c | 12 +----- tools/perf/util/header.c | 59 ++++++++++++++++++++++------- tools/perf/util/header.h | 4 +- tools/perf/util/intel-tpebs.c | 11 +----- 8 files changed, 67 insertions(+), 77 deletions(-) diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index 686ad08561d6..530348b6981b 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c @@ -313,15 +313,6 @@ static int process_sample_event(const struct perf_tool= *tool, return ret; } =20 -static int process_feature_event(const struct perf_tool *tool __maybe_unus= ed, - struct perf_session *session, - union perf_event *event) -{ - if (event->feat.feat_id < HEADER_LAST_FEATURE) - return perf_event__process_feature(session, event); - return 0; -} - static int hist_entry__stdio_annotate(struct hist_entry *he, struct evsel *evsel, struct perf_annotate *ann) @@ -875,7 +866,7 @@ int cmd_annotate(int argc, const char **argv) annotate.tool.id_index =3D perf_event__process_id_index; annotate.tool.auxtrace_info =3D perf_event__process_auxtrace_info; annotate.tool.auxtrace =3D perf_event__process_auxtrace; - annotate.tool.feature =3D process_feature_event; + annotate.tool.feature =3D perf_event__process_feature; annotate.tool.ordering_requires_timestamps =3D true; =20 annotate.session =3D perf_session__new(&data, &annotate.tool); diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 343c0ada5ea1..fd4741be8132 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c @@ -245,25 +245,20 @@ static int process_feature_event(const struct perf_to= ol *tool, union perf_event *event) { struct report *rep =3D container_of(tool, struct report, tool); + int ret =3D perf_event__process_feature(tool, session, event); =20 - if (event->feat.feat_id < HEADER_LAST_FEATURE) - return perf_event__process_feature(session, event); + if (ret =3D=3D 0 && event->header.size =3D=3D sizeof(struct perf_record_h= eader_feature) && + (int)event->feat.feat_id =3D=3D session->header.last_feat) { + /* + * (feat_id =3D HEADER_LAST_FEATURE) is the end marker which means + * all features are received. + */ + if (rep->header_only) + session_done =3D 1; =20 - if (event->feat.feat_id !=3D HEADER_LAST_FEATURE) { - pr_err("failed: wrong feature ID: %" PRI_lu64 "\n", - event->feat.feat_id); - return -1; - } else if (rep->header_only) { - session_done =3D 1; + setup_forced_leader(rep, session->evlist); } - - /* - * (feat_id =3D HEADER_LAST_FEATURE) is the end marker which - * means all features are received, now we can force the - * group if needed. - */ - setup_forced_leader(rep, session->evlist); - return 0; + return ret; } =20 static int process_sample_event(const struct perf_tool *tool, diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index b80c406d1fc1..4f95448c237a 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c @@ -3943,15 +3943,6 @@ int process_cpu_map_event(const struct perf_tool *to= ol, return set_maps(script); } =20 -static int process_feature_event(const struct perf_tool *tool __maybe_unus= ed, - struct perf_session *session, - union perf_event *event) -{ - if (event->feat.feat_id < HEADER_LAST_FEATURE) - return perf_event__process_feature(session, event); - return 0; -} - static int perf_script__process_auxtrace_info(const struct perf_tool *tool, struct perf_session *session, union perf_event *event) @@ -4426,7 +4417,7 @@ int cmd_script(int argc, const char **argv) #ifdef HAVE_LIBTRACEEVENT script.tool.tracing_data =3D perf_event__process_tracing_data; #endif - script.tool.feature =3D process_feature_event; + script.tool.feature =3D perf_event__process_feature; script.tool.build_id =3D perf_event__process_build_id; script.tool.id_index =3D perf_event__process_id_index; script.tool.auxtrace_info =3D perf_script__process_auxtrace_info; diff --git a/tools/perf/util/data-convert-bt.c b/tools/perf/util/data-conve= rt-bt.c index ba1c8e48d495..665bf8eea24b 100644 --- a/tools/perf/util/data-convert-bt.c +++ b/tools/perf/util/data-convert-bt.c @@ -1412,13 +1412,10 @@ static int process_feature_event(const struct perf_= tool *tool, struct convert *c =3D container_of(tool, struct convert, tool); struct ctf_writer *cw =3D &c->writer; struct perf_record_header_feature *fe =3D &event->feat; + int ret =3D perf_event__process_feature(tool, session, event); =20 - if (event->feat.feat_id < HEADER_LAST_FEATURE) { - int ret =3D perf_event__process_feature(session, event); - - if (ret) - return ret; - } + if (ret) + return ret; =20 switch (fe->feat_id) { case HEADER_HOSTNAME: diff --git a/tools/perf/util/data-convert-json.c b/tools/perf/util/data-con= vert-json.c index 6a626322476a..4b1b2f7bed25 100644 --- a/tools/perf/util/data-convert-json.c +++ b/tools/perf/util/data-convert-json.c @@ -326,16 +326,6 @@ static void output_headers(struct perf_session *sessio= n, struct convert_json *c) output_json_format(out, false, 2, "]"); } =20 -static int process_feature_event(const struct perf_tool *tool __maybe_unus= ed, - struct perf_session *session, - union perf_event *event) -{ - if (event->feat.feat_id < HEADER_LAST_FEATURE) - return perf_event__process_feature(session, event); - - return 0; -} - int bt_convert__perf2json(const char *input_name, const char *output_name, struct perf_data_convert_opts *opts __maybe_unused) { @@ -375,7 +365,7 @@ int bt_convert__perf2json(const char *input_name, const= char *output_name, c.tool.auxtrace =3D perf_event__process_auxtrace; c.tool.event_update =3D perf_event__process_event_update; c.tool.attr =3D perf_event__process_attr; - c.tool.feature =3D process_feature_event; + c.tool.feature =3D perf_event__process_feature; c.tool.ordering_requires_timestamps =3D true; =20 if (opts->all) { diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index fe5d21dde04f..af4b6e3e4e1f 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c @@ -3785,11 +3785,11 @@ static int perf_file_section__fprintf_info(struct p= erf_file_section *section, struct feat_fd ff; =20 if (lseek(fd, section->offset, SEEK_SET) =3D=3D (off_t)-1) { - pr_debug("Failed to lseek to %" PRIu64 " offset for feature " - "%d, continuing...\n", section->offset, feat); + pr_debug("Failed to lseek to %" PRIu64 " offset for feature %s (%d), con= tinuing...\n", + section->offset, header_feat__name(feat), feat); return 0; } - if (feat >=3D HEADER_LAST_FEATURE) { + if (feat >=3D ph->last_feat) { pr_warning("unknown feature %d\n", feat); return 0; } @@ -3841,7 +3841,7 @@ int perf_header__fprintf_info(struct perf_session *se= ssion, FILE *fp, bool full) return 0; =20 fprintf(fp, "# missing features: "); - for_each_clear_bit(bit, header->adds_features, HEADER_LAST_FEATURE) { + for_each_clear_bit(bit, header->adds_features, header->last_feat) { if (bit) fprintf(fp, "%s ", feat_ops[bit].name); } @@ -4171,7 +4171,7 @@ int perf_header__process_sections(struct perf_header = *header, int fd, if (err < 0) goto out_free; =20 - for_each_set_bit(feat, header->adds_features, HEADER_LAST_FEATURE) { + for_each_set_bit(feat, header->adds_features, header->last_feat) { err =3D process(sec++, header, feat, fd, data); if (err < 0) goto out_free; @@ -4386,6 +4386,7 @@ int perf_file_header__read(struct perf_file_header *h= eader, ph->data_offset =3D header->data.offset; ph->data_size =3D header->data.size; ph->feat_offset =3D header->data.offset + header->data.size; + ph->last_feat =3D HEADER_LAST_FEATURE; return 0; } =20 @@ -4401,8 +4402,8 @@ static int perf_file_section__process(struct perf_fil= e_section *section, }; =20 if (lseek(fd, section->offset, SEEK_SET) =3D=3D (off_t)-1) { - pr_debug("Failed to lseek to %" PRIu64 " offset for feature " - "%d, continuing...\n", section->offset, feat); + pr_debug("Failed to lseek to %" PRIu64 " offset for feature %s (%d), con= tinuing...\n", + section->offset, header_feat__name(feat), feat); return 0; } =20 @@ -4435,6 +4436,8 @@ static int perf_file_header__read_pipe(struct perf_pi= pe_file_header *header, if (ph->needs_swap) header->size =3D bswap_64(header->size); =20 + /* The last feature is written out as a 0 sized event and will update thi= s value. */ + ph->last_feat =3D 0; return 0; } =20 @@ -4667,31 +4670,61 @@ int perf_session__read_header(struct perf_session *= session) return -ENOMEM; } =20 -int perf_event__process_feature(struct perf_session *session, +int perf_event__process_feature(const struct perf_tool *tool __maybe_unuse= d, + struct perf_session *session, union perf_event *event) { struct feat_fd ff =3D { .fd =3D 0 }; struct perf_record_header_feature *fe =3D (struct perf_record_header_feat= ure *)event; + struct perf_header *header =3D &session->header; int type =3D fe->header.type; - u64 feat =3D fe->feat_id; + int feat =3D (int)fe->feat_id; int ret =3D 0; bool print =3D dump_trace; + bool last_feature_mark =3D false; =20 if (type < 0 || type >=3D PERF_RECORD_HEADER_MAX) { pr_warning("invalid record type %d in pipe-mode\n", type); return 0; } - if (feat =3D=3D HEADER_RESERVED || feat >=3D HEADER_LAST_FEATURE) { - pr_warning("invalid record type %d in pipe-mode\n", type); + if (feat =3D=3D HEADER_RESERVED) { + pr_warning("invalid reserved record type in pipe-mode\n"); return -1; } + if (feat >=3D header->last_feat) { + if (event->header.size =3D=3D sizeof(*fe)) { + /* + * Either an unexpected zero size feature or the + * HEADER_LAST_FEATURE mark. + */ + if (feat > header->last_feat) + header->last_feat =3D min(feat, HEADER_LAST_FEATURE); + last_feature_mark =3D true; + } else { + /* + * A feature but beyond what is known as in + * bounds. Assume the last feature is 1 beyond this + * feature. + */ + session->header.last_feat =3D min(feat + 1, HEADER_LAST_FEATURE); + } + } + if (feat >=3D HEADER_LAST_FEATURE) { + if (!last_feature_mark) { + pr_warning("unknown feature %d for data file version (%s) in this versi= on of perf (%s)\n", + feat, header->env.version, perf_version_string); + } + return 0; + } =20 ff.buf =3D (void *)fe->data; ff.size =3D event->header.size - sizeof(*fe); - ff.ph =3D &session->header; + ff.ph =3D header; =20 if (feat_ops[feat].process && feat_ops[feat].process(&ff, NULL)) { - ret =3D -1; + // Processing failed, ignore when this is the last feature mark. + if (!last_feature_mark) + ret =3D -1; goto out; } =20 diff --git a/tools/perf/util/header.h b/tools/perf/util/header.h index ca22030a1434..41ce663d93ff 100644 --- a/tools/perf/util/header.h +++ b/tools/perf/util/header.h @@ -109,6 +109,7 @@ struct perf_header { u64 data_size; u64 feat_offset; DECLARE_BITMAP(adds_features, HEADER_FEAT_BITS); + int last_feat; struct perf_env env; }; =20 @@ -172,7 +173,8 @@ int perf_header__process_sections(struct perf_header *h= eader, int fd, =20 int perf_header__fprintf_info(struct perf_session *s, FILE *fp, bool full); =20 -int perf_event__process_feature(struct perf_session *session, +int perf_event__process_feature(const struct perf_tool *tool, + struct perf_session *session, union perf_event *event); int perf_event__process_attr(const struct perf_tool *tool, union perf_even= t *event, struct evlist **pevlist); diff --git a/tools/perf/util/intel-tpebs.c b/tools/perf/util/intel-tpebs.c index 2af5455488b2..8b615dc94e9e 100644 --- a/tools/perf/util/intel-tpebs.c +++ b/tools/perf/util/intel-tpebs.c @@ -216,15 +216,6 @@ static int process_sample_event(const struct perf_tool= *tool __maybe_unused, return 0; } =20 -static int process_feature_event(const struct perf_tool *tool __maybe_unus= ed, - struct perf_session *session, - union perf_event *event) -{ - if (event->feat.feat_id < HEADER_LAST_FEATURE) - return perf_event__process_feature(session, event); - return 0; -} - static void *__sample_reader(void *arg __maybe_unused) { struct perf_session *session; @@ -237,7 +228,7 @@ static void *__sample_reader(void *arg __maybe_unused) =20 perf_tool__init(&tool, /*ordered_events=3D*/false); tool.sample =3D process_sample_event; - tool.feature =3D process_feature_event; + tool.feature =3D perf_event__process_feature; tool.attr =3D perf_event__process_attr; =20 session =3D perf_session__new(&data, &tool); --=20 2.53.0.1118.gaef5881109-goog From nobody Wed Apr 1 22:34:21 2026 Received: from mail-dy1-f201.google.com (mail-dy1-f201.google.com [74.125.82.201]) (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 72EB632C92D for ; Wed, 1 Apr 2026 05:52:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775022742; cv=none; b=awxS2WrkpQNOaWyErlq1GorZxey1PVCfd4mUq1BdyinVuzOe/8Lt2aQDYoyWrRjVCIirBfaZH5/ubm/ua1YLuz6xWMLCp0FB4UzIMyO6zOwHzOT05zR3k9rSx8kS8OxBIQY5lK7Kk9mdl3ZT7CgJZSF9uyZQit39ne1sbBGsMzA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775022742; c=relaxed/simple; bh=YXtKPFZbWWZBopwp0wtvWhgawI8Cv5FypUVRsO7wl+U=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=C565o6TKmDuHpa2XjDjAqk5uOmXoXjo7mkzVPEAOhXAYzyL0+JF78qloy7q3/B/3rbjIs/a7kYGI+broFp1pNcuN0sJRNz+v/H6/i6SqIu0D5GFGSoUp7Hk7seAKAa+K45mj7g8ZQkl/bc19/A1o4A81mfwz0nYVUQSoCKVf3OA= 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=azhWjiRj; arc=none smtp.client-ip=74.125.82.201 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="azhWjiRj" Received: by mail-dy1-f201.google.com with SMTP id 5a478bee46e88-2c4cfe08c9dso15528489eec.1 for ; Tue, 31 Mar 2026 22:52:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1775022740; x=1775627540; 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=mXhmCfoDGbEzRy0vkOhlRcCB2RW/wzuPXoAXA+lWSZE=; b=azhWjiRjmMxSccVizr1Yw8vvLrtsyG8oSTEmryhfzLVcfMCwcdX/O53Z4l2F2YU0T2 SDzymC63U5hqReW61+MQCB5oFxLaJ1gUTOZzC3q9+kflKygcCK4s0nguoD40ns1CpQ9Q bsHHF1LMqoHQBiC8hzGy2LPYOV2v9Aa3CyRYuKe1p3sve1VuGNj5N1rmXlxgE694o5Gm po0f52nRIPFhM8b+0+X7IvYQ3j2Flzm9mvIVfWWX9ngFNBv0hjp/i+NXb1bpFNpEyK1U hbMp3IBwct8Ol3WnjT8QAsbVkW3NPbVLbpHhLHcBXj1e3Gr35htjycEk/IezlUC3D8tz RA6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775022740; x=1775627540; 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=mXhmCfoDGbEzRy0vkOhlRcCB2RW/wzuPXoAXA+lWSZE=; b=Hww9McPUGay8jQUGzhv0UbSXlm8GTNzsA9u6d8kkLB8uVuaYa8XJ/vnGTu1FrNq5V9 Uus8PrIo2kXZjezH6AXRCLQjU0kLbvgLYh+HZzCUlvAnuVEjcceJU/mj+do5VFD2a/07 3YN3CyiXDxR0rCGEhXb4suhPhTfbzAm5QHrjcQP/is/1VUmwbdhOZYEPeNxGuTMr0jhk ACys6t5DUe1BMgHJXnPfn0FydkfDR0FMTGrwjcGxczubMui+vi3cVt0iKI0tvNfmM97z DxSp6IS+c/X1m7J3ZW8MEATA0xlWAjqUc56WhEuSFSvdtazbja0ywX79AtwmZ4rQZUlm J7Fg== X-Forwarded-Encrypted: i=1; AJvYcCUZA++0lQG/tlKXAtYCs5SPWmW9Hop3zvV+zfe8WLwi9XLjQeJlG8J8lUL/bj4uY8OqzXEY4M/PEckwL2U=@vger.kernel.org X-Gm-Message-State: AOJu0YxOwT8rnOuP+JzvpCho326pRwXAYgNrimmCj9zx0mv0icRQ4RdB 6BdPAiQiqfVQWlnxqu4gvm3JrCgVhE89A1P/vfuah5j9U2a9D+wLrdHp3xPdmCYghu2YJaFg5Rz sJrI8rqUOgA== X-Received: from dybnl19.prod.google.com ([2002:a05:7300:cf93:b0:2c8:8349:e96a]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7300:2213:b0:2c7:2cac:815b with SMTP id 5a478bee46e88-2c930986704mr1304509eec.6.1775022739450; Tue, 31 Mar 2026 22:52:19 -0700 (PDT) Date: Tue, 31 Mar 2026 22:52:04 -0700 In-Reply-To: <20260401055206.43187-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: <20260228065953.3226283-1-irogers@google.com> <20260401055206.43187-1-irogers@google.com> X-Mailer: git-send-email 2.53.0.1118.gaef5881109-goog Message-ID: <20260401055206.43187-6-irogers@google.com> Subject: [PATCH v3 5/7] perf ordered-events: Event processing consistency with the regular reader From: Ian Rogers To: acme@kernel.org, namhyung@kernel.org Cc: irogers@google.com, adrian.hunter@intel.com, alexander.shishkin@linux.intel.com, ashelat@redhat.com, ctshao@google.com, derek.foreman@collabora.com, howardchu95@gmail.com, hrishikesh123s@gmail.com, james.clark@linaro.org, jolsa@kernel.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, mingo@redhat.com, peterz@infradead.org, swapnil.sapkal@amd.com, thomas.falcon@intel.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Some event processing functions like perf_event__process_tracing_data return a zero or positive value on success. Ordered event processing handles any non-zero value as an error, which is inconsistent with reader__process_events and reader__read_event that only treat negative values as errors. Make the ordered events error handling consistent with that of the events reader. Signed-off-by: Ian Rogers --- tools/perf/util/ordered-events.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/ordered-events.c b/tools/perf/util/ordered-eve= nts.c index 8c62611f10aa..a5857f9f5af2 100644 --- a/tools/perf/util/ordered-events.c +++ b/tools/perf/util/ordered-events.c @@ -243,7 +243,7 @@ static int do_flush(struct ordered_events *oe, bool sho= w_progress) if (iter->timestamp > limit) break; ret =3D oe->deliver(oe, iter); - if (ret) + if (ret < 0) return ret; =20 ordered_events__delete(oe, iter); --=20 2.53.0.1118.gaef5881109-goog From nobody Wed Apr 1 22:34:21 2026 Received: from mail-dy1-f201.google.com (mail-dy1-f201.google.com [74.125.82.201]) (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 6E45A3290B8 for ; Wed, 1 Apr 2026 05:52:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775022743; cv=none; b=nestpKPcYD6itz3znwn3ncuUpXydBd5IszMzqq47x/TwkuUSSLBYNhDozdf+m/wJSxXCb+8jxw4DIQjFNuk60xUOKHeMgl4gEE2MZi9Uu8/eHCyGtdN2frJfpdXR1yBFwh9ku5xA2DCdeOCe5F6UlrjK191TYopEGXEVTsFs3xg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775022743; c=relaxed/simple; bh=2QgdWtOwiicHTrOVF/Jcws17gyi+KjBBFGJMxarXEYs=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=ub+kxvQn/RbrNhLpuk+OqMXKyC3NU6O6lB5v2OV6DzxsLxMww2pM7+WPWJ4jw248nAiu2MfOGEUw4hhcT6cFY/UTukoNUAYyb3c8JFRyNeYlHa/pRQ2THhCQuUDFwN/HZxj54pXuS91JG8Gx71fAgdOfZMrhI8FoYiD5GF8VwQM= 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=S+jPUska; arc=none smtp.client-ip=74.125.82.201 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="S+jPUska" Received: by mail-dy1-f201.google.com with SMTP id 5a478bee46e88-2c8ac8e422dso1943787eec.0 for ; Tue, 31 Mar 2026 22:52:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1775022742; x=1775627542; 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=jRxz8qX/L98abrO4JrOFfQ6S3vBDaDKNSQSE+uWfj4I=; b=S+jPUskawk9zhpxlYTCAXwWxaFXade1EB5UsZszLS5spif0l+vJ+0bu28dzMp9/9b0 WopXN2uMTOaiOnKPz7tw4VfjDhJ36Fsewf8FDQk/mVb97VZ0hnYRKPJPq1fQMpsBkR7S rgGc8PXobsOtOg4DBk/wLqYDA4vhC8p2sGsJgxNFQQ+1fujYvJiRAzu4gMLpcQxOU9m7 Z2doHGzs6zCBgpGgU5A8i+kWzY4brzNt9XpfvQ5Dl/gpYJJhp/wY3P4aBLh6YMUUKCwR gYfXmrCkujg6dAlAvCrTf4UoZ9lPd7Cwn8lkNCYCIKP9WVfViO+HLHFNiDvXRjnaAmX6 AEZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775022742; x=1775627542; 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=jRxz8qX/L98abrO4JrOFfQ6S3vBDaDKNSQSE+uWfj4I=; b=W23aFsN8wNQUcaHurAq5C6ag6BUYVnlT4tJr7zYmbo4+RXj151dKKBp1zwMfWxKZe2 5qDJVfqr5subEUFLXTXGg76FHif53EbsWLvFVn1trPaN5F2TcoDKIcj8aNGi6aiOMWMh GhINRe58dPBXSj2EvnkNgsPys1+w6ELs0Bm20bUY14bG+AS6UfqYNn5CE+wxmqffSVZQ 2PUPryn89KQQG1cO6v7Abe7eUl3baAzVA+UL5umRw2cNvgW04BZR4vGN4DGlhLp+7ocd 2aiS6n52ubgRijj+LmKibCzcYp3T1QJPWtJvN7u5mi0MmvyaWvzmVn5uxKJuABhXFPWQ kzyw== X-Forwarded-Encrypted: i=1; AJvYcCVYsV8pZ+YO6j2+N7ZEMxDaIziHzAyXL/P/XGMZ0VyK2PbKwIGuoa4ySxRvGybHvMc1hI4MzroU+i/Pin0=@vger.kernel.org X-Gm-Message-State: AOJu0YxlBw+Wy3uyAIPvfvlbIriofale3dH7NbNPGQTpOxGcDDQ2i4Mq JN2Ubx4p3uZ1RgS9hAaJArJ/98HeC3WH9Czu+Z8A5wl2IBZxiR2ueMZro+wjiqkqJiWLVNktpOL 1Sjre1slgYQ== X-Received: from dybqo8.prod.google.com ([2002:a05:7301:6788:b0:2c5:2b09:16ef]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7301:6087:b0:2c1:74ad:2cd7 with SMTP id 5a478bee46e88-2c932eba0damr1197650eec.27.1775022741334; Tue, 31 Mar 2026 22:52:21 -0700 (PDT) Date: Tue, 31 Mar 2026 22:52:05 -0700 In-Reply-To: <20260401055206.43187-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: <20260228065953.3226283-1-irogers@google.com> <20260401055206.43187-1-irogers@google.com> X-Mailer: git-send-email 2.53.0.1118.gaef5881109-goog Message-ID: <20260401055206.43187-7-irogers@google.com> Subject: [PATCH v3 6/7] perf evsel: Make unknown event names more unique From: Ian Rogers To: acme@kernel.org, namhyung@kernel.org Cc: irogers@google.com, adrian.hunter@intel.com, alexander.shishkin@linux.intel.com, ashelat@redhat.com, ctshao@google.com, derek.foreman@collabora.com, howardchu95@gmail.com, hrishikesh123s@gmail.com, james.clark@linaro.org, jolsa@kernel.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, mingo@redhat.com, peterz@infradead.org, swapnil.sapkal@amd.com, thomas.falcon@intel.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" In situations like the perf data converter the evsel__name will be used to create babeltrace events. If the events have the same name then creation can fail. Avoid these failures by including more information into the unknown event names. Signed-off-by: Ian Rogers --- tools/perf/util/evsel.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 5a294595a677..51c871e7fbac 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -926,7 +926,8 @@ const char *evsel__name(struct evsel *evsel) break; =20 case PERF_TYPE_TRACEPOINT: - scnprintf(bf, sizeof(bf), "%s", "unknown tracepoint"); + scnprintf(bf, sizeof(bf), "unknown tracepoint id=3D%#"PRId64, + evsel->core.attr.config); break; =20 case PERF_TYPE_BREAKPOINT: @@ -938,8 +939,8 @@ const char *evsel__name(struct evsel *evsel) break; =20 default: - scnprintf(bf, sizeof(bf), "unknown attr type: %d", - evsel->core.attr.type); + scnprintf(bf, sizeof(bf), "unknown event PMU=3D%d config=3D%#"PRIx64, + evsel->core.attr.type, evsel->core.attr.config); break; } =20 --=20 2.53.0.1118.gaef5881109-goog From nobody Wed Apr 1 22:34:21 2026 Received: from mail-dl1-f74.google.com (mail-dl1-f74.google.com [74.125.82.74]) (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 323F332C923 for ; Wed, 1 Apr 2026 05:52:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775022756; cv=none; b=dFwI8BkD0far3HrnETxt0CW6LD+xexMgfjHx2bnCUQskbqdusb2vBL9SYXoSM1DmfZ8gnVs32Rh8wYFl+/LrngH8aenbpbK1jtp6xWDpBIUzIn7Vu6dzsWu/eFhvzJ3ajrYQb+x1WtHhyYyq4lyI0BX3GCeYHt2+CbUB0CX7lTE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775022756; c=relaxed/simple; bh=o5xdluZsrMJ7DmiLpE5klINFe897EnRtMQxNqOa85TI=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=HGrDAbFN9UUFN2DTjNUp00laLrV5pb19UcrE0a5t82S4X6XW6OYvCvVFB7paK+ztVvU7daOHFtSY/LffUngxyHcMwaJhYBnpioDKXK75wVA14Cx7Mb544ODfMTSKJlgbyA2Ka5QoLCTWU2zEpBP3WAHKyKnlZBiwSPS6IzCVSjY= 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=c9d7g47e; arc=none smtp.client-ip=74.125.82.74 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="c9d7g47e" Received: by mail-dl1-f74.google.com with SMTP id a92af1059eb24-127133794b6so7576294c88.1 for ; Tue, 31 Mar 2026 22:52:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1775022743; x=1775627543; 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=aCiawvq0YbBPoCrfosUh1ZpIc6Ul2Vv8tg6tsPj9Kmg=; b=c9d7g47eNnIZ64cuHgA5wKD7ktn6Ap0xT8znVSzhDuqfKJHUGmYbf/sMWKKE0ae2Sg e5gVihIUSQ/RhqHBg99Bw1TZupPJrRlhArhnGlbzoGA9l9kOf39TqpgzOsMlycJkOsnh rAHD/OiuzKLjsoE+gYLLtRTaQpnVaqHQBaicszBPD2/DUaYHsvrrOsjIDABEBgjVB3D7 3klh+mBqCa3U6HA4D5oIRVySu8fwaaX2DxZh8kN9cSM0ee692EKWijPniGBR4Ecf68r9 meCFVAmB3r1iI/hM1LvrgFvZV4AcTlUIwfEffxY91X97xKDdE8wmAZbSF70nsVI9jMX+ IYSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775022743; x=1775627543; 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=aCiawvq0YbBPoCrfosUh1ZpIc6Ul2Vv8tg6tsPj9Kmg=; b=rAG6sUKseC8xHE/NyoBOsn97GIx9UlyT9VnbtDx7D7TkaeRVJDo+lt1W/Niioo0pvK UjSrmAYB0QaDrrCDBbZ2bjH7ejZRtffEHac9ZUYUX+8xZ12L/cGDrDfo9GHhbJLl8TBT JDQ78EzXIhxC820KdPK3JNro53wGx6cef2S9/GvZiDyF585bkn/sxwiNXJruQj0IHy8X w9Y3mpmJ5zjHYY1KcgeqmCfXC3tDlqf2pw6G3+SBBcXFCK1YUoGcQkvXBxZFCOayHeBU ncow09NLXNkmu3GMEn3Ht27yi7Zz9hZ4A11zreeHrCEaTw1c3VcdwY5oPmCza0AGRcTA +Eug== X-Forwarded-Encrypted: i=1; AJvYcCXfieYqU3C0PVcpAfGGWsM3f9c4/MxIDcoS17LCCbi0IBwOIqLHJaUv+PX3eyPDFyTRyrblafQtTi/Nyyo=@vger.kernel.org X-Gm-Message-State: AOJu0Ywu17f2V5NH03eNoTgJ3bUZvcMcl08oQjT/jmYjVdVoRtgfxUzP Mv9a6oDPkNsf27WQOOqpWvVRdQpzt6CDEawssp/XmgUuDvua2kEbsji/qh3wPmrwSzSH5afs21j AjueulVOm9Q== X-Received: from dlnn3.prod.google.com ([2002:a05:7022:6183:b0:12a:b9fd:1f69]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:ea30:b0:128:ea68:27f1 with SMTP id a92af1059eb24-12be6512241mr1299806c88.23.1775022743276; Tue, 31 Mar 2026 22:52:23 -0700 (PDT) Date: Tue, 31 Mar 2026 22:52:06 -0700 In-Reply-To: <20260401055206.43187-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: <20260228065953.3226283-1-irogers@google.com> <20260401055206.43187-1-irogers@google.com> X-Mailer: git-send-email 2.53.0.1118.gaef5881109-goog Message-ID: <20260401055206.43187-8-irogers@google.com> Subject: [PATCH v3 7/7] perf data convert ctf: Pipe mode improvements From: Ian Rogers To: acme@kernel.org, namhyung@kernel.org Cc: irogers@google.com, adrian.hunter@intel.com, alexander.shishkin@linux.intel.com, ashelat@redhat.com, ctshao@google.com, derek.foreman@collabora.com, howardchu95@gmail.com, hrishikesh123s@gmail.com, james.clark@linaro.org, jolsa@kernel.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, mingo@redhat.com, peterz@infradead.org, swapnil.sapkal@amd.com, thomas.falcon@intel.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Handle the finished_round event. Set up the CTF events when the feature event desc is read. In pipe mode the attr events will create the evsels and the feature event desc events will name the evsels. The CTF events need the evsel name, so wait until feature event descs are read (in pipe mode) before setting up the events except for tracepoint events. Handle the tracing_data event so that tracepoint information is available when setting up tracepoint events. Signed-off-by: Ian Rogers --- tools/perf/util/data-convert-bt.c | 59 ++++++++++++++++++++++++++++--- 1 file changed, 55 insertions(+), 4 deletions(-) diff --git a/tools/perf/util/data-convert-bt.c b/tools/perf/util/data-conve= rt-bt.c index 665bf8eea24b..892e24acc44d 100644 --- a/tools/perf/util/data-convert-bt.c +++ b/tools/perf/util/data-convert-bt.c @@ -1223,13 +1223,28 @@ static int add_event(struct ctf_writer *cw, struct = evsel *evsel) return -1; } =20 -static int setup_events(struct ctf_writer *cw, struct perf_session *sessio= n) +enum setup_events_type { + SETUP_EVENTS_ALL, + SETUP_EVENTS_NOT_TRACEPOINT, + SETUP_EVENTS_TRACEPOINT_ONLY, +}; + +static int setup_events(struct ctf_writer *cw, struct perf_session *sessio= n, + enum setup_events_type type) { struct evlist *evlist =3D session->evlist; struct evsel *evsel; int ret; =20 evlist__for_each_entry(evlist, evsel) { + bool is_tracepoint =3D evsel->core.attr.type =3D=3D PERF_TYPE_TRACEPOINT; + + if (is_tracepoint && type =3D=3D SETUP_EVENTS_NOT_TRACEPOINT) + continue; + + if (!is_tracepoint && type =3D=3D SETUP_EVENTS_TRACEPOINT_ONLY) + continue; + ret =3D add_event(cw, evsel); if (ret) return ret; @@ -1418,6 +1433,18 @@ static int process_feature_event(const struct perf_t= ool *tool, return ret; =20 switch (fe->feat_id) { + case HEADER_EVENT_DESC: + /* + * In non-pipe mode (not here) the evsels combine the desc with + * the perf_event_attr when it is parsed. In pipe mode the + * perf_event_attr events appear first and then the event desc + * feature events that set the names appear after. Once we have + * the full evsel data we can generate the babeltrace + * events. For tracepoint events we still don't have the tracing + * data and so need to wait until the tracing data event to add + * those events to babeltrace. + */ + return setup_events(cw, session, SETUP_EVENTS_NOT_TRACEPOINT); case HEADER_HOSTNAME: if (session->header.env.hostname) { return bt_ctf_writer_add_environment_field(cw->writer, "host", @@ -1448,6 +1475,26 @@ static int process_feature_event(const struct perf_t= ool *tool, return 0; } =20 +static int process_tracing_data(const struct perf_tool *tool, + struct perf_session *session, + union perf_event *event) +{ + struct convert *c =3D container_of(tool, struct convert, tool); + struct ctf_writer *cw =3D &c->writer; + int ret; + + ret =3D perf_event__process_tracing_data(tool, session, event); + if (ret < 0) + return ret; + + /* + * Now the attr was set up by the attr event, the name by the feature + * event desc event and the tracepoint data set up above, the tracepoint + * babeltrace events can be added. + */ + return setup_events(cw, session, SETUP_EVENTS_TRACEPOINT_ONLY); +} + static int ctf_writer__setup_clock(struct ctf_writer *cw, struct perf_session *session, bool tod) @@ -1677,9 +1724,10 @@ int bt_convert__perf2ctf(const char *input, const ch= ar *path, c.tool.exit =3D perf_event__process_exit; c.tool.fork =3D perf_event__process_fork; c.tool.lost =3D perf_event__process_lost; - c.tool.tracing_data =3D perf_event__process_tracing_data; + c.tool.tracing_data =3D process_tracing_data; c.tool.build_id =3D perf_event__process_build_id; c.tool.namespaces =3D perf_event__process_namespaces; + c.tool.finished_round =3D perf_event__process_finished_round; c.tool.attr =3D perf_event__process_attr; c.tool.feature =3D process_feature_event; c.tool.ordering_requires_timestamps =3D true; @@ -1724,8 +1772,11 @@ int bt_convert__perf2ctf(const char *input, const ch= ar *path, if (ctf_writer__setup_env(cw, session)) goto free_writer; =20 - /* CTF events setup */ - if (setup_events(cw, session)) + /* + * CTF events setup. Note, in pipe mode no events exist yet (they come + * in via events) and so this does nothing. + */ + if (setup_events(cw, session, SETUP_EVENTS_ALL)) goto free_writer; =20 if (opts->all && setup_non_sample_events(cw, session)) --=20 2.53.0.1118.gaef5881109-goog