From patchwork Fri Nov 8 01:09:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilkka Koskinen X-Patchwork-Id: 13867383 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 59A23D5D695 for ; Fri, 8 Nov 2024 01:12:27 +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=2Lp1zyDQwLkVqbaOZmQccSLK+0L8r2SK7hhIgVY3E50=; b=Qlg6H0TzrxMleEzhigYLS5RK+J NPYi9GD0aGyrfPGL0GS+/7Di9oACxncG2cTNLVlyO1mpRH/4tEWu84lkOtsxE2Am6uXkuDMdrj2ht Bul5tUxWr6X4NdNMUFpP6BUGquD8TdFIkBbM958VhMJHJhp5Zv3KdLkPAH1ghcsfY3FDzmUiZGgKy 5KlXlC0jiKxAFHMwJ/2GXnbPOFaNHmPFHf+GYDy7F06PQikgX51RCTwt+XXZtkgd8HW37UJRUuzoY bLBKEpIHNITs/RtL+PNTRLxpewjeLHm24lX0dT2fT3/PvMYZbS54LcsTl8PHbPg58Uhw7kV5rp34x Us9PLRgA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t9DXr-00000008u4M-3Dlt; Fri, 08 Nov 2024 01:12:15 +0000 Received: from mail-westus2azlp170100000.outbound.protection.outlook.com ([2a01:111:f403:c002::] helo=CO1PR03CU002.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t9DUW-00000008tkE-3qdi for linux-arm-kernel@lists.infradead.org; Fri, 08 Nov 2024 01:08:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=F5Fhj8hdbPvKM+47fE7nRw15nQuIO3yAmRd2wSEsu91qCFbJmMg9rYnSOMFD2H7AwCozKetT2x1/iSdQrf6newBmy29iaFChsOf34RzsLkDqh3UB6061VGcCk+4cEaHaw5X4fW+NpOL/ZH4jgIcmOnO4Oz+GNzG1cDxoHa/yweX9aV/ZJ94EU7y5fA9EA+ksu49Zl1SoKOPa823HWvDigeC5VKBmpA5K3rkjGRD3+JkR8lro6bM3hc12Pp90yJTN/Lspc4MzO4x5BnUcch0GdSSEt6xtjatw8JEIIaeDDJI11Rzlk97CptPNuBlYy87XK191+dzKug8K/qAdEKyuZA== 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=2Lp1zyDQwLkVqbaOZmQccSLK+0L8r2SK7hhIgVY3E50=; b=mtavcby/75DNf2EhJcwC6s3JfYHfg7gTLn8PQnuoqMEvMz64lXEeKDRegjJ+IjvfT5lJMbd/StZYCl5KVU745e7B8XZsRN3thEVhXo75eDeN9FH1Ox9g47mSoJuXJgzuGJAFXWGtRRer3qpLE+HdZWl8nnHEylKe6I/tRGDhrNaBK2/8xdTwxk/HiqNCB63/MxYKP4i9j94ruSnJf7Am+0b81WOcAb5s1uSBRqObxaSkhj2fOoO57awTA12b7OHSa2BNo1h9+mmemMP0bProHk+josFiVwHt9HxnbBzogmtHjN38Mgg3qtrbx0npqt1jMRxjRMckG6y8itYbeRPU/A== 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=2Lp1zyDQwLkVqbaOZmQccSLK+0L8r2SK7hhIgVY3E50=; b=jtXA31u6ztT1ZrUvIfHst6a/rBFF+5gtPNlfj3cuIza8C877RD46bwSLDaNjnvIIoigB4nSrPl0emk8gABg9ROxVk+RYjHLs75UaaUgNoCYa5XW3IvEUTvmDQS8Y8DagjA0Eh+wr1DCXY/ERY5YaH+qpF0jIvnFzT/Ci9Y0Zn6I= 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 CO1PR01MB7385.prod.exchangelabs.com (2603:10b6:303:158::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.19; Fri, 8 Nov 2024 01:08:43 +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 01:08:43 +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 v4 1/2] perf arm-spe: Prepare for adding data source packet implementations for other cores Date: Fri, 8 Nov 2024 01:09:10 +0000 Message-ID: <20241108010911.58412-2-ilkka@os.amperecomputing.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241108010911.58412-1-ilkka@os.amperecomputing.com> References: <20241108010911.58412-1-ilkka@os.amperecomputing.com> X-ClientProxiedBy: CH0PR03CA0366.namprd03.prod.outlook.com (2603:10b6:610:119::12) To MW4PR01MB6228.prod.exchangelabs.com (2603:10b6:303:76::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW4PR01MB6228:EE_|CO1PR01MB7385:EE_ X-MS-Office365-Filtering-Correlation-Id: 88c7d393-e480-4935-8ad8-08dcff91e370 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014|7416014|52116014|38350700014|921020; X-Microsoft-Antispam-Message-Info: B9fAJNDQZJM/DXiiB9+JAZZ/KalGsSvxqTRWtTEgR2mIxgwehOfG4KHuYEpNBQvg++b6P57MyMd6axTThAflFT8cyEMxp2eV+X00VmiAq7BIyNApgf4sUQ4raI2C59Un5emQNOH9rnrjXbVXt2U397N3gtNy0whab8jYXN9kSkhXPbD/u9fLZwkOuqt3jp87+32Q/b0WBvnpUhZwZUkS7ED4aGty9a/KbSCZrC8RrJBTvkPIptDAXZbCzqNGvnozPJt9ilpzYZjGVHBQ/NzFf3kI2g1ILGAmQmObxH7fXD5zHaDeG9cFw0tfOAv0+YCME3B3C1c7b1TkcsCFRHSRPmWgJ+UjfROGDIABFdw2rWUZF9abaKBdiyT+WXs4g1uhuzhfhrOm7vHLcvqUi/2cjhoV9v4hoWIjyAKmrYXf07w//i8Hp0//F+EYXhQgaPrClnZMdDtD9SYwnvqQSNHAWn8vRM58onCCVA700Sp0wQSE1RQx0O8tqviTn9APvc5FIaDQW7B29dX7CYp+UvGc2lyCNm2ANYjUDtopyOUqUMRx/1DgUfSZHxBPCy1fYK/65+oOp0e/sUNk3GK8dIrq7jg7To3r+bmsFAKcHTCM9qH9A/5a8rdkKWRUtzjQFZ8JOBq6iTwVL+SvIavZRjsH+wkWz3XUeB3u5MCkplEQfCiHIOXBN/Leym7ez8V9eSi7+MOJpGf4pFQUHYRSCUWt+bAEu3QgAmTHabYgxc+uE4kJKPI408RX74Fe6kmW4ZKsFhSJUsMe+QAzY4t8jQrt9qMADQzDSU3rvDw60UoH14CFUXTPSVPgDzRsaQM7r4XTs6A4RxjPkySTyEf5yKJ9eaz/elEEnolEJXDNEk9WlM9BNLR1iQhmH7rcE0eM3LgphlnImJ4tlKVWP3qQCny9vkXzUO6W42/Wqjo2LCappwI0eBE/yo2kVt0SSjbwTg0GtXSSds60GcQNcvf28XaPRb6Cbo/jiUijkBoSSIHSSBSvPufoutSO1FndlplPjO/EXbThodKqkSQ78kSY+xf6j8WbJ0nUZXegsxWrpvX3o1y3ZV+CuJEdkLuYSc2dZVvhRu7Ub6M6/eqbw+gsZw8wwhD4aOny0Mb8eqJnbM5vpFmlRfEBtiS4+CBVnYGHAlzjgHwavpz0ItxupZKQKeRlGfUvIxYzIar2QDCTXPXNk62ytHjOA7i4CK+mGlg5BLfsbr2RbJXzCKs9xA7l38OA02LqBxPslHAH4ZREo+CEnwaUtskL723fGT9J1FmMNkxOwKxSNLrTqO6tFKk38f/eg/KvAV3raex5j+dbCYNLuq1qnP7D/1e+vOcdIXdr21UlTskZZv8L4VKh3LmLm2OhHtuoyvsjczZQaLJUWhjQ7UwIYvUieTDxCUdPPHLiwtb6 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)(366016)(1800799024)(376014)(7416014)(52116014)(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1DnwJaTAHWLevawMEDRjsPdarAR2mzX+BFPmo2FynzxBfzAVg+bvxYoBBrHjdgYny9/sl3zueBZfRy+uT7b5IcEYXAJLrsmFVybuIfsv9eN13zAQbT/dVks3s+eOJtHz0sLu+Wx+xNXF89QOczYf5nxwqBAOwcvdOgpIu9kvfYbL4IXG6DeR/0PmaoLc21y4K/xDgqYT8zYRQGa2L5GT6hJMAgL2QomU+OIvXtC7gi6/lnMyq+1R+OoCO9UORwBVcJnDTzQIl6RjulxzkZo32xaOqy91mQBPYTdVPRYOGeLtF6N56z6CoTuOWi6TTo51XK1+qxKpElYIv5bD/nB8AdX1qnxfgmPFFULNxV7blIRr14NrnbthRPukjA22FW7oOk2l/CHJnfz4rrK9NukwxzLaSWIlmRy/YaxussR8A5sjfGXgSSW9PmbnpGQ0g2+U35hwnmKfQNyal31GoaWjNklgb4SXNnkkqXB34ot1MpMcfPPXL0S3GxVpdt70G6cuLE0REuKuDx3T8GqpGecviO+/7Kdm4dOPuT2a5lN8HUQ8pCSXM1KQtF5afn2OTCvoLRBxckyEe5xIuvjE4uLjDfFS3aAa3wzr2l5efcI1AnSVakKiSqgcaTAhAK+4gNldGfMj+dygTxmpgPTwI= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 88c7d393-e480-4935-8ad8-08dcff91e370 X-MS-Exchange-CrossTenant-AuthSource: MW4PR01MB6228.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Nov 2024 01:08:43.2271 (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: iBlkgr8/TEEvQaLIIca+6X4kF27KvuF8XdvfGfuVgUTQoSs3ew5B4POJGtjyx4ldsmVlAKJV2LCD8d/iQDKuob8MV/uqOxfzJFoflJJC8riOjlIzv1Q3vZECiGuV565G X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR01MB7385 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241107_170848_982545_F5033DFE X-CRM114-Status: GOOD ( 17.05 ) 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 --- 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..dfb0c07cb7fe 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) { @@ -443,6 +455,10 @@ static const struct midr_range common_ds_encoding_cpus[] = { {}, }; +static const struct data_source_handle data_source_handles[] = { + DS(common_ds_encoding_cpus, data_source_common), +}; + static void arm_spe__sample_flags(struct arm_spe_queue *speq) { const struct arm_spe_record *record = &speq->decoder->record; @@ -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 01:09:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilkka Koskinen X-Patchwork-Id: 13867385 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 4FF5CD5D695 for ; Fri, 8 Nov 2024 01:14:13 +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=sx4yuVRUqEO4AyisEW0Rb/Ol4PtWENkMerlyl6CPBnw=; b=4e5VoQg+U4h8dzruu3yTbf4WBL LJJ93V4HdBeTiTUbNpkW7TF+Sw/me/gGrBjzaoQZpshekumw3+2znhzNyT3cQGnCLf43U5GHgaz1v D5VHbATMw2W4JriM7b8Wj5xpp4DGS7z2selQZKCftny6gYGO4F5orD9jB219x/xwPY8N4wXbSBAe9 yq2Ta9CMrmlIoX9mNvwiiHNxOliOq0nrLQgQ1/icS5wgBuk32CFzi7eEB5f8CbyVvxR9Q159BIl5U K0vjkej6XXoXNgq0hplxkDE1p0kFjxZ0bT0X16nOGoWWM+O9qSd8R114M3FZoagTHzjq7ghNyJycn NnAVp6tA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t9DZb-00000008uHo-0pGv; Fri, 08 Nov 2024 01:14:03 +0000 Received: from mail-northcentralusazlp170130007.outbound.protection.outlook.com ([2a01:111:f403:c105::7] helo=CH4PR04CU002.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t9DUb-00000008tla-0hOk for linux-arm-kernel@lists.infradead.org; Fri, 08 Nov 2024 01:08:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=biN7auLD5/Pia1ivi053PsvotFS3hk7M7gOt+pHGPf9qoEOLthWPHbyrfbLVOMsRE0i0DAYiSPdP3BsNFVupWqdiijQs23e2uE69rz/eUESnuqz27NwWc7RAE4H2VECii46uQQozZmVxgT0qEwcB37ZKA6n3y9Kebt3T+fswsv7gM7aAUmZDd0d4L7vGCqFS/x3uwBugGuguwwVo9M+HtaxusBatgNG/zaYZTmXTYxJQQpxEN2OX5rrrTyoxcBxKvvm2fSoRxy4qch5HtfcADzzdklrqW9qQyAfkaIeHkn5HuuTPtI7qmDfZxuMEMqCaVuXmCtR/Bn0yNOKCTiXhaA== 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=sx4yuVRUqEO4AyisEW0Rb/Ol4PtWENkMerlyl6CPBnw=; b=jLWcAAz7ahj3GRrhYNhMCZboPoDD2rr87r+qr1SrXl9nIEnXjWhVGoxs0sn1jqMPyStz+LlYfOIGf+j/py0KOU2PptKBms75N7t8nELgNJGS/cYLU09/o9q1yjTIM05v5dmUZ5ItUVCXegNKflUqDA7lLjA5ZlAnt3n8eAfVUoo1y6iHelhdaEryVxvc1wTs2YBEA/bQDGLUYim0COSAsUKafHA8jP9hb2nhgJQXjCwJ0oh9V7zSWJWEpwH+TsuK1MT+OCFVKZsXUp4HPnNLkHQvcJYaGlo2bqKWXSaO3VrqIrL0Dk2K6ZlwOIgCVUzJVT0farxZMnIHoOiKMyLNgw== 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=sx4yuVRUqEO4AyisEW0Rb/Ol4PtWENkMerlyl6CPBnw=; b=n/C+C0OgQgRS3FIRJTNXO85Djo+3WfJ4vcJ+UCXKl3V4uIhGRQI+dIKQHmHMEE2xPM7a8E3wFMrehCNERjDVdk3o2U9O8TNYRT/Hc7wooQwE/lzlJ74o7kmL15zraQi9xuyZRzG/uKEbJX7E9Q/UKEaARA2bDVFP3iopfg5pNlA= 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 CO1PR01MB7385.prod.exchangelabs.com (2603:10b6:303:158::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.19; Fri, 8 Nov 2024 01:08:48 +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 01:08:48 +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 v4 2/2] perf arm-spe: Add support for SPE Data Source packet on AmpereOne Date: Fri, 8 Nov 2024 01:09:11 +0000 Message-ID: <20241108010911.58412-3-ilkka@os.amperecomputing.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241108010911.58412-1-ilkka@os.amperecomputing.com> References: <20241108010911.58412-1-ilkka@os.amperecomputing.com> X-ClientProxiedBy: CH0PR03CA0366.namprd03.prod.outlook.com (2603:10b6:610:119::12) To MW4PR01MB6228.prod.exchangelabs.com (2603:10b6:303:76::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW4PR01MB6228:EE_|CO1PR01MB7385:EE_ X-MS-Office365-Filtering-Correlation-Id: 2ddda937-3b49-4a32-01a5-08dcff91e6bc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014|7416014|52116014|38350700014|921020; X-Microsoft-Antispam-Message-Info: 9/2aQVweG6X1Ct2+ZhCSQ/kFrP6RBSe6n6ktoUlbq1aSOftnhAn2y67x+KwPAMimueefB+LbSjNnLOXuG9W+3/a787e4/X+AyVXBWEV9ImzhkRyV7qem4pyvlKV+ECIqglu5mi2h4y+HggZKruks/SpgbDanEhlosOYeBtLArIQxQzs3W6MJ3/j0QFFHplZxJiT6pMYWb6h/NIxaexHHvA2FZMMIu8UB2jmM1xVj4z7ymrzAcgurNZqHfFdOJLdoQ+Z1rnIOYA46pNKKxO2Mnez8ZOU5NNUwEYa2+ppJ3A0RaUIAWLIxaG3CDOXrDXQ9Apa6IPxvOuV1UYczMOtyrLGeJ2PNm5hKL92GTxgp5AgwqmG6BQKqLDgeEDem+yvQare1CxdTKEAvMS7C0f3tRolX/DsfIWjHqQ5ph7g4gfg9Y0vJQFB8Hy4W2w87zwT1V3BDOsZqd1ev4M5LwNgiI/mXNhr0aRtLk2znRZLgdkUcyCOXzYlRGn21n+Vlzaf6T9rTcqCA+5kgK2B/NuzXuXKLTg8LFdT6ert3eBiBlMxFb8T7/lyG91cA2f23n3w/lHNTVvZseCvdh6g50qJHyxaHiQhwmFWrsjcfA3d/OoqRotFMcamMAYhM9Q/r6iHqkDSOeFGWC8VivqmIOYBpRTHqybyNMXxFw6DFLm8svK24P2MsFXgMKfXgbcrAbtITAfS/D9kBl/Xk+MWLCu9VmKIn7v7AAH7tbt84U6A9a2j+iylW/MyqtTKR3elhSRFYai6Yn32L1lGicepLAhkolHxyps+BxWk++dpRAZYOs2Mo1y4AkhQpIUW4QmUIpC8FXkmfz2+tbY07Jeixhfe2ZW26DWMxT1aJ1H+SjOlsSOadqQ5bnaw6nIJQfJHLNVmeQ7fIL4ltL/52pVByTuk//bl5EPbC8zXY6tdkggO0aZPAQ/wPMUGNm6eGIAlYlScOxokVBY2T7iFbSbwUl4qx1mpy8FCFut6lCsx3YF3VkX2xqJn7TfY8r93wdEGED0TPxAWbYU2luDhW7KcLd2DnTBCsLIDIZnhdfajmCQWbcFxjOgEMmFqgHwjLRS04G+x7nAm1bAlqvxqaDyQQaUanrEMEPoFDy1eb7SPo3YAG/5+A6S32mLx8ligBKn11UicTWHsEBHvlzNLGleMWItVcj0LQzVaIdJkYPxJreBv4tfnhlp+j6WXqGuk2ZBq/uTKLj5iKcRc+7xrw5rMEAXd32JWgdqAbCd9sb7lujzD9E027x63LSyZBZGm+scOekVyjrj/yjcFup32NEJ0KU1SneEX4Jw7tce4MD7jGoJESODtB4p0EX+bU/wkGMP13UgJIe7VAmwohAasIuHQk+Jx7g9cO6EnvoH9KYY119LqPFhTwdhjMS1rmwZ07tJC2mXIp 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)(366016)(1800799024)(376014)(7416014)(52116014)(38350700014)(921020);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: IXAOS9Xq1sQgLFZetGX28Q4E6g/96UywD7zfVd9cnyNOuJ1sfyx2Q2yDm2JC3F2vYWQU1nxPcgq1YLPRey9aKCVuGVG9jUmbOMklllQ9tOIAZ2on+DpUvagGXHGWKaaElKrFxKay0tCx+4/ag2M6bXfWcwRyTk8M9mzUOgJRSY1oCjBf01SsHUx3vSqHgcZo+6zrhzTIrDHMEVWlC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LO0czYrlVn6qF5ECwXbZ36v3F5ucUfody0ugadvHsmplWlh0C5sC/SQdxFpaS1kPMO3NYnZuYCcieHsvLIxOZQwyBFA1GO4TrPqgs2QLozUKK5UP35wUb3fAJzXkBT4Syekh7zzdYzYTlu57pcmxm7cU9/SPRe7Y3G4suLfIg2LL+uOjX7tdNLFtX2RIic/38Nz0nBnzmrkCzYouIttAm4UZtPkn/ejzUIOMlqyCg8a9yjRjIDHU5bwtpMFmgyIHE+qEs+G8OqTOkoWIfZwSEhwKZxx8rE5YOrI8sxJIVodd1TS3fyMuu3PsCcUsvajStH609qJlt+JdJ4sRILDaz8rwp2L404T4= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2ddda937-3b49-4a32-01a5-08dcff91e6bc X-MS-Exchange-CrossTenant-AuthSource: MW4PR01MB6228.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Nov 2024 01:08:48.8423 (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: 1Vua2hu1KGj/6jE30bqgQ0FKsgmJm+xPhmUD4CJh2j+pDbg3RsjJsg4xF8Q7sBhnbDoFbavZsO30/nCqu5NlC9HYdZpa6h022QcuyAyGwG96BNDt9Kpnik/zRheuuIjf X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR01MB7385 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241107_170853_234498_2EF57D8E X-CRM114-Status: GOOD ( 13.46 ) 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 dfb0c07cb7fe..df84933b673d 100644 --- a/tools/perf/util/arm-spe.c +++ b/tools/perf/util/arm-spe.c @@ -455,8 +455,14 @@ static const struct midr_range common_ds_encoding_cpus[] = { {}, }; +static const struct midr_range ampereone_ds_encoding_cpus[] = { + MIDR_ALL_VERSIONS(MIDR_AMPERE1A), + {}, +}; + 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__sample_flags(struct arm_spe_queue *speq) @@ -548,6 +554,44 @@ 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 void arm_spe__synth_memory_level(const struct arm_spe_record *record, union perf_mem_data_src *data_src) {