From mboxrd@z Thu Jan 1 00:00:00 1970 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 2DF5E3DD508 for ; Mon, 18 May 2026 06:12:32 +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=1779084755; cv=none; b=amQrASihH/PgRbZU5E9UofQVp7jJWlM7f1oKF06hm0l722ziZy69PtcryRD5A+cUelPGLN8hsCZdx2aJ+Sr8u7x8GunWch0Qz3oU+/fuA7P9jV0Xa5FLnRMT+anp3bgyZ/HFt0TNKhNG8hZmoMVHvfkECBVkPtpVn0dlNDO+Yxw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779084755; c=relaxed/simple; bh=zqPX2xXsaBdF1D2OQcUu/6Wi3jnch+KGMZaEohm6g6Y=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=B3rIv1fOe3mWTI7NbW5qiKkoGK/NiI6xbkp3VGBCnSGj7DVbxvPFTL03L0/jQscosTMBXv95YHKLmu6JqMMEBNHdHjpOIZwCTQRFjWMK6yzZ7IG4q6OncjfTbo9hNwMZiXTuVaDjMyh/AKzFKd73Nn4pb2D7h67gt5DIUYqIdwA= 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=kvwLKvmh; 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="kvwLKvmh" Received: by mail-dl1-f73.google.com with SMTP id a92af1059eb24-12dc3d81736so1196412c88.1 for ; Sun, 17 May 2026 23:12:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1779084752; x=1779689552; 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=svrBpcf/Ip/LN+2rU1He1WB/MKRBGxKYLI2XlJwS7MM=; b=kvwLKvmh7gdQTC+vyTXsfAxPiHB0q1JA71uzuZgHuG1gswRqaOFdhH7OTyy8XLB963 Zu9XO3owq+b3dUPDGraTdKvA5YtKju1F2HdKGglQKtmlp2X6h3ijqKSN9vdF+cXtaR6h tqKsFaAriMqlmeX6UD95i1EtCrtpE8USxx5Y9dGwA3TPxMEDSAFC5a/EW7cz8yRk45pF 8s72ItElcXAgyf848LVoDJDR8mNCz5Wix5ASd9zDXOdfrM4kwwteYKDFnQeCx8jJN4jq QMKZlcEQQklYG1/oDs97zM4e87C1gEjM3nmP6iJS8kNVq1S0uqL0FGNrvncU+fwbbmvU 3gxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779084752; x=1779689552; 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=svrBpcf/Ip/LN+2rU1He1WB/MKRBGxKYLI2XlJwS7MM=; b=i9PD8gwIFeKlyAKlCdTAt3NYhunf6LiP1o6UwgEBiExfEWmAHMm175W4Yc37oM1wlO ZMNEzPF05fcg9V4huuEda5rJ0TiwnuCQW+EdRa0p61xq4STt+4XzzgcetbJWSwr+Y99z 6mu312sPLgNnOBmwsF31Igv7mV3nq6XJidVSbLc9EDhciY0cNn9t5Bx6WluMpqoTKqWZ rFernNm+3fF2X/qI+/8LTXfNpEYnbuiv12Vz2kXQui0Bkv5I24ZvXLLrP10FLTUWoctB /a0BvaqfkZggsTWdB+mFCODZJ1DJFD9DEtuzjGJLgXSoEoULXchQFuoQ2rcXiF2Ia4Cm tFgg== X-Forwarded-Encrypted: i=1; AFNElJ/4p4aHCbMTQ+wpYTKab0ye5/hDliJBtdLxmXgTpeBf3W2gawRHUsINo2aj0stNiSBluJnttLwPq/jRxNA=@vger.kernel.org X-Gm-Message-State: AOJu0Yyl511CoIHDpo1VJ8yQi27wXIF6DigN8of0tZ8Gf5F+R1U/4dh8 0RXWFPv/D9bSWfCdZSj2TItoc/fStsmcgX4R7GbA+E+G/ksH82D7Zj5n4kRhzMreWKqSiE0btcK QQO4V6NmwZw== X-Received: from dlbrl26.prod.google.com ([2002:a05:7022:f51a:b0:12c:912f:7ce9]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:ff42:b0:133:3bb1:8d40 with SMTP id a92af1059eb24-1350451ace4mr5109989c88.15.1779084751549; Sun, 17 May 2026 23:12:31 -0700 (PDT) Date: Sun, 17 May 2026 23:12:26 -0700 In-Reply-To: <20260429181136.2712655-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: <20260429181136.2712655-1-irogers@google.com> X-Mailer: git-send-email 2.54.0.563.g4f69b47b94-goog Message-ID: <20260518061228.2582860-1-irogers@google.com> Subject: [PATCH v3 0/2] perf inject intel-PT LBR/brstack synthesis fixes From: Ian Rogers To: irogers@google.com, acme@kernel.org, adrian.hunter@intel.com, namhyung@kernel.org Cc: dapeng1.mi@linux.intel.com, james.clark@linaro.org, leo.yan@linux.dev, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, mingo@redhat.com, peterz@infradead.org, ravi.bangoria@amd.com, thomas.falcon@intel.com Content-Type: text/plain; charset="UTF-8" An intel-pt trace can be turned into LBR events either in perf script or perf inject with the --itrace=L option. With perf inject the generated perf.data file failed to be parsed as the sample events were out of sync with their perf_event_attr. A range of fixes were required. This patch was separated from a large perf script refactor that highlighted the breakage: https://lore.kernel.org/lkml/20260425224951.174663-1-irogers@google.com/ v3: - Add missing Fixes: tags on both commits. - Refactor perf_event__repipe_attr to avoid in-place modifications on read-only mmap buffers, preventing SIGSEGV in file mode and premature evsel updates in pipe mode. - Use perf_event__synthesize_attr to correctly construct and repipe attributes in pipe mode. - Replace manual arithmetic in convert_sample_callchain with perf_event__sample_event_size to prevent uninitialized memory leaks. - Retrieve evsel branch_sample_type dynamically in util/arm-spe.c and util/cs-etm.c instead of hardcoding 0, resolving missing hw_idx field on synthesized branch stacks. v2: Response to sashiko fixes for patch 2, Namhyung's acked-by for patch 1. v1: https://lore.kernel.org/lkml/20260428070328.1880314-1-irogers@google.com/ Ian Rogers (2): perf event: Fix size of synthesized sample with branch stacks perf inject: Fix itrace branch stack synthesis tools/perf/bench/inject-buildid.c | 9 +- tools/perf/builtin-inject.c | 141 +++++++++++++++++++++++++---- tools/perf/tests/dlfilter-test.c | 8 +- tools/perf/tests/sample-parsing.c | 5 +- tools/perf/util/arm-spe.c | 21 ++++- tools/perf/util/cs-etm.c | 23 +++-- tools/perf/util/intel-bts.c | 3 +- tools/perf/util/intel-pt.c | 26 ++++-- tools/perf/util/synthetic-events.c | 25 +++-- tools/perf/util/synthetic-events.h | 6 +- 10 files changed, 216 insertions(+), 51 deletions(-) -- 2.54.0.563.g4f69b47b94-goog