From nobody Tue Jun 30 05:22:43 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 452B6C433FE for ; Tue, 25 Jan 2022 19:35:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230244AbiAYTft (ORCPT ); Tue, 25 Jan 2022 14:35:49 -0500 Received: from smtp-fw-6001.amazon.com ([52.95.48.154]:42806 "EHLO smtp-fw-6001.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230156AbiAYTei (ORCPT ); Tue, 25 Jan 2022 14:34:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1643139277; x=1674675277; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Lxztq/mtL0h23FYq/vaK8RPNJ15WKjUkIqfQpt8jYbs=; b=Ez+uLbD+C2yqw7Cd2MTW8PHfPxor1A/tQ0/3bVXCuUq/UpW8NFfnitGg DjtRPRQ8DlJzPh0jMuBPshNH5HL+xqE4b5kNws9jl0D/bLQQmja/n+GbH I0GanQlBDrEfVbzSlP+f3YosybY46JLNKforzORr/ji8z9CHvrobKNuh/ M=; X-IronPort-AV: E=Sophos;i="5.88,315,1635206400"; d="scan'208";a="173065575" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-pdx-2a-e6c05252.us-west-2.amazon.com) ([10.43.8.6]) by smtp-border-fw-6001.iad6.amazon.com with ESMTP; 25 Jan 2022 19:34:33 +0000 Received: from EX13MTAUWB001.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan2.pdx.amazon.com [10.236.137.194]) by email-inbound-relay-pdx-2a-e6c05252.us-west-2.amazon.com (Postfix) with ESMTPS id E215C41A77; Tue, 25 Jan 2022 19:34:27 +0000 (UTC) Received: from EX13D02UWB001.ant.amazon.com (10.43.161.240) by EX13MTAUWB001.ant.amazon.com (10.43.161.207) with Microsoft SMTP Server (TLS) id 15.0.1497.28; Tue, 25 Jan 2022 19:34:24 +0000 Received: from EX13MTAUEA002.ant.amazon.com (10.43.61.77) by EX13D02UWB001.ant.amazon.com (10.43.161.240) with Microsoft SMTP Server (TLS) id 15.0.1497.28; Tue, 25 Jan 2022 19:34:24 +0000 Received: from dev-dsk-alisaidi-i31e-9f3421fe.us-east-1.amazon.com (10.200.138.153) by mail-relay.amazon.com (10.43.61.169) with Microsoft SMTP Server id 15.0.1497.28 via Frontend Transport; Tue, 25 Jan 2022 19:34:23 +0000 Received: by dev-dsk-alisaidi-i31e-9f3421fe.us-east-1.amazon.com (Postfix, from userid 5131138) id 93D8D21E70; Tue, 25 Jan 2022 19:34:23 +0000 (UTC) From: Ali Saidi To: , , CC: , , Peter Zijlstra , Ingo Molnar , "Arnaldo Carvalho de Melo" , Mark Rutland , "Alexander Shishkin" , Jiri Olsa , Namhyung Kim , John Garry , "Will Deacon" , Mathieu Poirier , "Leo Yan" , James Clark , German Gomez , Andrew Kilroy Subject: [PATCH 1/2] perf arm-spe: Add arm_spe_record to synthesized sample Date: Tue, 25 Jan 2022 19:20:09 +0000 Message-ID: <20220125192016.20538-2-alisaidi@amazon.com> X-Mailer: git-send-email 2.24.4.AMZN In-Reply-To: <20220125192016.20538-1-alisaidi@amazon.com> References: <20220125192016.20538-1-alisaidi@amazon.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Providing the arm_spe_record as raw data to the synthesized SPE samples allows perf scripts to read and separately process the data in ways existing perf tools don't support and mirrors functionality available for PEBS. Signed-off-by: Ali Saidi --- tools/perf/util/arm-spe.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c index d2b64e3f588b..a7499cde6fc0 100644 --- a/tools/perf/util/arm-spe.c +++ b/tools/perf/util/arm-spe.c @@ -336,6 +336,8 @@ static int arm_spe__synth_mem_sample(struct arm_spe_que= ue *speq, sample.phys_addr =3D record->phys_addr; sample.data_src =3D data_src; sample.weight =3D record->latency; + sample.raw_size =3D sizeof(*record); + sample.raw_data =3D record; =20 return arm_spe_deliver_synth_event(spe, speq, event, &sample); } @@ -354,6 +356,8 @@ static int arm_spe__synth_branch_sample(struct arm_spe_= queue *speq, sample.stream_id =3D spe_events_id; sample.addr =3D record->to_ip; sample.weight =3D record->latency; + sample.raw_size =3D sizeof(*record); + sample.raw_data =3D record; =20 return arm_spe_deliver_synth_event(spe, speq, event, &sample); } @@ -383,6 +387,8 @@ static int arm_spe__synth_instruction_sample(struct arm= _spe_queue *speq, sample.data_src =3D data_src; sample.period =3D spe->instructions_sample_period; sample.weight =3D record->latency; + sample.raw_size =3D sizeof(*record); + sample.raw_data =3D record; =20 return arm_spe_deliver_synth_event(spe, speq, event, &sample); } --=20 2.24.4.AMZN From nobody Tue Jun 30 05:22:43 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A77E2C433F5 for ; Tue, 25 Jan 2022 19:35:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230213AbiAYTfL (ORCPT ); Tue, 25 Jan 2022 14:35:11 -0500 Received: from smtp-fw-2101.amazon.com ([72.21.196.25]:17360 "EHLO smtp-fw-2101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230163AbiAYTep (ORCPT ); Tue, 25 Jan 2022 14:34:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1643139285; x=1674675285; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=NAvOTNs9bwZgrhJlwLaHAnqjrea7JZaYZR3NRB0BhzQ=; b=OWYQ4X37BjUoSYndpLfKy9mR9yVcQjo+AEWYvslArd2IgfEEbuvsBR6h b75DdvT0XHkhgfKS3ClNEGUlIPN6Wrb7GNhoaYtTv3fQmdP13Wr5oc2TK xZfbjGF60emkn6HZxO3eE0UfehfNuwP32OyIKp3tCabbxMBIY/WmFlTzm Y=; X-IronPort-AV: E=Sophos;i="5.88,315,1635206400"; d="scan'208";a="168477491" Received: from iad12-co-svc-p1-lb1-vlan2.amazon.com (HELO email-inbound-relay-pdx-2b-31df91b1.us-west-2.amazon.com) ([10.43.8.2]) by smtp-border-fw-2101.iad2.amazon.com with ESMTP; 25 Jan 2022 19:34:43 +0000 Received: from EX13MTAUWB001.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan2.pdx.amazon.com [10.236.137.194]) by email-inbound-relay-pdx-2b-31df91b1.us-west-2.amazon.com (Postfix) with ESMTPS id B0A7141860; Tue, 25 Jan 2022 19:34:42 +0000 (UTC) Received: from EX13D02UWB003.ant.amazon.com (10.43.161.48) by EX13MTAUWB001.ant.amazon.com (10.43.161.207) with Microsoft SMTP Server (TLS) id 15.0.1497.28; Tue, 25 Jan 2022 19:34:33 +0000 Received: from EX13MTAUEA002.ant.amazon.com (10.43.61.77) by EX13D02UWB003.ant.amazon.com (10.43.161.48) with Microsoft SMTP Server (TLS) id 15.0.1497.28; Tue, 25 Jan 2022 19:34:33 +0000 Received: from dev-dsk-alisaidi-i31e-9f3421fe.us-east-1.amazon.com (10.200.138.153) by mail-relay.amazon.com (10.43.61.169) with Microsoft SMTP Server id 15.0.1497.28 via Frontend Transport; Tue, 25 Jan 2022 19:34:33 +0000 Received: by dev-dsk-alisaidi-i31e-9f3421fe.us-east-1.amazon.com (Postfix, from userid 5131138) id 4B27421E70; Tue, 25 Jan 2022 19:34:33 +0000 (UTC) From: Ali Saidi To: , , CC: , , Peter Zijlstra , Ingo Molnar , "Arnaldo Carvalho de Melo" , Mark Rutland , "Alexander Shishkin" , Jiri Olsa , Namhyung Kim , John Garry , "Will Deacon" , Mathieu Poirier , "Leo Yan" , James Clark , German Gomez , Andrew Kilroy Subject: [PATCH 2/2] perf arm-spe: Parse more SPE fields and store source Date: Tue, 25 Jan 2022 19:20:10 +0000 Message-ID: <20220125192016.20538-3-alisaidi@amazon.com> X-Mailer: git-send-email 2.24.4.AMZN In-Reply-To: <20220125192016.20538-1-alisaidi@amazon.com> References: <20220125192016.20538-1-alisaidi@amazon.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Decode more SPE events and op types to allow for processing by perf scripts. For example looking for branches which may indicate candidates for conversion to a CSEL, store exclusives that are candidates for conversion to LSE atomics and record the source information for memory ops. Signed-off-by: Ali Saidi --- .../util/arm-spe-decoder/arm-spe-decoder.c | 18 ++++++++++++++++++ .../util/arm-spe-decoder/arm-spe-decoder.h | 8 ++++++++ 2 files changed, 26 insertions(+) diff --git a/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c b/tools/perf= /util/arm-spe-decoder/arm-spe-decoder.c index 5e390a1a79ab..177bac0f7128 100644 --- a/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c +++ b/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c @@ -191,6 +191,20 @@ static int arm_spe_read_record(struct arm_spe_decoder = *decoder) decoder->record.op =3D ARM_SPE_ST; else decoder->record.op =3D ARM_SPE_LD; + if (SPE_OP_PKT_IS_LDST_ATOMIC(payload)) { + if (payload & SPE_OP_PKT_AT) + decoder->record.op |=3D ARM_SPE_LDST_ATOMIC; + if (payload & SPE_OP_PKT_EXCL) + decoder->record.op |=3D ARM_SPE_LDST_EXCL; + if (payload & SPE_OP_PKT_AR) + decoder->record.op |=3D ARM_SPE_LDST_ACQREL; + } + } else if (idx =3D=3D SPE_OP_PKT_HDR_CLASS_BR_ERET) { + decoder->record.op =3D ARM_SPE_BR; + if (payload & SPE_OP_PKT_COND) + decoder->record.op |=3D ARM_SPE_BR_COND; + if (SPE_OP_PKT_IS_INDIRECT_BRANCH(payload)) + decoder->record.op |=3D ARM_SPE_BR_IND; } break; case ARM_SPE_EVENTS: @@ -218,8 +232,12 @@ static int arm_spe_read_record(struct arm_spe_decoder = *decoder) if (payload & BIT(EV_MISPRED)) decoder->record.type |=3D ARM_SPE_BRANCH_MISS; =20 + if (payload & BIT(EV_NOT_TAKEN)) + decoder->record.type |=3D ARM_SPE_BR_NOT_TAKEN; + break; case ARM_SPE_DATA_SOURCE: + decoder->record.source =3D payload; break; case ARM_SPE_BAD: break; diff --git a/tools/perf/util/arm-spe-decoder/arm-spe-decoder.h b/tools/perf= /util/arm-spe-decoder/arm-spe-decoder.h index 69b31084d6be..113e427afe99 100644 --- a/tools/perf/util/arm-spe-decoder/arm-spe-decoder.h +++ b/tools/perf/util/arm-spe-decoder/arm-spe-decoder.h @@ -22,11 +22,18 @@ enum arm_spe_sample_type { ARM_SPE_TLB_MISS =3D 1 << 5, ARM_SPE_BRANCH_MISS =3D 1 << 6, ARM_SPE_REMOTE_ACCESS =3D 1 << 7, + ARM_SPE_BR_NOT_TAKEN =3D 1 << 8, }; =20 enum arm_spe_op_type { ARM_SPE_LD =3D 1 << 0, ARM_SPE_ST =3D 1 << 1, + ARM_SPE_LDST_EXCL =3D 1 << 2, + ARM_SPE_LDST_ATOMIC =3D 1 << 3, + ARM_SPE_LDST_ACQREL =3D 1 << 4, + ARM_SPE_BR =3D 1 << 5, + ARM_SPE_BR_COND =3D 1 << 6, + ARM_SPE_BR_IND =3D 1 << 7, }; =20 struct arm_spe_record { @@ -40,6 +47,7 @@ struct arm_spe_record { u64 virt_addr; u64 phys_addr; u64 context_id; + u16 source; }; =20 struct arm_spe_insn; --=20 2.24.4.AMZN