From nobody Fri Nov 29 23:47:31 2024 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C3E84148823; Sat, 14 Sep 2024 22:09:27 +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=1726351769; cv=none; b=aR8TvtyUf3WeKPutOHJuYCBpaDsWkxQOxhErJRyBuC0xgXZBe75jrRLoBDWyuHvcLJxUYeVchT+Jkkk6YviBovg/WQdjoIPXZDz6EF+B/mmnRS6sLABs8bFWVy1YiytNkgPao71juO5xrfZLzXy5t+OYKhkTU1XGq80hLvt+FtM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726351769; c=relaxed/simple; bh=tCs131liyX3NjisbwqG8GgR4OUdt7zf5z+B/vqGgsl8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ibfWTX3YlhzHOENnpJfOJLUxMORmg90CiFzknxUYWIc9sXAU8wDFzQjt7UFapAW0Soecn4PdOzGXs2/+rlmM58/bxbNgAIWFos0Gx24f14WuFKNnK91dxELpd30Hpqozh/xA2nmL6kf8njUA/AuO8I8wdJWjQBm8vExkJ0pM1Bo= 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 AE1801691; Sat, 14 Sep 2024 15:09:56 -0700 (PDT) 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 7B2393F66E; Sat, 14 Sep 2024 15:09:25 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , James Clark , Mark Rutland , Namhyung Kim , Ian Rogers , Jiri Olsa , Adrian Hunter , "Liang, Kan" , Will Deacon , Mike Leach , Besar Wicaksono , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Leo Yan Subject: [PATCH v2 3/7] perf arm-spe: Introduce arm_spe__is_homogeneous() Date: Sat, 14 Sep 2024 23:08:57 +0100 Message-Id: <20240914220901.756177-4-leo.yan@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240914220901.756177-1-leo.yan@arm.com> References: <20240914220901.756177-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" Introduce the arm_spe__is_homogeneous() function, it uses to check if Arm SPE is homogeneous cross all CPUs. Signed-off-by: Leo Yan --- tools/perf/util/arm-spe.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c index 7cde6584b02d..7e00cf1c287c 100644 --- a/tools/perf/util/arm-spe.c +++ b/tools/perf/util/arm-spe.c @@ -82,6 +82,7 @@ struct arm_spe { u64 **metadata; u64 metadata_ver; u64 metadata_nr_cpu; + bool is_homogeneous; }; =20 struct arm_spe_queue { @@ -1374,6 +1375,30 @@ arm_spe_synth_events(struct arm_spe *spe, struct per= f_session *session) return 0; } =20 +static bool arm_spe__is_homogeneous(u64 **metadata, int nr_cpu) +{ + u64 midr; + int i; + + if (!nr_cpu) + return false; + + for (i =3D 0; i < nr_cpu; i++) { + if (!metadata[i]) + return false; + + if (i =3D=3D 0) { + midr =3D metadata[i][ARM_SPE_CPU_MIDR]; + continue; + } + + if (midr !=3D metadata[i][ARM_SPE_CPU_MIDR]) + return false; + } + + return true; +} + int arm_spe_process_auxtrace_info(union perf_event *event, struct perf_session *session) { @@ -1417,6 +1442,7 @@ int arm_spe_process_auxtrace_info(union perf_event *e= vent, spe->metadata =3D metadata; spe->metadata_ver =3D metadata_ver; spe->metadata_nr_cpu =3D nr_cpu; + spe->is_homogeneous =3D arm_spe__is_homogeneous(metadata, nr_cpu); =20 spe->timeless_decoding =3D arm_spe__is_timeless_decoding(spe); =20 --=20 2.34.1