From patchwork Fri Nov 8 20:29:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilkka Koskinen X-Patchwork-Id: 13868958 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 68BADD64085 for ; Fri, 8 Nov 2024 20:32:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-ID:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=gbuJ11LvjiyiHeAmxVaPXqgB2cuWKI0o5ZvlE4nSWH4=; b=yvyi6hcJZTs2jrvxhX2Fd3deyc o2cAjxZBuMXeKZPo0ZiLyX4NqXw8lGBkK+iQV4r11BVmMmm6v6bYN+Tt5ESfVLVsD6YkszO+AFOL6 4gr/NadY1/ABlrDYPOp0ByAcZMQK7mXSr1SZFDiyxl24cSIY5NjKXSyVWLvIFeKEMDN8AFVtdpiZS 09aH6nvU9cLmQPUIjDtcpmwrUccdUY7cPCVWxD3IFzb/0ObNvhRDwQxGqeiQ2rBwHaLIFT6Rcr0FR 8J3qZLYUjHZHyugzHjZKatsRSpaym6Ks7UbgTZ5nbjuSB/Ea5nNeHMyoQ3igWph4/GWn/rmGcmfji tKbvi7Mg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t9Ver-0000000Bu4J-0y5j; Fri, 08 Nov 2024 20:32:41 +0000 Received: from mail-southcentralusazlp170120001.outbound.protection.outlook.com ([2a01:111:f403:c10d::1] helo=SN4PR2101CU001.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t9Vbx-0000000Bthh-3IHq for linux-arm-kernel@lists.infradead.org; Fri, 08 Nov 2024 20:29:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xVBD7MpUSDgqWrYN+/Roj+149d8DmSW2s6PQCzDHw9+oZ0PbEW8EZsca0k6FihxdiwPGDqxPyACGdLN845gPZ+4LUaEtT2U8qQyP2gQ20HvJtt+svgheaDGKTDz+idz4Gqc8qFEp13XXn/D0a1QG2+g28u2Z2PTKAd1vm3DfucT+cvk/a2e6nkixNe9+M79KMhUddyJA1VlrosV2wZUZSO9oMoC8K2zHRaPBh1E6nMocxYu7d7WD2qbY0UdhP1bqsYieRD7ZsBvtQHKVra7Ve0cuhiPWKaG0pxWldSZJi6CWJPrZSUbDAeCOpzhaaHynJHNfiqaMS2PxnFid0dWTzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gbuJ11LvjiyiHeAmxVaPXqgB2cuWKI0o5ZvlE4nSWH4=; b=mppLGmwlm1OojJ6VHsFy6TYY0tk4yy+Dk+WaXEJ9v8LblP9LZR9Soq1eVoUfMFwzqkgotN4YdM1eHZE1E6SyiFLA1Z1rvBlEhTPss4IdVC+si7XRTfI1hcjm6bKcI/bJwNcJcVjADHYV+gR9QwLlviE+ZsfBM+IO7LCtKY8r85Kz6bmKf7T+FaPP6FGyVbMocJv1WIR0ANAG4YyIBCjeVZB96wux5E0f3W7YTmEVEyMcYYWRux7h7Rpp2/Co7TfzQckjCY87zGtLVrTSUftvtfLqASk4L7pcHB5CsWo0vav0vpvtTAtvuYC8UEhh9Aqiy7m0ARAg5mhcixVuriWVlg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gbuJ11LvjiyiHeAmxVaPXqgB2cuWKI0o5ZvlE4nSWH4=; b=KEGzpvPSpYqxVA5TnB2E2Rl4c4IX+f3Ddu1CIm63WUBazgWglBXeEkoUaI/oTKG/WPKF+u9XRgOv8hmk7axWSmhFQ8i/r66KVAbNgW3zmYljmOxPAmUvldhjtCIwDvw3NDLh/gPQHhI990sgKgBT07NXEUfBq5UXlh8SBVbql+c= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from MW4PR01MB6228.prod.exchangelabs.com (2603:10b6:303:76::7) by CH0PR01MB6841.prod.exchangelabs.com (2603:10b6:610:110::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.18; Fri, 8 Nov 2024 20:29:30 +0000 Received: from MW4PR01MB6228.prod.exchangelabs.com ([fe80::13ba:df5b:8558:8bba]) by MW4PR01MB6228.prod.exchangelabs.com ([fe80::13ba:df5b:8558:8bba%3]) with mapi id 15.20.8137.018; Fri, 8 Nov 2024 20:29:27 +0000 From: Ilkka Koskinen To: John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , "Liang, Kan" , Graham Woodward Cc: Ilkka Koskinen , linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 1/2] perf arm-spe: Prepare for adding data source packet implementations for other cores Date: Fri, 8 Nov 2024 20:29:45 +0000 Message-ID: <20241108202946.16835-2-ilkka@os.amperecomputing.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241108202946.16835-1-ilkka@os.amperecomputing.com> References: <20241108202946.16835-1-ilkka@os.amperecomputing.com> X-ClientProxiedBy: CH0PR03CA0255.namprd03.prod.outlook.com (2603:10b6:610:e5::20) To MW4PR01MB6228.prod.exchangelabs.com (2603:10b6:303:76::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW4PR01MB6228:EE_|CH0PR01MB6841:EE_ X-MS-Office365-Filtering-Correlation-Id: f87746c0-360b-426a-9f9d-08dd00340acd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|52116014|7416014|366016|376014|38350700014|921020; X-Microsoft-Antispam-Message-Info: lmj303yfflY/t0VoaDwOAroKT9Pq4AczTxr/WMCkX9vYMpM1gYAwPEruCHVMZbieN0waR03yRsAAmeyAZQn7qdWj/ytMo+nIj6HwTpSjbq3KHPagqW8mLF+pnMrt3DIbH7Pd7DDIVmJpAiFrFSRb7UZso5HXtUYpiUCkwOP/0J/UWR2Bp/QbmzQTPY0n4LpHozIQJicW21a5UC22MKCrwzNVZaBUyZvBu3lDjkQIPCp3xS4Q/t7FLQS9qwY3QaZFlJ2MtDiniSAuOT0GxVafRB966+9W3s3Z5PEGEP+ANxJZlkqzWNEvRGLubXQG7RzLxOAGSNzzHKGaGAiMQN98t6W0G4s9SCTiSHIbg9wG+T5t1+aCNQeon0UesmVuz28PQLHQSM81McED9cLIwD4D/4Iw3zoQl6NqFwzDa/RnJKucaekg/T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TR:;CAT:NONE;SFS:(13230040)(1800799024)(52116014)(7416014)(366016)(376014)(38350700014)(921020);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 7h2FL0li/CsbThTsQZ7vkQ6IZ4hmzdBjMF/+JLM9hJOmqkjm1ubEVcOTjDWBZqeHkzH10+N3ZeEnfyvoU7NVrCroe3fFNJ2gKXUyWcose9YQZJ3K6Um52lz9EmdWd6N8UZxUuHkH8O9zwsNqxM2XRpgDcegGewcHnqEGbjrHcu+NDcHGqqLMN8lvojD3dN9BC6EwIV4GAmt2Bu2wAfkzAUdrmc2Qj84z+/PlEytow+PtjnxM9KvXnz8OwmnpN3/1g+k4R0NIqLEL4ocz4JuY4SfWSvQHDjAznPn0rDOu66KPRruBv1d28n1PDXmUVTca68L1sVmAwgIyeX/seZTStjUTuMyUsRWlv27xJceU3hafSN1axKstUL8W8/yrYBJURAf2P4ZANC3LmiZSTzpKYM22+IVoCZn+jmRhN5lGrw1ZEL0nWxNKRch9Fob07J3fzA6zGJx1cJd1erFRyKimDTHiSaT3vr6W5dbFPo4lhxQB6vodXZp1amAFkawa58dK5s+VULsn0JLshmVX9FGBM8x+k3Pj1ZM/P0a2W/P48Yla314DtIv/st19oBvmerrcfnlvfY5uuRVWltnzFOn/paIASV8mSzL3mBW9UpCg/91g3QFwaSJ1WrvsZV7tYUxSv1GnydCiPl7e4DBO6EhHgDBDSH+SKsHEEDlixjG+upiziJm+KNLoc2CHIF/goRXxsheZKugZYUJyza7wqBAxKl/SLsGmIzGS7XsJX2zMRHFCoEPKPMLdxz41R1VH43Ivnt6t3kca9BUwptKXo6zvwa9nlDWWxSpJiyp1neCxAYcPqeHzzI0nQyoh2+wO5YYb1+t1uiDfly/bEgn73JOuz1SNxfsepCn/nfqykmxWu+iH/d2L3FuDgAV1oapTbF3DSovj81EjvI1Dn6kt24TMuOvQ/Xt10TmNozhE4re5/sduaGfb9reso1DPOk+4WVhJc5Nlx+OExl68BadjZ1OlAA/XvJ15Uo+mXEPNX6jabq7mDLiZgDQ4ZaFHpoGywD734a3KdUMSjZuRH+u6kpnkqvMjUghe2u08tTWGzuyg3953OTDKGrjZ4txXB7Ucyxeosk6ed/QVaGBVmNQUhLfdP0W7S0oN73wj+PMND9fjwLyYR05TBEhKLOeVGewOWKcFbku82DKq3lu0kQHfykN8k6sPEToCEfk83q8Y7WD69ADoWh7ti5XdLjQiS1FiB4lv8zurHvE/AdZH6M9lb81zmOMYjLALXGPD0M+PQSdUEsqImzQuHl0owrwSH4gIHuDhz7AAcGztuZfOVFraWRc9BqvGrqt7qIOJG2TY5jmLHKv5OcLpg7TEOSe71VHzqZno3Z9V5iQHIFGGvZe/qWQrHiu7K4zLu35hAZEmLtNrF+X8lawRObI3jAjJQLMBNEM85a5FK1nHVW9LH6lC7GPoxILVWdh1C3LeNopjhqpDyyQSBwbiqRW9LKpDAjTayLtOv0ONHgf9V/f5Ys1Az2QWicwsGlbG8PHC3afVDx2pu2RXWV1PRz2TlsmJHfDAROuMue70pf1yfC/4FCe0Q3XsEReDRqEbFt6oFBj1B9zEMDzuDmCsUVgyvEwCfiCp+IsnACoxTHCMyQ8fAJIho/TIoIlmxEVoc+KzbXUPmcXWWng= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: f87746c0-360b-426a-9f9d-08dd00340acd X-MS-Exchange-CrossTenant-AuthSource: MW4PR01MB6228.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Nov 2024 20:29:27.6998 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: W4Ex6Cz0NvygIb6ocCSKXJ3s69ikDJizkrtbTCgjoh+Grf0prXKY598IsmiD35P+ibh5vU/4GWx3mKMbTLi2RQs4UhnQ9CZq4ruohZ6/gXvlerTzZlxqKrOZNGHo+e2r X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR01MB6841 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241108_122941_853825_69BE60FA X-CRM114-Status: GOOD ( 16.45 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Split Data Source Packet handling to prepare adding support for other implementations. Signed-off-by: Ilkka Koskinen Reviewed-by: Leo Yan --- tools/perf/util/arm-spe.c | 42 ++++++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c index dbf13f47879c..3064c3f22806 100644 --- a/tools/perf/util/arm-spe.c +++ b/tools/perf/util/arm-spe.c @@ -103,6 +103,18 @@ struct arm_spe_queue { u32 flags; }; +struct data_source_handle { + const struct midr_range *midr_ranges; + void (*ds_synth)(const struct arm_spe_record *record, + union perf_mem_data_src *data_src); +}; + +#define DS(range, func) \ + { \ + .midr_ranges = range, \ + .ds_synth = arm_spe__synth_##func, \ + } + static void arm_spe_dump(struct arm_spe *spe __maybe_unused, unsigned char *buf, size_t len) { @@ -532,6 +544,10 @@ static void arm_spe__synth_data_source_common(const struct arm_spe_record *recor } } +static const struct data_source_handle data_source_handles[] = { + DS(common_ds_encoding_cpus, data_source_common), +}; + static void arm_spe__synth_memory_level(const struct arm_spe_record *record, union perf_mem_data_src *data_src) { @@ -555,12 +571,14 @@ static void arm_spe__synth_memory_level(const struct arm_spe_record *record, data_src->mem_lvl |= PERF_MEM_LVL_REM_CCE1; } -static bool arm_spe__is_common_ds_encoding(struct arm_spe_queue *speq) +static bool arm_spe__synth_ds(struct arm_spe_queue *speq, + const struct arm_spe_record *record, + union perf_mem_data_src *data_src) { struct arm_spe *spe = speq->spe; - bool is_in_cpu_list; u64 *metadata = NULL; - u64 midr = 0; + u64 midr; + unsigned int i; /* Metadata version 1 assumes all CPUs are the same (old behavior) */ if (spe->metadata_ver == 1) { @@ -592,18 +610,20 @@ static bool arm_spe__is_common_ds_encoding(struct arm_spe_queue *speq) midr = metadata[ARM_SPE_CPU_MIDR]; } - is_in_cpu_list = is_midr_in_range_list(midr, common_ds_encoding_cpus); - if (is_in_cpu_list) - return true; - else - return false; + for (i = 0; i < ARRAY_SIZE(data_source_handles); i++) { + if (is_midr_in_range_list(midr, data_source_handles[i].midr_ranges)) { + data_source_handles[i].ds_synth(record, data_src); + return true; + } + } + + return false; } static u64 arm_spe__synth_data_source(struct arm_spe_queue *speq, const struct arm_spe_record *record) { union perf_mem_data_src data_src = { .mem_op = PERF_MEM_OP_NA }; - bool is_common = arm_spe__is_common_ds_encoding(speq); if (record->op & ARM_SPE_OP_LD) data_src.mem_op = PERF_MEM_OP_LOAD; @@ -612,9 +632,7 @@ static u64 arm_spe__synth_data_source(struct arm_spe_queue *speq, else return 0; - if (is_common) - arm_spe__synth_data_source_common(record, &data_src); - else + if (!arm_spe__synth_ds(speq, record, &data_src)) arm_spe__synth_memory_level(record, &data_src); if (record->type & (ARM_SPE_TLB_ACCESS | ARM_SPE_TLB_MISS)) { From patchwork Fri Nov 8 20:29:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilkka Koskinen X-Patchwork-Id: 13868959 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 18F70D64088 for ; Fri, 8 Nov 2024 20:34:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-ID:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=IrmErlUgJSCq4FyTHpIzCmE72M0GQFr4VFXVm+indVQ=; b=yEHdQk3Ml23J0Eqk3NX7+Tk/0x ShFMoyx5r1K6WMRUdL+q6qPl9FaJEWFSAu4HYvDYv4yTQtf4nnTmMTd0+Ueg6CmCSM03HiP+NJxji tY0KRUnQdpOo8cNVqKo9rVIqmi2yg4NEacYElmFrHnD0Ycd6KVAmCh1UvwAPJPzdqxuBakPawUoZb uRmvHrQZq0DInQXcJ0/8Zn0lkr7wnagWquQkscP+fDVn9Q0a9gjgqH7ocjtgzDJldkLjpA2OfkZAh zSCqewZwEQRPAGcTLyOt2W2eL0kXmZL4szRatHtJ67fbjVMp1FWuy4ubDJ04+1z4w+4Kb9d+tTGn+ fRQAQIrQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t9VgZ-0000000BuCg-0VSK; Fri, 08 Nov 2024 20:34:27 +0000 Received: from mail-southcentralusazlp170120001.outbound.protection.outlook.com ([2a01:111:f403:c10d::1] helo=SN4PR2101CU001.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t9Vbz-0000000Bthh-12Hq for linux-arm-kernel@lists.infradead.org; Fri, 08 Nov 2024 20:29:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=c9QcgqaJzGcitk296IeJ49BLOfTna9BbHdJkWsjR/aiOEneKswLBu9DhAbPSSVwl6M9cOCAQH+smsLGDrx5yS3U9+nJRzK8tFEBvx1zzASPxRrP/Inxd94NHPuODdfSRgxy+J0QueNdPTmRfUppk71cDMI9wucr1MKzXDhVifEkgpyLGryF0tsrICSlk2OkhAcMdtlKo6pRD8WlbjbMyGa93ATNvuCnE5ld6GRe/lod8gCmd+RHHhGy5Y2+eqw6owYEklXO/EMFVaHwPjstYib84lEJ3u+mk5Rdhe+lgpsAx1y3BfxBmD8ZPfw0G2M7IngsduIY7ejlQTR8LqS1hBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=IrmErlUgJSCq4FyTHpIzCmE72M0GQFr4VFXVm+indVQ=; b=oNoKwp989r8aYuhE19wBKssUEYyNxw/6lJUVrPpF6H3Yu1A+GmwB1weBETy6OsVdibLopCF68oOIRC1RroQqMs/cY6WWAb14mXMb35emy2VVMulVMc2oCmHwtfyWpVOOWnErgHLfb6G44dYJ+uIbOaKN0Rno4UWGdlvkA9FQl3AwTgV/Xl5kPJBEXCS84S6leyxifZM9yfpKm67ivK16zDZEbDpGZymYlwIO5RXoctzvGnhjrXdN8a+7XzITEBQq6QPFW/08kSi01Z9DqErDUxZEF6keaceZ+4bUoU7fPNOJNeg/G0oLxeudxL1cHLQHDlg8gNJpJ/dT3nif9bbe4w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IrmErlUgJSCq4FyTHpIzCmE72M0GQFr4VFXVm+indVQ=; b=nBbeDXBBVUQBawnnuMInObBxF3Enrm+BUzBy/qCIqlrKR4df4WG/Bqf4fCNcgwh29j6WIvT/DLLj4A4OzZXWYAfEZtNnbjp9FEZczq9rDZAMui0eXpqQh93eDgGiDUysa2LfOV+Iayc/LVSBBw0ytyWY0gjIW49ARtqPzN58W24= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from MW4PR01MB6228.prod.exchangelabs.com (2603:10b6:303:76::7) by CH0PR01MB6841.prod.exchangelabs.com (2603:10b6:610:110::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.18; Fri, 8 Nov 2024 20:29:33 +0000 Received: from MW4PR01MB6228.prod.exchangelabs.com ([fe80::13ba:df5b:8558:8bba]) by MW4PR01MB6228.prod.exchangelabs.com ([fe80::13ba:df5b:8558:8bba%3]) with mapi id 15.20.8137.018; Fri, 8 Nov 2024 20:29:33 +0000 From: Ilkka Koskinen To: John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , "Liang, Kan" , Graham Woodward Cc: Ilkka Koskinen , linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 2/2] perf arm-spe: Add support for SPE Data Source packet on AmpereOne Date: Fri, 8 Nov 2024 20:29:46 +0000 Message-ID: <20241108202946.16835-3-ilkka@os.amperecomputing.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241108202946.16835-1-ilkka@os.amperecomputing.com> References: <20241108202946.16835-1-ilkka@os.amperecomputing.com> X-ClientProxiedBy: CH0PR03CA0255.namprd03.prod.outlook.com (2603:10b6:610:e5::20) To MW4PR01MB6228.prod.exchangelabs.com (2603:10b6:303:76::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW4PR01MB6228:EE_|CH0PR01MB6841:EE_ X-MS-Office365-Filtering-Correlation-Id: 3df1dd23-d471-4601-bc45-08dd00340e08 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|52116014|7416014|366016|376014|38350700014|921020; X-Microsoft-Antispam-Message-Info: IR1gY6pkPzHHO7ZF7U23W/cgAkpLjVIh7GBpNVqFzgbQbg8wGgmPXq3++lNk1wHt3NP3fCPIzXGEgfUdSFYZawucwKy//3KhsAlA/OlWybnCa6+mRg1XbpUT5SyeUe5Tx2IOlWWZucbGSyRnBA/p9JNCx7YKnuWmnlQjRhOohBlrDBozAebGAeSKIqpEJ7sKk5PX2U6VpbDUQkE4PupCdq43jgprsV/1EgULcLCH0/uby1lKsIUnZtcA82NURycxy/n9BLV204FF+gSTEdD9J8I157hStvk2cATC/q0kE+I90NY4lnF0u9bheyPU8AexOi0ArLQoxA0tEmHNLLZlb1wfMVHuPc0TozEXMKK9c2o8a3Jqi5wpMfOkTkbhvFsEV75n9zwYayXrUDY3hG1cEQGgyLjNZ0CPjdfsF5ws5R9SPYNT9zruvsa7msRQ7rU/vFr7XPAR/9isypmdOiyoFyD2GJskfrK/jBvdeo57OEMLiCwRDLSy3bjBmcJZN5RQ1zK3VPf3a5ynVDC13zZM/Ykk1KY/KOG49ad6GpN5NOpluAh3mlz6yCfXcy9z8kG1JXYDNdj7h+uLYR/9LH005ezoNdw8vL2edqDKJ8d43z5wudq7KShSD2bbT209RMa58MVQ3sx4B3zS7xffxrW9dm6oSC6WAzPKo2Yw0pn7EYj94UNZzWcwcn59OZrL6vAItQl84nvyk1RWsR5s6QEKfEvBHEqZ0YDBh/ONBTWrRehMex9BPcpcC0FB70P+6GaDw2gu+IRIFZ9aLbXuV8uPJPCIW0d1EKKq5PeBcmdwOaLun7zBrq8CZqrzAYgQpgDrYb8VkkbfVlRQhrcCrO4ymxqEaMaHolAm7zPqXKHaldl0dUgLJGhElVUDh2ZzYL1msIGnLLLmzVmWFjB0R3R8w1ZdnOWpQByA1iQBEl8g0kUTu8CGNNnACxtgCT+H9Uv5/lAPzSaRNmeSZ49I/Wv2yo69M1YM3a3ttydbuANc94bLldljQO2VTd/jgbf5y6eA+Au/VGmP8+xSyajrueS4ZqFGm+41zEL6oVyMmgFXc0X+JWUHWGFC8FkXIo0yfnYultsx0BiC5AcqfTh/Uh94TlIogRpQFl6m+6yKVZIFgushyqwWJ1R6w27dlaLZUEiiACfX2d+zuGLVLRHQlHRLn0AKTNoeJ7gLKd+9NppEmIcYUiKCM1JZilr0HgeBHi82deS0aUlK70+olwN2qGuush7AmHpTg4IxoL9gEA3YHuL2vrB3naPqakGgwBj0F/hf98UgzUDzGMk5KYfcwr0JKZKKye/2Bd3SgZHtlzgb72TBCZPaKjPvWcfrBARpQX9bMS2lh7LALTX6PQe0mqBikOBmNEvMi0hecTwYaDTTE0zJ5mdZ+3nrDnta0bQwWsi9 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW4PR01MB6228.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(52116014)(7416014)(366016)(376014)(38350700014)(921020);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: yykkbOqlzvIGv8FOSFfDopY6XEDI2QQSgFd35OVrzOOHgYFMPYMzsd5CwvPY+bnEiWiwJqvVC8aio/e1wCSme788FhsBU8zECNXzOwlSJYhk01L7iMUXphbusd1m4vTxVj971nesiNSZIJseotYgV7BWbparrJshMtVBNE3z8V2HajoNabcpraGQfaPHkWReR2C4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qsu130Rrg9Txco1Ru7GGp0D8pCamiTzys8SGWNMbf/ml4JzhZakkwwoPMyln58XTcswtNMcEQIpKICrIy50gjAK8sDRlV6hIRQu0TuTc5xzs9xjvfqn2OXSKgxa2xlIceB7Wm4jcHcEXcuM0YJCrZ2vN5GRHcDEQ/2PUNGh0GZj2p8A5PXAFyTkySXZbNwxN5yYEb44o0GJDa73bG+UyygY7CLTpF56NshhdrU9R4wX70D9jMUCVWSzpw2gdomsyWbKCmX/4ZIbOF1whX89hOX7PJeI/Gi1oYP//zo25Rw4x7imuRNmHobtnYWgpC9Rs1z6azbWE5STkzgLsatGBOXPdfFkrFqQwjm1Arzo9gCqmy6bhU= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3df1dd23-d471-4601-bc45-08dd00340e08 X-MS-Exchange-CrossTenant-AuthSource: MW4PR01MB6228.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Nov 2024 20:29:33.1024 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 91xGPOCQqwNIuJdmadOB+4iK4AB+VpREjhLoq/CnjWGc2fw6RwZb4novpVVhbRdJ48mIA6kIXHmF9BQahF0+EJjsvn0fZHwCyBuFqLRmkSMuYdIZPWN86EYeEA5FBdqs X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR01MB6841 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241108_122943_301870_6AAFDCE5 X-CRM114-Status: GOOD ( 13.58 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Decode SPE Data Source packets on AmpereOne. The field is IMPDEF. Signed-off-by: Ilkka Koskinen Reviewed-by: Leo Yan --- .../util/arm-spe-decoder/arm-spe-decoder.h | 9 ++++ tools/perf/util/arm-spe.c | 44 +++++++++++++++++++ 2 files changed, 53 insertions(+) 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 358c611eeddb..4bcd627e859f 100644 --- a/tools/perf/util/arm-spe-decoder/arm-spe-decoder.h +++ b/tools/perf/util/arm-spe-decoder/arm-spe-decoder.h @@ -67,6 +67,15 @@ enum arm_spe_common_data_source { ARM_SPE_COMMON_DS_DRAM = 0xe, }; +enum arm_spe_ampereone_data_source { + ARM_SPE_AMPEREONE_LOCAL_CHIP_CACHE_OR_DEVICE = 0x0, + ARM_SPE_AMPEREONE_SLC = 0x3, + ARM_SPE_AMPEREONE_REMOTE_CHIP_CACHE = 0x5, + ARM_SPE_AMPEREONE_DDR = 0x7, + ARM_SPE_AMPEREONE_L1D = 0x8, + ARM_SPE_AMPEREONE_L2D = 0x9, +}; + struct arm_spe_record { enum arm_spe_sample_type type; int err; diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c index 3064c3f22806..12761c39788f 100644 --- a/tools/perf/util/arm-spe.c +++ b/tools/perf/util/arm-spe.c @@ -455,6 +455,11 @@ static const struct midr_range common_ds_encoding_cpus[] = { {}, }; +static const struct midr_range ampereone_ds_encoding_cpus[] = { + MIDR_ALL_VERSIONS(MIDR_AMPERE1A), + {}, +}; + static void arm_spe__sample_flags(struct arm_spe_queue *speq) { const struct arm_spe_record *record = &speq->decoder->record; @@ -544,8 +549,47 @@ static void arm_spe__synth_data_source_common(const struct arm_spe_record *recor } } +/* + * Source is IMPDEF. Here we convert the source code used on AmpereOne cores + * to the common (Neoverse, Cortex) to avoid duplicating the decoding code. + */ +static void arm_spe__synth_data_source_ampereone(const struct arm_spe_record *record, + union perf_mem_data_src *data_src) +{ + struct arm_spe_record common_record; + + switch (record->source) { + case ARM_SPE_AMPEREONE_LOCAL_CHIP_CACHE_OR_DEVICE: + common_record.source = ARM_SPE_COMMON_DS_PEER_CORE; + break; + case ARM_SPE_AMPEREONE_SLC: + common_record.source = ARM_SPE_COMMON_DS_SYS_CACHE; + break; + case ARM_SPE_AMPEREONE_REMOTE_CHIP_CACHE: + common_record.source = ARM_SPE_COMMON_DS_REMOTE; + break; + case ARM_SPE_AMPEREONE_DDR: + common_record.source = ARM_SPE_COMMON_DS_DRAM; + break; + case ARM_SPE_AMPEREONE_L1D: + common_record.source = ARM_SPE_COMMON_DS_L1D; + break; + case ARM_SPE_AMPEREONE_L2D: + common_record.source = ARM_SPE_COMMON_DS_L2; + break; + default: + pr_warning_once("AmpereOne: Unknown data source (0x%x)\n", + record->source); + return; + } + + common_record.op = record->op; + arm_spe__synth_data_source_common(&common_record, data_src); +} + static const struct data_source_handle data_source_handles[] = { DS(common_ds_encoding_cpus, data_source_common), + DS(ampereone_ds_encoding_cpus, data_source_ampereone), }; static void arm_spe__synth_memory_level(const struct arm_spe_record *record,