From nobody Tue Dec 16 11:06:55 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0FFD222E3F4; Wed, 5 Feb 2025 12:16:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738757796; cv=none; b=H4Mx8R/KZRme0w3bveQwvrF7SBgKvFTcDrGtoXDQJAbCXMMSZdReUROa4+X3XwUbYvKDqJ30rg0R5fAjDedBgCv7d1KS9J3cIagBFPiE8r+Vjym1Dfrqzw3SUNYPGdcXsZv8xhKeEvrDjjhbaNyQNYfgDOSQGKQFT86VAIJN4eE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738757796; c=relaxed/simple; bh=j/9xC+B/LJVnI6iB8Q4SksD2oSQKGljo8XBdXCIPwrE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=O1DEzFxGCj5byxVc35FESJ7kvSmdVnXPFHp28XvxYD0VbzxqW6MC8SI1sjyNNtIkdNCFmeV8Vpx8jnXfiTkRqyyxIgZHAAl7gVJhmQQF199i09aK5ytCA/YBwDq035hgcBSSBqL37SsILZWvGB0Ljd5qUMm7QPPV6EacPxVsfrc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 001CF1007; Wed, 5 Feb 2025 04:16:58 -0800 (PST) Received: from e132581.cambridge.arm.com (e132581.arm.com [10.2.76.71]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id EC1643F63F; Wed, 5 Feb 2025 04:16:31 -0800 (PST) From: Leo Yan To: Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , "Liang, Kan" , John Garry , Will Deacon , James Clark , Mike Leach , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Graham Woodward Cc: Leo Yan Subject: [PATCH v1 09/11] perf arm-spe: Set sample flags with supplement info Date: Wed, 5 Feb 2025 12:15:53 +0000 Message-Id: <20250205121555.180606-10-leo.yan@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250205121555.180606-1-leo.yan@arm.com> References: <20250205121555.180606-1-leo.yan@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Based on the supplement information in the record, this commit sets the sample flags for conditional branch, function call, return. It also sets events in flags, such as mispredict, not taken, and in transaction. Signed-off-by: Leo Yan --- tools/perf/util/arm-spe.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c index 12761c39788f..e1419aeed75c 100644 --- a/tools/perf/util/arm-spe.c +++ b/tools/perf/util/arm-spe.c @@ -470,6 +470,26 @@ static void arm_spe__sample_flags(struct arm_spe_queue= *speq) =20 if (record->type & ARM_SPE_BRANCH_MISS) speq->flags |=3D PERF_IP_FLAG_BRANCH_MISS; + + if (record->type & ARM_SPE_BRANCH_NOT_TAKEN) + speq->flags |=3D PERF_IP_FLAG_NOT_TAKEN; + + if (record->type & ARM_SPE_IN_TXN) + speq->flags |=3D PERF_IP_FLAG_IN_TX; + + if (record->op & ARM_SPE_OP_BR_COND) + speq->flags |=3D PERF_IP_FLAG_CONDITIONAL; + + if (record->op & ARM_SPE_OP_BR_CR_BL) + speq->flags |=3D PERF_IP_FLAG_CALL; + else if (record->op & ARM_SPE_OP_BR_CR_RET) + speq->flags |=3D PERF_IP_FLAG_RETURN; + /* + * Indirect branch instruction without link (e.g. BR), + * take it as a function return. + */ + else if (record->op & ARM_SPE_OP_BR_INDIRECT) + speq->flags |=3D PERF_IP_FLAG_RETURN; } } =20 --=20 2.34.1