From patchwork Mon Aug 12 09:00:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ganapatrao Kulkarni X-Patchwork-Id: 13760329 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 9591EC52D7C for ; Mon, 12 Aug 2024 09:01: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: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:In-Reply-To:References:List-Owner; bh=wF0VyJxIPhgvV3Vvxfdy/oaUTzKTlZTHq2i7oj6wnnw=; b=adHM2LRGsQaPBioL+VCTNAsJUh kwsQhwkeWq4PqYp3wQzrx9ywMPuS+0aaiGBMVZ9Vi37CIB47Jp6UKp3ND62ncStVEn84zh1IDBaAu et5tveZEQt+Ul2Soq7Kh+WO1TYVJ81cBN6ESqwBiXYV5OYUiiSM0mnE5MJvWhJ0UWSvBOTzkYaUzp zZMhzXx/akUMBWg7347Hvcz6cdNIdItXsLuqKDgLSodWv4AKnk/OH0hchsv81UyMYbZuU46OMDiI1 4GWHmG5ALgBBgDhb8TCUtr4orB6FITZiPMuxg3lo0/5tInD4iQ4c3cn6SedmeOOqT0uDyMLhsJ5iJ c6VOgjZA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdQvw-0000000HM6I-1QNG; Mon, 12 Aug 2024 09:01:44 +0000 Received: from mail-dm6nam12on20700.outbound.protection.outlook.com ([2a01:111:f403:2417::700] helo=NAM12-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdQvI-0000000HLzk-2H88 for linux-arm-kernel@lists.infradead.org; Mon, 12 Aug 2024 09:01:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=a9JtdauCl88+3uxCJjN151Bo4Q0zwhAmnT/wKTJQL+LuypLf8/p7OsXM24X+U6bKm0AAMS5THYAGwsikX/s2nZkuNvC239exr4cHHjWTTnBNdx7PuioejS1fgGSMrtSUT870rdLZnovH2+Uc1NLOAM8rENTKSP0Idu9mAOKfDQYQRQY9XdpSY8AjlnH445+Jp5oxasjrxgOoc/dryGTiWBB4TSVXRSVgnmWceERAPXRtM9eyenHJU7Ghgs55WvEV3EIlP2guv5LOj+rIjJNGFPRu6BeLBkPgq4mm7eLoUYJ5lNOR1AAfAAg+6TGwBQ0l9/UR9MOBYV0u43YPYIrlJA== 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=wF0VyJxIPhgvV3Vvxfdy/oaUTzKTlZTHq2i7oj6wnnw=; b=pv8L3NTDNMJ7kptQzIt53rOA+7hzJO4T3HDkmOODKLknYUs7KyV6CojttphVkIXEJ2AWBUjw7uv8B/IszkXsAB2xTP9LaJrUOJqI1SYGCXsKJJPRQHd9iu7gID4YiNFQ/qTzVYvlbaHkig9rGl85aVeXqh5yejO6ZL/L/MsaRyJ7MrbHBV2u1RJIYcDG3EoQFEOPG0tpVUKUb82LNiW7PIcoVVy0HnL0EjIWRBgdTYlVBbhkbxXIgL3mM5Sf2aO9WtJV7bxOZGpq3zduHZgrhmQXwibcgqXQ3ISBo3abqFqabWnlzzZG4J20NH8EPqqq1YYFuMoktUZwx2eygw/2ZQ== 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=wF0VyJxIPhgvV3Vvxfdy/oaUTzKTlZTHq2i7oj6wnnw=; b=guiXbKx8rllIzRrWHI4wLmlDLkNOlqjhS56moudFwugODOoDwK4SrOlwgC+gx4owSAG7BrognsqeLcqELQXdyTIf07fhPwmPJtJiQUOYdgOQ9bXvvvkoMn66OsHFZv+rIpiqWQCp/xX9JCo0L2FOOFW8Y/ZblJUNL/vIeHwapgk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from SJ2PR01MB8101.prod.exchangelabs.com (2603:10b6:a03:4f6::10) by IA0PR01MB8349.prod.exchangelabs.com (2603:10b6:208:481::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.20; Mon, 12 Aug 2024 09:00:54 +0000 Received: from SJ2PR01MB8101.prod.exchangelabs.com ([fe80::292:6d9c:eb9a:95c9]) by SJ2PR01MB8101.prod.exchangelabs.com ([fe80::292:6d9c:eb9a:95c9%4]) with mapi id 15.20.7849.019; Mon, 12 Aug 2024 09:00:53 +0000 From: Ganapatrao Kulkarni To: james.clark@arm.com, mike.leach@linaro.org, suzuki.poulose@arm.com Cc: leo.yan@arm.com, acme@redhat.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, darren@os.amperecomputing.com, scclevenger@os.amperecomputing.com, gankulkarni@os.amperecomputing.com Subject: [PATCH V3] perf scripts python arm-cs-trace-disasm.py: Skip disasm of discontiguous packets Date: Mon, 12 Aug 2024 02:00:15 -0700 Message-Id: <20240812090015.326434-1-gankulkarni@os.amperecomputing.com> X-Mailer: git-send-email 2.40.1 X-ClientProxiedBy: SA9PR11CA0026.namprd11.prod.outlook.com (2603:10b6:806:6e::31) To SJ2PR01MB8101.prod.exchangelabs.com (2603:10b6:a03:4f6::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ2PR01MB8101:EE_|IA0PR01MB8349:EE_ X-MS-Office365-Filtering-Correlation-Id: 10f2df25-5e1f-4b29-781a-08dcbaad4537 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: ffTwoIJ0lloXI9Ne39kcybGhZffGOJ0FMaAuQOfo4ZzU+N1GdIrRXBtz6k5Wl1AvX8tPAwPESzRavFqVBqgMWaXtuzy2WeTqX4JF6PZG3sCj30nK5Yx1zCaRm2u3+rNlZPyF+RgXfsn+JTiGI8z5t+7oX3pZPubky59cANPZtb92TRG1prr5P4HqrbtoQ1fl0xD5VhLt473D9vKbN1vo7GJmlzyo8ry4wrkYTTmtx7aLCTvPWpyBqaaHsOeK4p6zE2yJWsUCja4rM1AvX2/62nCdxeXMCwYZtEp0Lm2KNOFsd5hv1Tlc2NoUgw/Auh9tsH9TC59p+HX3HpQnD/R3pmbLPlQvXKWMXtNjW/FubGEqzHBU3YCzoAwMTmviIFSMF7EewCf7j57A0roI4JLfP67u+EcIFzpVtyIf2qfQ5N/8Kg744jeWCXBcQv5m0fhRDjHz8UGQsSEqQtKeNtH8pgRmdR8cX1wAOVF1Dw5wBQyUFyk1b+aQmdY+dOYQ4rlVUx3A8rgOZEgVV10P/O7jwlB4lwdWMNWvfqNzooIOpApR2PBtfIe32lDrA2poody/5boNAChn8VUN6JJpx5yswYHUVqmJiv2UQu0duWXOvQJsK9V+g/vTEi1fBjq9ndvOSGdvE1XpXTWLtH/wWYgY1CMDU5N4ctF3D2FVQ+US9fcM4ZDIWnZ/0OO1p4EIvVhiVareTj/M7WvsHO3Xe10cdRm0QEJYBEve6DpnCNGn4uR1nakib16PkAe6GyWRLroKIdxs166uvsdiZQIuzfn7Uu5/Z0FugayrtJK22rYOvn9bvJ3OAlqPuU2gE0KaARteWuwZfPFK1KDtjhi2Gu3qyfYE6fmFwTioO5ZIj8IXuMpqZlPGdhMvtMxKMQ+4Pz9zqPUJ1lNFlMZbjjsnWJkHoUmCxwgfEFwtsZ+bY5xPuwPXwjArQDUPUjryWHf71xzb/pA7NuCovVowsthqfDmwBSacfJ291w+Q8JR2QH1iM8QYSxY9JxFfwzT/4JisKhzgpXQ+TOeGSA+p/VYVFUU2R1NZl7ksCz+9GY2kKUw1kdX4iFx+xUttiORrOqp9iEuRjK8gbzLtvmM07qjjOJq71V0wEc71gafjWdCqOSYzVQrrKG6b4clMseN1p3M3N43jK5u53tfd0OIQTuafejyMrMPR8PZbjvNeYRXTXL/lv/ol6UaUCXuZGeULoJMADY9XWaqdr3/TXKhwNs+SsxQFs14YKL21lOB2GlgoPKUSxLpcwfipws1oz0+zrHfXvmPWdafpmRoiXNqB+tnMVoDX+sfOapi8J4VeWY3/k91jloQNI+ORu3m1l+nwoA4775qnuypGYgde6OqU/91CWfpPkF/wK+WE0CXlgRtxlKTIy/U= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ2PR01MB8101.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(52116014)(376014)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: eSOsLzZdBPXxn0pVsN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bu7Bal0s1R7LYH9Mx2fqSCnCS0k3zcBcOHYylwPPbqA+kaEYjK5BjoixAjlOjqfEM4lDW9lfX2gNN+cr1H/gYLgZC7Qlu66TE8V5JffqGipKjsva2151/7VxTTpGXqUZGAijHAfb3WLDWbDZXaBCkgDJui3Nx4BamlEaIyy607Rdybf8FWDcPhfQzhUWtc81nhwJAXstX5qdchwEQB4j4MftjwcTRewFhgYsEl3Szz4P2AfZeBkl0qyRJ+cH3YxcENJQ1ihanzqlWUNqDDvN1BVqxzUuRV7wLTlkH4qIZS8RSq+WM2m1kepEoy84JuEWjVHO6zjvg9M/vZ/F7qMV22v082uWdgs779C48YU/U0w7NKYjDXuZiEEtq9A8a1FFA1NKRx1fOntFAxSIxBRQ8JYHAMzPVh2CZ0bdgc5PBwzJ/bkOZTY6i7F2sN30TTGdXW47XhXZHlOFykmRSvCOMnXUmZjhq3h3XSz3IMn5LkzlGeFWGge5avsLsTGFNQWphjypQPbVAH+by7OVQfBLEwOHA6mKpTkXQmMBSk= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 10f2df25-5e1f-4b29-781a-08dcbaad4537 X-MS-Exchange-CrossTenant-AuthSource: SJ2PR01MB8101.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Aug 2024 09:00:53.4226 (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: ux5snVZoNQj3iq/pDVwBUViSwl7A7OW4vn+ApFHJlnMHgBGcjHQnTsJhFGxB1IdX87J1X03XsxSRnZHEqkyH1um77g2rdTUF5Baj9kMnskloyr0L5YqwY1zn2gh+W+Yp X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR01MB8349 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240812_020104_621564_242971BC X-CRM114-Status: GOOD ( 12.83 ) 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 Script uses contiguous address range of adjacent packets to generate the tracing. When there is a continuity brake due to discontiguous branch address, it is resulting in to a perf tool crash(segfault). This is expected bhehaviour since the decoder is not expecting the discontiguous packets. Adding an option "force" to allow the decoder to continue and complete the tracing without application crash by dropping the discontiguous packets from decoding. Reviewed-by: Leo Yan Signed-off-by: Ganapatrao Kulkarni --- Changes since V2: Fixed minor indentation issue. Changes since V1: Updated patch as per discussions[1]. [1] https://lore.kernel.org/linux-arm-kernel/ce4af204-874f-404c-a7aa-42dc6693d072@linaro.org/T/ tools/perf/scripts/python/arm-cs-trace-disasm.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tools/perf/scripts/python/arm-cs-trace-disasm.py b/tools/perf/scripts/python/arm-cs-trace-disasm.py index d973c2baed1c..65d59db3bcec 100755 --- a/tools/perf/scripts/python/arm-cs-trace-disasm.py +++ b/tools/perf/scripts/python/arm-cs-trace-disasm.py @@ -36,7 +36,10 @@ option_list = [ help="Set path to objdump executable file"), make_option("-v", "--verbose", dest="verbose", action="store_true", default=False, - help="Enable debugging log") + help="Enable debugging log"), + make_option("-f", "--force", dest="force", + action="store_true", default=False, + help="Force decoder to continue") ] parser = OptionParser(option_list=option_list) @@ -257,6 +260,13 @@ def process_event(param_dict): print("Stop address 0x%x is out of range [ 0x%x .. 0x%x ] for dso %s" % (stop_addr, int(dso_start), int(dso_end), dso)) return + if (stop_addr < start_addr): + if (options.verbose or not options.force): + print("Packet Discontinuity detected [stop_add:0x%x start_addr:0x%x ] for dso %s" % (stop_addr, start_addr, dso)) + print("Use option '-f' following the script for force mode") + if (options.force): + return + if (options.objdump_name != None): # It doesn't need to decrease virtual memory offset for disassembly # for kernel dso and executable file dso, so in this case we set