From patchwork Fri Jul 19 09:26:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ganapatrao Kulkarni X-Patchwork-Id: 13737047 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 6757AC3DA5D for ; Fri, 19 Jul 2024 09:27:25 +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=kO5jWfWe8SP1yq06BBIRq3kKg26bQaaUNs3E9N+rH3g=; b=vkvVw6EaM3ksm3kmQsWy9HFrBE iaOrlM7MFKnJfKB45aL1AMErUGG4xDmaPvlWixlwmu78fWlONNKOb6rqSXGtcFqTT88ZL3CztcdvU yG6hihZ0LM35QPWd6K+0RpllTZoNAEsHqnXdwF2fkatdpGjvuKTHnQ5W945XEaVIPOGE3OgtiFTuH Yh+dtRyB6JHWInW2wQOTlzzLWghCYq866buuMD8wC93N2PTcso7yvHq5raLi6kIEX/836bCZ9czGk onQzzRwfNJGqYTSW+mVMgnCsGgenWaJjxU+3E1Cqa2htOpB4Z0Hn9xEWWKfGoQitXfEsgKgFOnuG6 P7Xl27gQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sUjtR-00000002E3F-0Mjb; Fri, 19 Jul 2024 09:27:13 +0000 Received: from mail-centralusazlp170100005.outbound.protection.outlook.com ([2a01:111:f403:c111::5] helo=DM1PR04CU001.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sUjt4-00000002DyZ-2WGL for linux-arm-kernel@lists.infradead.org; Fri, 19 Jul 2024 09:26:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pnDqA/9LsD7sl/03d8l+36WDMu8QiL52JBjXJn7eMO7OOmBEzFYPvJWQbHuF61eHFVjZNYmvqcIcDyPltXVne41dpROn32Vc7yP6DC2SUH8X9BPrf5+WqW98GEwOT8mtPSpLyREkeUIX4W7J+gtVk0g9LjoeR8aCv2y4+3av7EHWd/kKZhIsi9nL4c0ztROHVxjbaP5qLCCOMp/7SvL9uz4olxOykdOyF3JhpjcXXUdIpyLKh+/559SvA+bExGpdWuAKZF0zwxEEGPICasVq13REG0GxW2G8MTcijy77t5GK5B6EkWS9jaoaO7/5GTuymmaphBf5zb0AAOQ5xekk0Q== 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=kO5jWfWe8SP1yq06BBIRq3kKg26bQaaUNs3E9N+rH3g=; b=j4lFydl1VUyAdcjeH2qSSQcTPlobKXGrLT2lwpctZ9Rk0YpIl0qhtT8Fens38CD5x943jiPaKQ1eDizDAUrOrBRt6JbLaR3no6fM/q+V3BeiKgsvfRjtUVODnBCsGQicwVFmc4vObYPmV4uL6mOYT2GRDnKEs/d/waqN6+ob5d0tVh6Qfg5dh8umcp/NJmvcLKj6V3Xlw/U+9WskghontJP7wh93Iakrg/e/dHFJ81eyUp4CzDaX8HFzQ917zqYgXyDIbe3DU7egEBZqROhZ86DiIyejtIWpECrwZoW+H5IjuCcCJ7J21y1cqg0bGBzNASO1Ar//ti/ZPsks+gq2Lg== 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=kO5jWfWe8SP1yq06BBIRq3kKg26bQaaUNs3E9N+rH3g=; b=V468xO5hS3mxwqbY1y6ew4xYb0o00slk757NWz7QVdq953vOxdq0U6UNm65hmk/Wj2to2s8urss0KgAf9Q4+gumwGgl/I2vPdSElZRy3s3uFZE2Jv/QNh6yK1XS9niCoHCNRqJsBCyi28dqry3T+n1CfObgU+RegflGdWDpPbS8= 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 BY1PR01MB9091.prod.exchangelabs.com (2603:10b6:a03:5b0::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.17; Fri, 19 Jul 2024 09:26:38 +0000 Received: from SJ2PR01MB8101.prod.exchangelabs.com ([fe80::292:6d9c:eb9a:95c9]) by SJ2PR01MB8101.prod.exchangelabs.com ([fe80::292:6d9c:eb9a:95c9%3]) with mapi id 15.20.7762.027; Fri, 19 Jul 2024 09:26:38 +0000 From: Ganapatrao Kulkarni To: james.clark@arm.com, mike.leach@linaro.org, suzuki.poulose@arm.com Cc: acme@redhat.com, coresight@lists.linaro.org, 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] perf scripts python arm-cs-trace-disasm.py: Skip disasm if address continuity is broken Date: Fri, 19 Jul 2024 02:26:19 -0700 Message-Id: <20240719092619.274730-1-gankulkarni@os.amperecomputing.com> X-Mailer: git-send-email 2.40.1 X-ClientProxiedBy: CH2PR08CA0019.namprd08.prod.outlook.com (2603:10b6:610:5a::29) To SJ2PR01MB8101.prod.exchangelabs.com (2603:10b6:a03:4f6::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ2PR01MB8101:EE_|BY1PR01MB9091:EE_ X-MS-Office365-Filtering-Correlation-Id: 14fb2fb2-2fba-4e3b-e8a4-08dca7d4e452 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: wrPNK0nHxgxgB1rRZcuGcxWgdWhI/zwFIjI2erWZo2ps+fGlUTnAR53FY5XF8C25JT+vMFVnXO4oYUScnrt+L98cYI0g+9UmdVvq5qsz8VGplJGL4t0Df1cer0Rgb3o63brTBEVV8Jvt3u5l4fD1WErkyYuoqSMlQp177suEmUV5GDBljBqqmJlce1dpO8mIqrsEwg5b0fMWL2MnBHFcDtyUK3VfTB43+A7+YxK7QRp3g4tWdY/cAG4MMdmhuDk3nB8Ztmy68aY8pCsNng51UEBPs4u6Bh84bfD44HgRXT+upqWvBFB4S4kCLy4c0l83Jj92D6WCiPG+bmIumdzUE7i0V30xPu07NNvbrqCO3MJB7fQ2ze1RS/dGaZWwsREJ7DR3jxtdv+DBUJ5RYsw/QIl5HqME0bep4EJuN0kO+/o9xT8cy0j5eYM1W6O1tiPWIq0wK9JS2cixW5tfxTvbY3uJw16q+pemO6bdtHNpnPXIcx8DJUvSUAbIvww+6WohT+xY+r8NY/U9Kbf5BVxo1MG79qaTKvIgfwdZBNNGxkmaYsKPqGSfLsnXRdIJh3X3vhz2FwF1An3fGrihtqdf5iXEgMox9e54W32AKN4W0qNHZENaXk91cYh0wTGpK2jXX0DLL46eu0EeBN5QTB0tTGMs4V1hqHIrRHeeBoyOC28PZZHeACXTMIbiLgGvCcGnNsWJcvjYZy/q4wc/u1WVuYKJUYNGAV4CWeJjI7rAjdp44aijf8sQF2aMurfpIT9+FtewK1UV5IQF5M8rPnJxI279oqJHaRRp9Z5ND7BtQ/XPA8tswcZoOUrsKwXuJdmB8VnqNEDIk7q4HTCd6K6/e/wyDtxCCcsib+Y989ZY+ufAYjlFCNpFW/lmPl58oixVIHSlB5dyPa8Z4Xkt2st071RgtWaiIlplxT/5T233rUK+n/k7TG7QO8Sy74YJkGFaimU3l4PxMzsN4n58SiOTa9+YEG20qDWmnX/W9mx89x8DWM4Otkc7mcmjTKvCkSL8/IlPSx6FYJDdkNaAuYQ1EDGeF6GbHCNY2/T53EKfM46oEiKrmEFr+rfzWv4rA0Sqq2rlbEeR/Hp/qPsZIPPR9OLh4pfhFLLB086lZWEhsjNlHK2FePIcYE4qxo5G240ZSvxGdO7ISkR/UtdRb51YIfPOxqMJ4ss9R6OLi69nOi94i2GPc/To2RB8Xrd8HDrmb8NRin2QMRAfi+enGPVDO75WMOzqRfpLaDk1hxhiz5A49UlA/dDviXDKTguDeKdzQfqPOpI1JFLCZVkFvijh2XxNCAx3pXBa9V/ns8HUlYVi9AdMSprZQ4eEweUF/M1GTqO1jwPh6Ysk9VCRoOvJyYLyWJnv1th/VOyYdvXcrvV5AftX6GPO88CiwXk2OrStonl8nNuDgxqEOfuHbE1+tw== 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)(366016)(1800799024)(52116014)(376014)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FHUQP4VpObPn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IeQ8XzfvNlJUAHrIp3D8kZZGMomkEH1tJCtU4gVJsPA8nqTHICZlBmC6hSnqY2BUbDgKaRmPE8tbW2cGqt6sInAMNPeFCnocKtWC1zLitotnRIdK9oz8E1heUdRFj5Kc/p1p2cL7sg3uZ4qAUm11jTVayFa681zVSYSnPmQYrEZd9JoGZfK577Bm/K2l4mbGY1EGO7UnWfFSqkYxFeIEx4AS44/leOucEZwUWoniYdKdWTh2wcPpa5ci8yogQuNfmsRzxHBLVSpi46/N8ES/LS4LCHFQj04FtEixDuwA2zd4NnioEXDqpF1j4fBzK3Og2ILuMxijRGmPWAq/OhQxQFuIm5LeSSG4POMkH3RZtLnvXTrWUmOwrz3t+GyMbwBl7+jY5DGzRB5s1CHNpPfHFzv0P5vkhZSqjxxWoahaa+ZleWsXZp2Pw+bRmc48Nhu7tvN62tmK+qcZA1vpmfdkrtUGHettkG+ybqYrhoMl+AwldspFlp1QcK0tDh88aOdOOMPJaszkP8in1vQq/Gy0BWaoSbqIJeJjNZwI= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 14fb2fb2-2fba-4e3b-e8a4-08dca7d4e452 X-MS-Exchange-CrossTenant-AuthSource: SJ2PR01MB8101.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2024 09:26:38.6718 (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: FFwrMkncnkgtyBG7AaYwT2na3uPNm5JV0zRG9XJYqpGgjxCy6ZzYHTjFDTAA1sqdVmQXRJpkpbg2RNBthrIX0TfC86G9pvIpbBJxKthWRV3itwRrI3bTz8azO3JoF3g5 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR01MB9091 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240719_022650_673698_9E6ABA18 X-CRM114-Status: GOOD ( 11.02 ) 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 To generate the instruction tracing, script uses 2 contiguous packets address range. If there a continuity brake due to discontiguous branch address, it is required to reset the tracing and start tracing with the new set of contiguous packets. Adding change to identify the break and complete the remaining tracing of current packets and restart tracing from new set of packets, if continuity is established. Signed-off-by: Ganapatrao Kulkarni --- tools/perf/scripts/python/arm-cs-trace-disasm.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/perf/scripts/python/arm-cs-trace-disasm.py b/tools/perf/scripts/python/arm-cs-trace-disasm.py index d973c2baed1c..ad10cee2c35e 100755 --- a/tools/perf/scripts/python/arm-cs-trace-disasm.py +++ b/tools/perf/scripts/python/arm-cs-trace-disasm.py @@ -198,6 +198,10 @@ def process_event(param_dict): cpu_data[str(cpu) + 'addr'] = addr return + if (cpu_data.get(str(cpu) + 'ip') == None): + cpu_data[str(cpu) + 'ip'] = ip + + prev_ip = cpu_data[str(cpu) + 'ip'] if (options.verbose == True): print("Event type: %s" % name) @@ -243,12 +247,18 @@ def process_event(param_dict): # Record for previous sample packet cpu_data[str(cpu) + 'addr'] = addr + cpu_data[str(cpu) + 'ip'] = stop_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) return + if (stop_addr < start_addr): + # Continuity of the Packets broken, set start_addr to previous + # packet ip to complete the remaining tracing of the address range. + start_addr = prev_ip + if (start_addr < int(dso_start) or start_addr > int(dso_end)): print("Start address 0x%x is out of range [ 0x%x .. 0x%x ] for dso %s" % (start_addr, int(dso_start), int(dso_end), dso)) return