From nobody Sat Apr 18 11:08:29 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 91C7533ADB1 for ; Sat, 28 Feb 2026 07:00:09 +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=1772262010; cv=none; b=rzRgHCMxBWNP9Gop17aHzaiiVt2QsteCeUSAanmFfrPC0tSoKfn7rF2OWcAIYdwA1OJgG8rTpWrbo16moztu3rVHsg4xdLRXo2YHuW2zNrZ+J2E9WSBJZO+bmvsjOhVAMlu/Bg2Q7lycSuda6cBB2o36KwBSrIOEnPH04OkEaC4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772262010; c=relaxed/simple; bh=AI+pLYY33VHhLKqPIpo/nh1kToqYssuz+yXMwLog5cc=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Content-Type; b=Pnxs1083VdVWCiJwlzlXukjtQmwRmmlPiV8u6Z1xVxymhMdopG5M5Epmjmwg5awT7vBGNmsBeLYFvKKaz274hCoD09/U/0/dX4+zAtZcMieROS93r3yWujJa8ZXKldzDO6e/mzxPU+XoX0EjzLmuTu1xAHV4GKX0z62pf5+8gHI= 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=HbIkH2xZ; 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="HbIkH2xZ" Received: by mail-dl1-f74.google.com with SMTP id a92af1059eb24-12776bebeb3so17149116c88.1 for ; Fri, 27 Feb 2026 23:00:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1772262009; x=1772866809; 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=JeIqAOB1U7ToKo6N6NlWrg8Op7bhAW0stIlENTqWOLY=; b=HbIkH2xZL1XYtRqzZyEOtrlsZFqjg6sOLxNUE0YuAS/k7b1XEsjhL3jQXUo/ESM+2c SF/yFrWNfhukmexEEz3AKzs9wJhX5A6+DS7rGjwRW+RYXlzh7fMsjivGZpORC0w55V9G EVZq3y04+TJg+aoNbDaux3/r2Oe9CmY4j0yp2HwBtFrY8ND/prshguqw2wo5Wp/f421E dqn5cnUr4gIseO+CHJWWHkvdplpiW5K7A4wwIKvFEuHy0Xb0xK1N2Hrlm8FcibxD+Cf4 Xzk+CgSLtTZdAbGGpaYFNO6fSSr4yRO9GcjXQ3I5r6pZ7krYw44tdMAOOdc3yT6sJQzq Ggkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772262009; x=1772866809; 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=JeIqAOB1U7ToKo6N6NlWrg8Op7bhAW0stIlENTqWOLY=; b=XNs6eNsT2gpMUmdf7IROYaPuxBgAoxjqluwSGZV2zgLIE2URo5UuVpdCZlMhdh30fI 5jAA7KCa5GxYSLzqgDY+Ct8VM9CCDA6DAjyYdW7LcKUYVuEPLLT4b5XlCSj4TezJr8ct ssqp8kbpqZOGjunZ0v/KJDNKLkWGOE3MBPDEPd6JuDfcPyQtYLhWzdnwNncoO+m9QLl/ Ah6SxsNEJlCy0YBugHGMsfhIojQnS1EIGme+vgcp6tXV+4JUQ5Su2bHv+R+n6LVnabcS d5mk0EBERWCmA+GP3ITC3uUbhEMww20VyFfp806LZD+uXNRN5B8iAeHuEyzKKOPId62m 3lEg== X-Forwarded-Encrypted: i=1; AJvYcCV5dG66YxkOXr3f6fEFGdkWIXnbUzA/YMk3ENcUel38IBgiS+DAtiWCUB6yYakMqVwdj9yP4hudjTlZUgA=@vger.kernel.org X-Gm-Message-State: AOJu0YxNaxBw86YXAKFm2PAw9VpUX2ZdzpeFGXMZWJM6KCLWFW37TlSj +3AKWl40dbpTN6t8tyV0de2emHDvXZDU9lQTDHn5k7EhBfBvV/+rLCFlcW4Na0tJP8EvLi098le 2UJNCJu/a9g== X-Received: from dlbbz39.prod.google.com ([2002:a05:7022:23a7:b0:127:c11:f47a]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:2485:b0:127:5cfd:785 with SMTP id a92af1059eb24-1278fc28856mr2523985c88.4.1772262008510; Fri, 27 Feb 2026 23:00:08 -0800 (PST) Date: Fri, 27 Feb 2026 22:59:47 -0800 In-Reply-To: <20260228065953.3226283-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> X-Mailer: git-send-email 2.53.0.473.g4a7958ca14-goog Message-ID: <20260228065953.3226283-2-irogers@google.com> Subject: [PATCH v2 1/7] perf clockid: Add missing include From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , Derek Foreman , Howard Chu , Thomas Falcon , Swapnil Sapkal , Anubhav Shelat , Chun-Tse Shao , Hrishikesh Suresh , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org 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.473.g4a7958ca14-goog From nobody Sat Apr 18 11:08:29 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 B0B0E346FBC for ; Sat, 28 Feb 2026 07:00:11 +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=1772262012; cv=none; b=cJ9CBLE9QRk2MO5xsieK+XxyLjoHBo2vC+vuYTQCdjG4QMMiHdUKwquQ/QoyrKzcYPqjuvHGhKFwh7mgQFVqD3Zitn12XPpAuDKrUre2OzNNV4FSEZSxj5H5P5peNzmLFBcu23Q6VFRlHCaXZd3tjNEHUmhLXUK6zRNm0up6xJU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772262012; c=relaxed/simple; bh=eU/gTxR9aSiFByEc70zxEk30SpfND7ax0/+8yquZ05U=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Content-Type; b=aX5pAgW3onlcqtfofvo4w4XyghcGFp9AJy+eABz4G2M3vkw7sE4HeS2vKB4f89jth+iG/WpijFOhEIqEOXXnxOeYkZfB1pxYHeFiRcHeAqw+HbqXFCHtDJZtIBw5czDbhG60gmkVQQG9K+FLl3TtWx/+8omZ9cexuDJ6iqcxQQ0= 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=hygOgsNh; 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="hygOgsNh" Received: by mail-dy1-f201.google.com with SMTP id 5a478bee46e88-2bddd304622so2146088eec.0 for ; Fri, 27 Feb 2026 23:00:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1772262011; x=1772866811; 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=TGBdrZFEQdY6Z2dr6uO7x199Kzk4HiW1yI8iaR5EMOw=; b=hygOgsNhY7F0c0HoB70vB+yeBLROR2ClJAh8/BSwoWEwJc+9liTweCtve7bvJd3jVw VGc7pHVlqYNf6jy7svC3YwL85FYYzdV7KX4KtzxahUljuEQVhM4uJbVgPkb/q5vFeLGl XF+55+/U4xWZOUJ7spyvncKHnDtxq9DsH3A7G0U6Es/Q52wUQWDdaQTWeC3KUyFLDeze 8366X2UwhDD6dtNWwLP9TeJVWlrdQAHezxmzrCD4SpbbZdubyRcoRI5Kw5vu3dkuzsZH o4tk4E5aWpoKE459ctoJlJb35S9BFTUkJBJ4EzXd3KP8z4LwT8THGAitiROVAo6+LJ88 cfwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772262011; x=1772866811; 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=TGBdrZFEQdY6Z2dr6uO7x199Kzk4HiW1yI8iaR5EMOw=; b=oaE0pgm26MJuI0+eqmfAP2Jr1fPsS6xz6hBJDX8qmF6J68NQ9LQMsY5FChIZZ5Omqv Gq93FIgW4jXcwpNRRbYWN5F3b5uDNZtXs8h2XEWOoP5kAxTh6HG/WrR4CsvOcYqhu1Ai I7jrXV/JV5A479nccti5DrbMU0bhdIYjXlfmJ5m8LzQ0JwTkkhoZGj+Z/PxRukyNfUmE Ec62EcUWWtNBLFpHQ8qTJMXZnufHtg7tBjllHD6KU1uvnJCxKMt/L5Ct717sq3aBHJE7 jo6xNgGtwWkRKaHbUbcHZ9nln2deQyRrCC6i6SQvdqArsXC7Yog2FxktsXcOnFGjXCvz OVLA== X-Forwarded-Encrypted: i=1; AJvYcCWIEG2f4Oaw6mhRL1h7dh7v7fNte/JR/tX0O51UMZ7Ro70k7LWHliXD5Oxnik+5wpOeyRmieiatp1Nd8Co=@vger.kernel.org X-Gm-Message-State: AOJu0YzVcGv366BNWeyji/j8RddTydzf/XJI4pYfp/1SxBGv7qb244pU 2/hR0g2TQs3X/a3ieqZu1JQ+6AGo2NiDlDciUx9b6aUuKHF6uhml7hkT0QfnNQyGgnVvELfji9B nzKoE7f+QLA== X-Received: from dybox14.prod.google.com ([2002:a05:7300:ec8e:b0:2ba:acf0:ab76]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7301:169a:b0:2ba:14a6:c96f with SMTP id 5a478bee46e88-2bde1e6622emr1984573eec.36.1772262010453; Fri, 27 Feb 2026 23:00:10 -0800 (PST) Date: Fri, 27 Feb 2026 22:59:48 -0800 In-Reply-To: <20260228065953.3226283-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> X-Mailer: git-send-email 2.53.0.473.g4a7958ca14-goog Message-ID: <20260228065953.3226283-3-irogers@google.com> Subject: [PATCH v2 2/7] perf header: Add utility to convert feature number to a string From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , Derek Foreman , Howard Chu , Thomas Falcon , Swapnil Sapkal , Anubhav Shelat , Chun-Tse Shao , Hrishikesh Suresh , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org 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.473.g4a7958ca14-goog From nobody Sat Apr 18 11:08:29 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 9B81A346E51 for ; Sat, 28 Feb 2026 07:00:13 +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=1772262016; cv=none; b=i28tlFAeVET9fIrNBaTflKJgT4XTj7B+VaCnQVE+OmrhCIZDpRkok/KYcOiuvbYLyDVTUJiloKmaWiFAb+hnezTJxkNzfpT7q05NhSelsQQJpjtHDna77K+kvPsFq0uqNz2Crkue/8U4WXeGSs0/8JUX+pPykWfAw3ambG+a34g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772262016; c=relaxed/simple; bh=7sIjHudW7FWHJUUA2b7c4SCeJtZgcleFZwQLO504uPM=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Content-Type; b=jTkb1LwBTHR8E1F7sfrmxtkv0h6afsZy1RHAv7T9xof4bKb0S9OYZhnkHjnJDMCytlvXBKBQV4x4fThx27a6E3JmN9zROG1zB4Tnh7JHDNYQ0KjGlDu7denIEoufTydDmbrBrSVwSANcpnLJMiPrzNsjOAAUag6YiTB3AH4XYrQ= 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=E1FhEh73; 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="E1FhEh73" Received: by mail-dy1-f201.google.com with SMTP id 5a478bee46e88-2ba8013a9e3so2700917eec.0 for ; Fri, 27 Feb 2026 23:00:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1772262013; x=1772866813; 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=Z/wg1/ueOUJ8UkhVCAoXWbqideDmQLzWl9fomGjlxiM=; b=E1FhEh73jKnvXiQCH6d4Z3nS3wvJ6mFtONt9VS1FF1LVuKOoeFyCmOXe+WiiteW9VN pNdBCOtf9y2AhpGMgViSryH3D/ATt2c8qhtPeU7pvE1xL70Juq4bK7oaSQGmAt9I8gWI x4qrb9HiOQ+cOYfpKSzcdfR/TmHRvIKj95kaFPiWXABMJeRMIk/biLFZTPn2qDQvdjeK 2oWi60r+9YBcxBJ4oW+nTKqHojtwXfAdFVapJZCG+HWC2mPqSqeppyy4TZ8L6RCR4TOY T5h6U8HtlQVU9R0Be/yLqcyfhFXinhK049iRKZjIvExPUsRP66qfuSq4acCpDklHhGAT goMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772262013; x=1772866813; 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=Z/wg1/ueOUJ8UkhVCAoXWbqideDmQLzWl9fomGjlxiM=; b=CicWTJ71C2Bz5BTrgbPh/mWR5d63Rzp9IMK8RvI1Wwryvqu+aFoJ9vKiI5YVF46HBP dq9dgtCHkwOWNsO0pmtgMa1XId7B+HOXAPR9Djxc6a0lDtu6lvRmTpZZEXH5QbhWPh3u xpn9Crp7eN1vo2hmNQEIPzHnwwsG7LFuBTaQEE5gC804vyyv0YHd4kldZ8Qa0ynLEXHH 7QEeYuneB1wPTzptNVViaWZ6jk0cupGeoXOHXWBPdcS0bLXytD9Yw4BxTsvXliY7uV2b KHezEdeVyrRyYmVaijQ1OS/IXbqt8/pA2317oGuDHazpFk2puAxmDjn/OCdWBx3Frujb XXqg== X-Forwarded-Encrypted: i=1; AJvYcCXnSfi6RU49PUuSjcwQ5oXJOdLWoeu3wjSyc1xz/Kmdam0PklnmCUvdzJL+W+dU2jV2d6u+nSBeqFwoF+Q=@vger.kernel.org X-Gm-Message-State: AOJu0Yz9StxaNB0lgTDmCjo2Y5dSzsuDAr6A0QMbi7T6CSlzO05y0ABs RYEGXu78NcluWCQni7Qx+fDChIFlYN7+tCdRvwosukXw7tguZRDBUXdmiTHmwXfT7e8egewLrKq qkayWhoQhag== X-Received: from dyblc5.prod.google.com ([2002:a05:7301:1305:b0:2ba:ad3a:9ab0]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7300:a146:b0:2b7:f0a0:c195 with SMTP id 5a478bee46e88-2bde1f9c667mr2195942eec.31.1772262012517; Fri, 27 Feb 2026 23:00:12 -0800 (PST) Date: Fri, 27 Feb 2026 22:59:49 -0800 In-Reply-To: <20260228065953.3226283-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> X-Mailer: git-send-email 2.53.0.473.g4a7958ca14-goog Message-ID: <20260228065953.3226283-4-irogers@google.com> Subject: [PATCH v2 3/7] perf session: Extra logging for failed to process events From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , Derek Foreman , Howard Chu , Thomas Falcon , Swapnil Sapkal , Anubhav Shelat , Chun-Tse Shao , Hrishikesh Suresh , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org 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.473.g4a7958ca14-goog From nobody Sat Apr 18 11:08:29 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 C9FCC3469F8 for ; Sat, 28 Feb 2026 07:00:15 +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=1772262020; cv=none; b=DzdIiedHKKsT/zdssO0W93FTJAXZE6/2MKg0GpnyJ6setPq2k6ceVP44s1vFTemPrtQzEjFhTFEjPn4kUmGIVazIfWtZmgFcyYwR4Ah3zBvwDZ26i9u46JQL8lPKxidsZKvfZISb/WQajLZxSGY3S4PDwduYCUFEGtkgiLxbAC4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772262020; c=relaxed/simple; bh=Kax/myIMGExs7wxnaLH23BK2SiUucjfK/qLnlcckqHU=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Content-Type; b=uFtzEAqvntssMRg7yGw+UCtTjhvjoqEAVQRuxOxALyoid3K6yboRu5HHUM5Pua2TY52086CwzR8PH8bDDljF/pBJuNRE0iE4EsrRor6yI31n4rz+g+NZmGMX39BRrcEDOvt3kY3624eWUN0vth5YS5B6RpYJXF7nhEDChntJq14= 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=0zQZQpcs; 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="0zQZQpcs" Received: by mail-dl1-f73.google.com with SMTP id a92af1059eb24-126e8ee6227so5249051c88.0 for ; Fri, 27 Feb 2026 23:00:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1772262015; x=1772866815; 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=MytKBoIqsrm5Um7QBXIJNdgw1mWcSqMwS6R0Qqoo6pU=; b=0zQZQpcsTTpZzEU5k9K7BT0FCejQADweEGcq1ZKVduNZevcMwhzBKgqwe/YE4E1JUY OOVjk+kv4p/5+/gxaCNiM/Va2Pz0DLWpe2DqoBAHYVB2AG8VYc5iXYbkpnomXXWnm0Qd xouWEFN6S6D/Xo/0+sEYKSvvljMDbqRp9wYixyJTofdeDYrzNH+4zntJbUzSG0HVi15F bqeJDFFCR8zvoPIqPA9F+Su9EXcsTR9VSHcVTmLexFISoV78MwUZc2a5XryhItbt35DL whRwdRkO0FZDQKxJ7LjVjEqrYbqrDo+dtvHDkMwTysR0y8iCVYji+ZMIdjNB7E+wMHGP gggA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772262015; x=1772866815; 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=MytKBoIqsrm5Um7QBXIJNdgw1mWcSqMwS6R0Qqoo6pU=; b=P3Givu1PLcSEogFM0A0tywZ21nI6kkYN9a8PjcLrs91h5+CRqX9YJhBtxfzIC0Qdb9 V6wtCIs7SsVFHWlY0HxBMMUkNrqhFz98hAHJ9/vHyxG4+ZZ/wsYikIwTTAj2NuBYdZNL mn6N/bc8rgRbBoXl8FEBEGCisDOljQsLLJqZRduKRStlBNaT3WrFM6dM8R6kmI38Q/Zg y0UQIFDOLNcN+wd/iiuyBglh3y4vyRDbCzsBrAjTW6B4ym1oo6RPJ9VrQ20T+7WughIJ tzt274oVUANoI+2OYQyy9FADTP0irPfsFE8FyKPvRu5VSeyJbRkawaFPFiswCHGYMsNT V3xw== X-Forwarded-Encrypted: i=1; AJvYcCWTMWMDo4aN8Z4lYFGA/bmK0jFCZkEeZq5Fv/WzFkz1+rJ75eHdytQKAnhQ3nnnbt9556b7vvSjuKzFEmY=@vger.kernel.org X-Gm-Message-State: AOJu0YyaRIPqAiM/lntfNrvt+K5AFI+CZn8Q3DXgHhKK0HXk2biI6Tqf 0XamsUstrgnbwsHSaNB2PfL8U8UomIlaHZcSJS+b3b68oP2DNlzD0xaiwsYqzLDo3rZGfOEsEwL RsIW23wYy8g== X-Received: from dlg18.prod.google.com ([2002:a05:7022:792:b0:127:93b2:e6d4]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:1a81:b0:127:387f:bae5 with SMTP id a92af1059eb24-1278fc93088mr1799027c88.45.1772262014661; Fri, 27 Feb 2026 23:00:14 -0800 (PST) Date: Fri, 27 Feb 2026 22:59:50 -0800 In-Reply-To: <20260228065953.3226283-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> X-Mailer: git-send-email 2.53.0.473.g4a7958ca14-goog Message-ID: <20260228065953.3226283-5-irogers@google.com> Subject: [PATCH v2 4/7] perf header: Refactor pipe mode end marker handling From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , Derek Foreman , Howard Chu , Thomas Falcon , Swapnil Sapkal , Anubhav Shelat , Chun-Tse Shao , Hrishikesh Suresh , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org 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 9c27bb30b708..cf2d2011e148 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) @@ -876,7 +867,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 3b81f4b3dc49..0b9dc66723f2 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 9f8b0fd27a0a..53f016156d7a 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) @@ -4427,7 +4418,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 3c958d738ca6..f57ea6db02a0 100644 --- a/tools/perf/util/intel-tpebs.c +++ b/tools/perf/util/intel-tpebs.c @@ -217,15 +217,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; @@ -238,7 +229,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.473.g4a7958ca14-goog From nobody Sat Apr 18 11:08:29 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 9C04033ADB1 for ; Sat, 28 Feb 2026 07:00:17 +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=1772262020; cv=none; b=rCBofwq+ODBH0ZHnQkjlLC4pzTw6g5ipYAgDGM7BQHUso+lXMIwaKpinSRBvUAbQHtKj/WEsYpqWfEesPJTmHwA30twQO/5PImuZqQsisfjcb2vnWSEXlChwO8viRmfUZyezzOtyzm++w/v4qzsJspkktotiDDDCWph2EEX8hcc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772262020; c=relaxed/simple; bh=RliYG1vtA9yaOSRN1mSCoxA/CjGp73TxlW38mjNPxws=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Content-Type; b=jMubCYt6o53zRRjwr3+/wVeIU5pFygT0vJijHxbbCtHr/vG/mIRBbH4RMUb6oYZuFNSwNMGT766b7mbCsAIKspsVaFNAKAgoSd7sbYtHm3808VaJlTIE36UO4Hz7AxqP3x3E3l+S2E/PCCOz0GpqSMurPzVZW86VEFdNKdDCxqM= 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=OAk3HoyN; 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="OAk3HoyN" Received: by mail-dl1-f74.google.com with SMTP id a92af1059eb24-1273665df8fso4357212c88.1 for ; Fri, 27 Feb 2026 23:00:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1772262017; x=1772866817; 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=za18wqJGPZ4qBV9MGIgRWVqdllmP5Iez95b0lcxgM8w=; b=OAk3HoyN0W5A8T7cHIMIwqA3r2WWFE9hsGMCpAWteppLc8Z3TSkg6NLpheq9XwqHq5 PS5wBoD+oxin8xDEwBjGpyOTOMuhnRG97Jj9RwNfklepNKNTNkpXguGa3FKro0mF4OrL K4rPVK3pj2KY4CtLW8LGWUe/EF5jDmBmzekBuvn4312+kqFHnKEs/kyA03y9c9fT++JR jU2tMOVfF1BPBB6v1HP2WeFD7OtPOrSktnHrZyo2PtipNw7heOyGyfh0Z0rE7ZeQVLsP xaVAeo9UrV+nGcJK4E2YPlygG35QvhhqckR67w3anNwGeZMJbux0klwRjWps1uvYQOky /ynQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772262017; x=1772866817; 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=za18wqJGPZ4qBV9MGIgRWVqdllmP5Iez95b0lcxgM8w=; b=Hd1rHsH+fbnLaJ6XF/mG8Gm4AE9axGVWM1q+J/JozpEosVOcsHmLUQJThZQp/abL7v HX9hP00kKZhdB75mGYP1+3kBCCzHTJa8As8TRMPvP2IFtCrCxxXKGhMu50sV5hcwwRHS 0pgPUMuIDSFpfIWFoww5l6G0ngqwmWNo9G06TQIeCa+wv3/GDNx/nxnLHR+yZyeXxpER 99b80KTwDllQwzV4PCaJMUU1EKAlanes+wwd1z43tENbmD+wvZTq+73wq+XRdCu6d4Fk ynwkcwHRw9wcaRlZfsy8+1s4CTQsP+OqTK0BQdehNxcnjULSbfjy6amV7kaQorJRqLh+ txrw== X-Forwarded-Encrypted: i=1; AJvYcCVJab9nLLC44uBQNn+b7hHiU9CguLQ4THaYfiYi3OfjE2/5ChIV2jKx3+96dIAjrUbUHG1pOIW2+IvwfSM=@vger.kernel.org X-Gm-Message-State: AOJu0YyILTv8uua811bKcYXJYWA1+eQpgf/SWkbWyJMx/z6pQJHysb7u vrspRNEZMehq2BYuCyRG47QpBh0E/k6bSPnXuZvkd/0rDjfjbvd2mFbNVbtCtiNwKesi/xtg8QD VPl8ULeQWHA== X-Received: from dlam21-n1.prod.google.com ([2002:a05:701b:2095:10b0:127:89b6:8d2a]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:486:b0:123:3488:899c with SMTP id a92af1059eb24-1278fc5b9ecmr2052627c88.40.1772262016629; Fri, 27 Feb 2026 23:00:16 -0800 (PST) Date: Fri, 27 Feb 2026 22:59:51 -0800 In-Reply-To: <20260228065953.3226283-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> X-Mailer: git-send-email 2.53.0.473.g4a7958ca14-goog Message-ID: <20260228065953.3226283-6-irogers@google.com> Subject: [PATCH v2 5/7] perf ordered-events: Event processing consistency with the regular reader From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , Derek Foreman , Howard Chu , Thomas Falcon , Swapnil Sapkal , Anubhav Shelat , Chun-Tse Shao , Hrishikesh Suresh , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org 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.473.g4a7958ca14-goog From nobody Sat Apr 18 11:08:29 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 817E733F8A8 for ; Sat, 28 Feb 2026 07:00:19 +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=1772262024; cv=none; b=l6M7mXnAv/O636SzXHefIlTboxG2mIHUlHwYuw77mZhJRpC+Y7+5r9LzsHuvLF5HgzgW0iWVmnxtPlBvLxSoRONQBmhJppVwMF5O6b6Oo02waZ/ARf382lxGZ+uMiR0TruPnysU4u/zvN+jHRr1j9WhjUNHUA4Ih6nSY/oCBPfU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772262024; c=relaxed/simple; bh=QvRWYt+Y1GnrkS1KnNIWPyNcQFsQz5y+CvtFYQ5TX7s=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Content-Type; b=JUoRTNVE7xgOJhUWPvj9aAT8xtW4JV9sLQu9lRhOHmSyQl39zApGD2+E8bYs13hJIeMKpnv3BrOS/S+YQmCkBdTHsOoLIohdTgeW2uykoA0CETPq7A9V+HFrBjnQG46iW++aRsazASsg/q4UQhIm5o+Yh12sZp6ecsiCKWeotsY= 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=n9QMqt17; 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="n9QMqt17" Received: by mail-dl1-f73.google.com with SMTP id a92af1059eb24-124a95b6f61so18440316c88.0 for ; Fri, 27 Feb 2026 23:00:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1772262019; x=1772866819; 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=TDpebJHPDPcU5V+xyvT7INvO6tm+KadCONtksWNWUwM=; b=n9QMqt17EQXdtB2gpaZygcNAzSGgGVZ/uw/h0we1EXrQfelmwuhNMKFxBsHM2HgMbh nLO51eEYvnjonpoboW4mVSLQKIxLqiGrYF9dMWiePWJodW07MUBFzfUbtPdKwivJ1PMZ LFnoI29NCCY0CiK+1BRRcSe7uQlGnngkqtA9gPgQZBzmGi+CGqS6ulxDV1mEMisItFlY gcPe/5Nj5lNofXtE7c9RThahXwlrs1wgyYd5oQXYp8r5cdChoYOjavsVgOlBopTsaMaP wuZNCpSmMeRYr5V9aHGYXGaUF29TynXHx2Ejo52yrgMEtcSMKL7QV48aZe4nDlQgvwD9 esQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772262019; x=1772866819; 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=TDpebJHPDPcU5V+xyvT7INvO6tm+KadCONtksWNWUwM=; b=Vt+mXBbECQsujiQB6S7m0DasiMt5V2NQ7HnIj/N+TSG1ilK4LXrVVFnAgWX5nSk1uq 7Xd/bvBBt2nmIeZ1HRmiLeG0jJ9fpyDxrSFmqFu9gjQql4JvCnI218Gr54qzdSH75IAG jzM8oQYmRKY+EyHnQGDmlrNwjm/5HChAiyVAkLtpWxbPjrgOR/aZTzNjp5+QNvaX/ffS 1hpIYTgw4PM229pDkbiC9yJdY4VhuRaKMKjvri6N7nQXSffpAkuPHzMYoyJvOLoz5OAl qxd3Omd+4m8SfT1JZBpcaxWUM6vGkwTaawK9jhYQpJeEZ5WgBw/lYtnEFzLIToZ/4wbq i2qg== X-Forwarded-Encrypted: i=1; AJvYcCUJiura7Jcsron/foxrA0IEdciakOL8Td0DJ8+ypfpyoaWXcZ6qSfnmRq1nJyCHO2lPqKFPewj5gJAEvTk=@vger.kernel.org X-Gm-Message-State: AOJu0YzODTjsdEbR2LPumbiOthsL9r8R7SuEtp/wk+vLfCkucZ2y7mlq EfYelcl42mTHccca+4ttoQRxEC1cphLxChTJUSdIjRb8RGb+m3fo6ME60H3FxESmtiJ7diP22eU HLaEqhgGAww== X-Received: from dlbsv14.prod.google.com ([2002:a05:7022:3a0e:b0:127:8b2a:c1c2]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:128f:b0:123:3461:99be with SMTP id a92af1059eb24-1278fcdfe04mr3121230c88.21.1772262018581; Fri, 27 Feb 2026 23:00:18 -0800 (PST) Date: Fri, 27 Feb 2026 22:59:52 -0800 In-Reply-To: <20260228065953.3226283-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> X-Mailer: git-send-email 2.53.0.473.g4a7958ca14-goog Message-ID: <20260228065953.3226283-7-irogers@google.com> Subject: [PATCH v2 6/7] perf evsel: Make unknown event names more unique From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , Derek Foreman , Howard Chu , Thomas Falcon , Swapnil Sapkal , Anubhav Shelat , Chun-Tse Shao , Hrishikesh Suresh , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org 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 f59228c1a39e..fdc67df0e739 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.473.g4a7958ca14-goog From nobody Sat Apr 18 11:08:29 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 92723346E51 for ; Sat, 28 Feb 2026 07:00:21 +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=1772262022; cv=none; b=aACNOb86UAlktA+0XI6mvqVfYhTT6S1cFzHwOKxrPnPqgCERKjg6eml+CM79v4VkKjx/n6x1w7RVzyBit+pgM7DEncqo12Osy6rJUZHfP3O5mrdPtNbkb1ulGcEoN418BEkVk1Z25GkeZ/fwI49MAGqWrBKXh47TKDnm33TjhUA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772262022; c=relaxed/simple; bh=C+BNnrCCmJA4FL3QKjxBkSimosch1QmHNVNHpMakgjQ=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Content-Type; b=YuwStxTBISq4baxjl9aj6Siexcp3RpqIdf4CQd2xQJytmQwGuCmE2N2Ddnrh2vdzxfqFmacS30USoH5FyfWcxm7HPtbUfjbJyoEaIhVz69E9Kh57DlAYLrzhYHj9SwzWqF69KApMJhRLwIxJBp85OWxYcI27GLj/2PsY38imeBg= 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=STMUiEQ/; 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="STMUiEQ/" Received: by mail-dy1-f202.google.com with SMTP id 5a478bee46e88-2bddd304622so2146210eec.0 for ; Fri, 27 Feb 2026 23:00:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1772262021; x=1772866821; 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=Wydvp72L5ex8AMv7NN/10Q5kEpk3VQLHsgnYQce3iPI=; b=STMUiEQ/USIFeRf6PKTcS5iFGRAXfy96UCjCsH+7Ieb1moLSCYG6iayTnROGxkCU0F 0jf6ms2YKl8DhFOMchZu2LEI9coG5Gig5Xyk/2u4J/ZLjYlsHhxugWG9sIS0pwWWTWsr VGuO7Iwzgh7bdzNod4YT5qVSBTPq/ASQJKbHYoB5KPWK3XKdh8lJSg8cc8QmH9WHF7QF VqliSWbszp+x9IqxuOal6YcwPZJ2HJ2vxt9cYOcaA0tUfJggkMWHNFmQROq9qaorFw6b DosOFHNKVqWpvDb49+Jpd/vcYUsvU1qaQ+uAj+/RTpBc1tScJSbQ05ZpglPx10X/IPSr a8AA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772262021; x=1772866821; 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=Wydvp72L5ex8AMv7NN/10Q5kEpk3VQLHsgnYQce3iPI=; b=JILHxZayvy/3+C76apbSkaWFzn8dZDurjmm1AUgti+2ZBwMYku4oQbqDLMC6SBXk8I S1MkLdlyIWnC67zbcqrL+2fa7sL4G/dao7mgB5niRXeaviQMfF6VNATcKmr+Et01NxvA KBpLk661cTOzGnMc90JOZdycICcx28SC1/GJ2F643bhIbXYSD69gqRX8iZl5UeY2cQL0 GH6qJOyavZXW23mzJvzFyYEWfh0kWE0OYK1d+tAtN0B6Edo424iRqqpHSiG1OaX3vVTf nlfofthlzFN7kuBqDSqSn2pxqenKEQ7sj8d+nGVfSQ97HV+wSyXu4xZRSykyqKSQ29qh 8jjQ== X-Forwarded-Encrypted: i=1; AJvYcCXuZIj320NfB2kIpBR8QFtvBY6rDXVerrHwS1A2WRVeS7upCaui3QjuTvnShZxmeyB/Y+hnmrk58dTXf0I=@vger.kernel.org X-Gm-Message-State: AOJu0YxieqgyuQwWqI6nK2btqavKQpTaG/4BmDWXSvzx+Ggh8kcp5Pew HHEa2Z7JC5KvulndK/SReus/0MGGbG0miGOHVeV2OsOBo8QwmJwJzX2OEhTP1rqOds4lgk1QeF5 rU6s0viTX5g== X-Received: from dybcr37.prod.google.com ([2002:a05:7300:aca5:b0:2ba:6ffb:dc6e]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7300:a187:b0:2ae:51fa:b7ec with SMTP id 5a478bee46e88-2bde1cbdeebmr1958091eec.25.1772262020261; Fri, 27 Feb 2026 23:00:20 -0800 (PST) Date: Fri, 27 Feb 2026 22:59:53 -0800 In-Reply-To: <20260228065953.3226283-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> X-Mailer: git-send-email 2.53.0.473.g4a7958ca14-goog Message-ID: <20260228065953.3226283-8-irogers@google.com> Subject: [PATCH v2 7/7] perf data convert ctf: Pipe mode improvements From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , Derek Foreman , Howard Chu , Thomas Falcon , Swapnil Sapkal , Anubhav Shelat , Chun-Tse Shao , Hrishikesh Suresh , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org 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 | 54 +++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/data-convert-bt.c b/tools/perf/util/data-conve= rt-bt.c index 665bf8eea24b..5d35e9822b8f 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; @@ -1725,7 +1773,7 @@ int bt_convert__perf2ctf(const char *input, const cha= r *path, goto free_writer; =20 /* CTF events setup */ - if (setup_events(cw, session)) + 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.473.g4a7958ca14-goog