From patchwork Fri Nov 8 19:11:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Steve Clevenger X-Patchwork-Id: 13868943 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 EC74DD64085 for ; Fri, 8 Nov 2024 20:17:07 +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-Transfer-Encoding:Content-Type: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=uOO1qVYCues0e8+cZFU+gLopZinUMHkaTDINMMJjlRQ=; b=XxeskdDh41s0LZTM8k2JiYBvQv dduiK/qCi1nIzmBMycROoVQYzkD6JHu2YjGBjoikWViCLjE/ZCLDazWApDw0SwqY8eGlyVrzUhN+I eoEqM8jzSDJSBDQ/V39zZoDBppV/+kKY08ndjQ2BRF/a5bF55d8MImn6jVrdGpA+/di3/z/PBrcgH nvJFVjpZawtthcY6Wbn1r03oYFzHvDIGqOL1FmuIlAcKgErdPWSVJcPT1gFJA/bS6BNBtBusgEq5B 1HEBs/osZLSXqhqSRFzhuS/qIX8feUiqVxYOiRHGJ92nRZsNKHTeg2fX6ci5Mj6SjjPAX7Kcsmmry 8K7UMGWg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t9VPd-0000000BrMT-1xAI; Fri, 08 Nov 2024 20:16:57 +0000 Received: from mail-mw2nam10on2071f.outbound.protection.outlook.com ([2a01:111:f403:2412::71f] helo=NAM10-MW2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t9UOY-0000000Bhs4-246v for linux-arm-kernel@lists.infradead.org; Fri, 08 Nov 2024 19:11:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Olg1NCjfJJnErTC5Q+0d+bFHUXUrX4ONb9y7GzvS+AqSw/qqVSZJYhMNjVUs0MNxkAP7EXIHrepthhqBuwpzzA9lGuKTUbu9fjgoS7XaPvu6gXEv4QlSlHkojsRp1TKa9wm18ZHthLJG+41keD+3DsWiociIMPtAq7piHwzInVK/5e+vU9917NarVulbctKmH+13jIvSlG/5ZBPHm4b878EWcC6B+JsU/DpR+ULcLWjm278oGOvGw3ftJm/NGfJwCTCXJszZVRQCHG0w8G8C4OJYXPmgN9Tg3y1eqo6t3mzc5xCOHkQqrXf5zt1sJP7hbOKNjl1YUjn77eZ1aXdDMg== 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=uOO1qVYCues0e8+cZFU+gLopZinUMHkaTDINMMJjlRQ=; b=X6VP1sLu32trx6D7bKzMNe3XvwnQqCJL5Tf1/b0fS3t+LYN70UlL18NOVvHjVKkm5MiVKvpt2VOWoRJ2RzhnPZU+ipBc+DBwuyYnHPObaGCN4JDb9lFJp/xcs05rlYFWHpAyLDk7CayNJuMsB0opBOU4YfWU7q2ccPHs7zXD+5NFK8Prmd/W4206fDVgHJI51BRMISrygqTn/0iAxYOH1wFbQB4f1/bzSfZEuBGafK0CSOm3gVu4vmGhjLoswKVAkXwzAb7uXnEsAaaQevIbTaz/Xwh1/bUiDrXxoYVPx29RS7VOKvRWZjU8wqNaw4r0L0eFcyFABqCYFLJI4uqVMQ== 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=uOO1qVYCues0e8+cZFU+gLopZinUMHkaTDINMMJjlRQ=; b=u9n3T1kcFK2/dcuc4VD7PMHE0CJ4Uf7ar11rHGmOEMmR+JhSgZh3sDFKIynl6ZLdWKAe/8qBz+OA2LalG5HK7uAO1oUhOrNi0QjZf7bdPw5GeDaIktvEEI3sGocyIglMwKjgqX2O/eIuRWbB7e/zyHnDjA8PVIlM4+z+G9D03Dw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from PH7PR01MB8146.prod.exchangelabs.com (2603:10b6:510:2bd::18) by BY1PR01MB9089.prod.exchangelabs.com (2603:10b6:a03:5b5::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.11; Fri, 8 Nov 2024 19:11:33 +0000 Received: from PH7PR01MB8146.prod.exchangelabs.com ([fe80::2972:642:93d1:e9d4]) by PH7PR01MB8146.prod.exchangelabs.com ([fe80::2972:642:93d1:e9d4%5]) with mapi id 15.20.8158.007; Fri, 8 Nov 2024 19:11:33 +0000 From: Steve Clevenger To: leo.yan@arm.com, namhyung@kernel.org, james.clark@linaro.org, mike.leach@linaro.org Cc: suzuki.poulose@arm.com, ilkka@os.amperecomputing.com, coresight@lists.linaro.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH V11 2/2] perf script python: Adjust objdump start/end per map pgoff parameter Date: Fri, 8 Nov 2024 12:11:17 -0700 Message-Id: <21ccdd22e664bdeccb878672d4b2c0518873c1e5.1731027120.git.scclevenger@os.amperecomputing.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: CH0P221CA0036.NAMP221.PROD.OUTLOOK.COM (2603:10b6:610:11d::14) To PH7PR01MB8146.prod.exchangelabs.com (2603:10b6:510:2bd::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH7PR01MB8146:EE_|BY1PR01MB9089:EE_ X-MS-Office365-Filtering-Correlation-Id: 6c0edd92-bed4-4ba4-f316-08dd0029289a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|366016|52116014|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?ynDbhR5pEMqOVjaHRByog3mjccL9WqQ?= =?utf-8?q?mPe2ppdCHa03dglhV8yr+mkmOTYL8YPLtKj08cjJS9IiQhzBhZv6zXCUXw+/CnU11?= =?utf-8?q?JEzpFhSNjzeTWSIv8WQgGWTc9Ub7DndpmMzkOCTDGHsxPARopfH2R5t+oXQ1gq7wk?= =?utf-8?q?7sqxqcInW9ohnKfuK/sWKEnJKDbsfYLwYyPnhUaa6zyWYRiM4th5r25WCLjgPKMth?= =?utf-8?q?STa7GCAY+R7UZNELy9cQJBqOPRjpELInLsAEFtljcdVSwlhxXxOQF1jfosp82QEi8?= =?utf-8?q?mO98mhWFzMNE+qg7ILBqZE74l2zJM1VazkCV5tgq+LCqxlsuVrnKF84WtjeJ+BUjQ?= =?utf-8?q?9Bw6RUBDfOv2NcPMGTgDOcSHrXd9ghIUQ9wJe0ap4wi7/ieRfJtXT842QkuiYu5Z+?= =?utf-8?q?VOrY++QKJvU2cihQFYyrygekoDuGLVnPBxa0NKKqRIZ+dzi22f2rv002secEfx6b+?= =?utf-8?q?c+0X8xmz45ZxTNCTIHegl8lriESrVqhYdKrwo351JURVylHqfglZB82ucViGZa1tK?= =?utf-8?q?62ZzlnAwhjO5TFrH8zjdsLK2MnTVRI9ElEoEtYSfxLT+p22wXojU0d+6m7EUjVBL8?= =?utf-8?q?5pUwfhZW3HVQZGIooFg2jB8NjUpMqBv2dAPNYtroTjI1nnfV/1zXUKWzq7lJX4Fxs?= =?utf-8?q?K14STwIzCvl7AD9rc178zATHg3seB5F+KUtjeJwxBDfnIQN3MzzI5rCYGv4mXMBxl?= =?utf-8?q?cfj4pce/RWkfFgXLLuHFLFwAxABN3NT02waxU25LooaZ+puFZMa3E+Wuzpxgkt+re?= =?utf-8?q?/pXviqB9jxVWYIhpkj966uKCJkBXM9BO9Rs/4a2jteNlR4Cn7Mz5N/6mn+h6XNzUz?= =?utf-8?q?a4M1vJCY2GETHqOtKz/NpoOjgiYFwLRM1M1LwowAQD5y7LE3Vb80g/9nBIbEuSiUf?= =?utf-8?q?519U3MAjQJlZO5f+iTMpeE8D5LIbG0GnVUGmulRRXC25b5dMyrmAJz0meOw3u9ZoH?= =?utf-8?q?D+rB0YwBX75huz08VTedlSCZ9fJRF1hrTAVdJTox+IjR4lssUYV4VW5RHU4PrpVqB?= =?utf-8?q?96pihP6W5OhqEXD2pJX90LQrABXlPeHu441kKpBvkeacz3v/fvgPpuURCve6ZJcwj?= =?utf-8?q?tMydU1NWXK+cpSc/48YMGwlC2Gag6TXrt3y7q0jgnf0xLGTeq5OEzfOPtPxDaTw20?= =?utf-8?q?acUOVL9WhSeRDRR2f7pdc+YnA5G4yMrA69lJJJ2zYGBmVqzi+wsF7VCdAYyA84829?= =?utf-8?q?yZrVPlEbgZiQJ+e6VPBUYRdcjpnjQn7KHNo+tRa0WTShyzUw20IDBjg4WM//IrNCt?= =?utf-8?q?FDKsmBVc/KO81Z//1EAVGWjHYtUPzAM/vcjepIhWBvn18pUBiYjYbkVg=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH7PR01MB8146.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(1800799024)(366016)(52116014)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?pOPLaF++v/H5+PKMsZGjSdEPAXgi?= =?utf-8?q?exGqwCu2qlM4m1kz9D1Q6CZDhbRtHoFN4rhyvzeGy1ZQFE+WUL69rJ9jtbx6m9nTe?= =?utf-8?q?IDXbiLa+sRRmZnBrLvn78qKvgewswbGcYkbGAE2W4k/uZ7Nb+Xu4Ax8GY0566avBs?= =?utf-8?q?6p5yCMaf4rqTu4lpFsOpaEv5kjq78N2r2ZLHhmrPG8tBBNFITrMw/70H1/kPugmkv?= =?utf-8?q?8zni54HYvRUxvXTM4zg4ZFU48fSIuhHB73u7UkkpdW7DjQFZU961qHqOo2biVsw1G?= =?utf-8?q?FOoS/I4CvK8n8/LuThZ8+qt4VoKuaoMhh89HwWqV4xj0n8kDXMvoDR995JnnVIQNX?= =?utf-8?q?AGH/4czbZELSEd0AB/gV9MJ9nWIYxz3RyQ753E1V6+RBehsyTHKNTjeKBLqmIleVD?= =?utf-8?q?VfYyPegJypbkBWXWAepC3yr+dRk8Yj92PgS3JePd94u0AtEFS89dSCjgQppINkX16?= =?utf-8?q?7Ve11ImZCYRkz2qe0SjkSyyxow+Mli1LAcKiTcfIurkrQgj5d6uS8zbnjRCG882GW?= =?utf-8?q?M9N6m1w8pjTW+SLNh4XHu57JsutruoikXtFRtlbTeSSvpASUt47PnTbEUaxThy8CA?= =?utf-8?q?IXLtdbpIAIpMdPTYNsc3xH4SgqIn9Wgh5+VeESyBwa2Lab3a5vr1jQuUDulEjv9g1?= =?utf-8?q?ISvd2d6Toc1heue7rYJddtqj84TwPsGJtYaQPqz8ghG8fWnG2aX0Fci35U6Flf/L5?= =?utf-8?q?q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o?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6c0edd92-bed4-4ba4-f316-08dd0029289a X-MS-Exchange-CrossTenant-AuthSource: PH7PR01MB8146.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Nov 2024 19:11:33.3631 (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: RiSAmFGd5IuzuYhCSXMGxBM4VbhuB4lcC0t7AK0PyPphj5doTFmu2zjgCgQEpO9cPUgVJiDLMEGa3LrP8r1YI7T4UWwXVaTrR1VmvdvYJla6Fklet2TFd5fEPS1qni2l X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR01MB9089 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241108_111146_706964_33F8A5F5 X-CRM114-Status: GOOD ( 11.14 ) 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 Extract map_pgoff parameter from the dictionary, and adjust start/end range passed to objdump based on the value. A zero start_addr is filtered to prevent output of dso address range check failures. This script repeatedly sees a zero value passed in for       start_addr = cpu_data[str(cpu) + 'addr'] These zero values are not a new problem. The start_addr/stop_addr warning clutters the instruction trace output, hence this change. Signed-off-by: Steve Clevenger Reviewed-by: Leo Yan --- tools/perf/scripts/python/arm-cs-trace-disasm.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/tools/perf/scripts/python/arm-cs-trace-disasm.py b/tools/perf/scripts/python/arm-cs-trace-disasm.py index 7aff02d84ffb..e29a4035723c 100755 --- a/tools/perf/scripts/python/arm-cs-trace-disasm.py +++ b/tools/perf/scripts/python/arm-cs-trace-disasm.py @@ -187,6 +187,10 @@ def process_event(param_dict): dso_start = get_optional(param_dict, "dso_map_start") dso_end = get_optional(param_dict, "dso_map_end") symbol = get_optional(param_dict, "symbol") + map_pgoff = get_optional(param_dict, "map_pgoff") + # check for valid map offset + if (str(map_pgoff) == '[unknown]'): + map_pgoff = 0 cpu = sample["cpu"] ip = sample["ip"] @@ -243,9 +247,10 @@ def process_event(param_dict): # Record for previous sample packet cpu_data[str(cpu) + 'addr'] = addr - # Handle CS_ETM_TRACE_ON packet if start_addr=0 and stop_addr=4 - if (start_addr == 0 and stop_addr == 4): - print("CPU%d: CS_ETM_TRACE_ON packet is inserted" % cpu) + # Filter out zero start_address. Optionally identify CS_ETM_TRACE_ON packet + if (start_addr == 0): + if ((stop_addr == 4) and (options.verbose == True)): + print("CPU%d: CS_ETM_TRACE_ON packet is inserted" % cpu) return if (start_addr < int(dso_start) or start_addr > int(dso_end)): @@ -262,13 +267,14 @@ def process_event(param_dict): # vm_start to zero. if (dso == "[kernel.kallsyms]" or dso_start == 0x400000): dso_vm_start = 0 + map_pgoff = 0 else: dso_vm_start = int(dso_start) dso_fname = get_dso_file_path(dso, dso_bid) if path.exists(dso_fname): - print_disam(dso_fname, dso_vm_start, start_addr, stop_addr) + print_disam(dso_fname, dso_vm_start, start_addr + map_pgoff, stop_addr + map_pgoff) else: - print("Failed to find dso %s for address range [ 0x%x .. 0x%x ]" % (dso, start_addr, stop_addr)) + print("Failed to find dso %s for address range [ 0x%x .. 0x%x ]" % (dso, start_addr + map_pgoff, stop_addr + map_pgoff)) print_srccode(comm, param_dict, sample, symbol, dso)