From patchwork Thu Sep 5 00:11:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Clevenger X-Patchwork-Id: 13791558 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 E6B51CD4F4A for ; Thu, 5 Sep 2024 00:14:24 +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=/d8sKDDfqhX0VFAITI+x4NbusmqUD10ZNAfW0BKTdEY=; b=O/h2zOpGqgpfmMVy1UMcsQg6AZ FFp+HRRroZJSau7TJva293TPR3mZcBDydxXp1bsVUty/EwwB2NP3DctAbpiPEzHTPhcNB79O8QxhS uWwvr/KMm2thKGAaQNlJpm5zTcKwHi2rEV9q5oGANlrDbtydFT7tD8l2SNNBIlZ4ys+uDHHKV26QC ZADcYKc9t9d5N1GmWdaNMii+KRbjAidiFEORNPVlnUfe/57Po5t2W+i/T/ZyIwDBCyBCF+PJIR3z8 o9BEYfyKW/vjuc7JThJDMfW55qdT85FShYUjQ7sYTPBE1oEFUXtx9VIK04mTg7F6DE+/Yr/he2RGX JxQfIRVA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sm08d-00000006SRM-1zhs; Thu, 05 Sep 2024 00:14:15 +0000 Received: from mail-centralusazlp170110009.outbound.protection.outlook.com ([2a01:111:f403:c111::9] helo=DM5PR21CU001.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sm06n-00000006SFz-2YUa for linux-arm-kernel@lists.infradead.org; Thu, 05 Sep 2024 00:12:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Fu2PoUM8fYN2CJehJkJNhG3d6rRlM/eC09DSL5p3kFZWZ+W+ehX2IJ9f4xEtpdNd0BDVZblmtfV64EcfxLRraYCWFuohVtnKe2WJ8vfnaNyGRXpYKobfSbJVnzQN4eONe88sPtC2vXNoM4QWYHKsTpeK9v8f8plWs4XmlTAbrJablkKi3E3Nw9HY4XLBm9q392KUG1hUy1aOXch31166jvLRNBq11CM/p0Xi2+NjYBOfY6JOf0E4+3t0Emtbm6ia9mD/2cejUE/0C1urfH7Vx1+TXqtsA3zul6bk7Pk0s/4PYOCQ3ZGhj5gHmpjfzrqi7ZbOT33Hsjlfmuw4tVBP5w== 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=/d8sKDDfqhX0VFAITI+x4NbusmqUD10ZNAfW0BKTdEY=; b=oc33JS0wVFxuhI8KrWmedbbIEBO1bDTIIb4xV/OFAQaOqv7Squ2JX49q7l8oCpq7xxY+56o6ybHh03RDGnUwUYDGJXeTUJsbiT3CXsxTYAiV6xppddyRoy97nQVa1bVXWqoSAr3YrAm2t8j13vjgU21ZaHmgw7y34GPhOtu80kCFhzbaScvHHNrjl4JdufNiFqLS2JC9r5asxs3bAdR38Sl2aSnCnFOdjymhNbdxDV5z+2n9UWTFXImamq/AYixJ9dcBimRmCsxQtpeuIj4UCp44F662XXsQBWYkCGQVS91Tmrbh5sGjfZo9qr6gDaoYnO+iHJcSOYWRSDzb/Jpyww== 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=/d8sKDDfqhX0VFAITI+x4NbusmqUD10ZNAfW0BKTdEY=; b=B9izC5+4jbTwyqpLY5r7aXRlKP943BxAgdmhQ8YSe5hUGJjQZx+JOQu1xCgrghMr5fwDKIGukGGWpWCGguQI3Z+W+7lB1tY7+XfdbNjLKhYLbrDJ3dwIgbILh6xytSiJfAC/NpgjYvEJpcmdy7P4/JSyaoCBZSc32XvQtzOadiM= 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 MW6PR01MB8365.prod.exchangelabs.com (2603:10b6:303:248::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.28; Thu, 5 Sep 2024 00:12:09 +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.7918.024; Thu, 5 Sep 2024 00:12:09 +0000 From: Steve Clevenger To: leo.yan@arm.com, 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 V6 3/4] Add map pgoff to python dictionary based on MAPPING_TYPE Date: Wed, 4 Sep 2024 18:11:30 -0600 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: CH2PR07CA0050.namprd07.prod.outlook.com (2603:10b6:610:5b::24) To PH7PR01MB8146.prod.exchangelabs.com (2603:10b6:510:2bd::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH7PR01MB8146:EE_|MW6PR01MB8365:EE_ X-MS-Office365-Filtering-Correlation-Id: 3bf00482-5278-49d8-3acf-08dccd3f624f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|52116014|376014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: Z79qwMfny+dAkhd3dVEfhJpJrDYcujer2Uih/Yow1YodGOA4KUp2q/wwl02HCRuwhdaG8Q8Eeo8BFrm9UY6d5gWaHjhe8o6yWSqT2piI3HjREf08UMabXfxgKbFO2GFy2nAb0XgWMLyKtTF/SuGdeADkDqsad6r2lzQjYAQDRYsAzlTZ50s3n67ngc2R6806/ZfUXSFD9PaYbq2e28bsxJPBdr9r4wK+OKM+XbZ96P1v20riQj5keTapam8e/XrbyKSrByrx70UMa5xgKICIMnziP+J5IoS0gm66uSpZ5+zllnzhCu1z+4sXRJsFetZ/f0dUhOk1cHvqTbR5+tprRtIuEMZEjRGw6CPc2pXRPioKlaYAnnYXWcgi6rRojejE5WLROYYIxeANCZfOdjCoIyrdOZ4fjh3Mqdz5zySASS1+v5AF/vizY9eARztkHfdlZmPHlYduIXPUOFG2ianBqyFPlfaaUiTHX+5+QREux/VlqJx+b879g2tJv8qzfPu6zV3Y6CukoAB1X2yMWDCzjkf7Wp8E94RkdlUvTiUz5KFRhPskAOn1G8/LdqQjuzUUtr8Wrb68sWj0bOSiwIxiv7mztyQQ9mhim8OReBy7W9lQQfXhEbGhfCuOCk+qoGI/z3ePC51y/cAmyqtkcV6OF32zOH5k6lbzA3OZIy50AiivTOxzohKBboPSXSiYc9r6qgX7COTw1ZRa72Q1PXFGkRn603q2rsN4HX2At4+aeKLftd+9SNrwtXNq2A1w4GCArHZF/f/YbcweMUeUTou5zof8CXXtRiCddtwv/g7Tz+SXwaEVwrpujxzGJIJMORpE8sNfq8CRr0uBjazTxL88IYP/O/nGhUJ08cobpuDlE6XYAskG6jpxrRdyrNGTPlEGa7n4zMxTT1oJ2vVvsYBY8Y9jJT6rj4m7u9m+xcUm8FDpbu+zP1tGfyDBQN7m7zLwPTQJ3LTeRHI08/PjFkEDdLEbK5jJf2TfgN2LFnOlsbO3xKkP1PmTz7urb+3uun5/adMb2SrU2Cz5VM9qLCbfYyppCAXiocNlBwW59PFk6uIVcW6rQPV2IemzBXNzKhMHuPmjTNDmmHscmPOnY9Rvg5qYosbBqx7jPZLz+GNKveoRPMgl9k7d5QDuL92gSPDWHPEZBdWAwujvqzmyitiYIqXSvCP5U1ejVEJfZEREHWl79LeWBthNfdcwnguUoGXmmmeaMzb2SKPmt2UcRMx/e060DmVUCwYOWBW+JSuaSvEjk8IM7gjvRae96zpzfA6suLRsxh5EmTXgjp6z+qjl6hZvcz1w8QacW8dn4V1ol6d1YiENE9qmlNYgSwelgqRcKMeQtnGs7FfQysqa3xCkbJCMxjC0hbQ4Jo0PeHH7aGtWW6WvSoS2sEdJcvRjKt+VHjXTAPD+6Cm9Q319BhZoxQ== 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)(366016)(52116014)(376014)(1800799024)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: v9Qf2P+ik1a4OlqonBvBkYEe6r9wiuKr1oXXGR55fYh0mIjb/VHSjqEPfX/z7U45k65/xTqxz9Ljst7p5jvdmgUJU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ga++bzTfrfIltpKtpWxuaAYkiuqpxzEXi8L41ich+RB9ODrgLKxTacwSQxvvSMuUL8zjKKM73spjvHLcW66I9MuEk/Raj89s3DyX87a9Tgeem5N7oH5peuZVc728Ir+MSIcmErQmnNEfj7difGDc0R99dkcTVifk0HwjN3jt9xoZxuoKXZYSniefyPpyVhXq80zG2tfWYmy4y0WJrSRFeDtLX5CXN7tKf26QXHX+IsefLgvrTR+nqV6f+YpARqa3J3bZDQnSrwMUAYMTNT4HOE4eUAfHfnxYlGRddpU7XxMF+XRCeSWKXueOSmWktt04akofLR0pyYIhBle81rOZBi0YdzoNADnkpQt/DTSWtvf1Nu9RaoRKQjZ+fn991+WjEJ4aF8bS5aLDB9+NvTzkqdIeK9gNL7fxr6AuZAKT0iLl0U4ltAPqS9sG00/GAdpE4jfYt7H/6TEzuTokbjoBX1zdFWn9gPw9/85Ark/t+ht X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3bf00482-5278-49d8-3acf-08dccd3f624f X-MS-Exchange-CrossTenant-AuthSource: PH7PR01MB8146.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2024 00:12:09.6766 (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: DDv1WyuohRlNn8U1qf2Wfvp/dE4P2GnjeY1E4gdwGUNgAm/70PD9XMo+92fTgN+oll6MTxzY04xV7RFsEGVAHGBZue9JZnGdvtrw3oTJfuhnIpMa+EEYgT/f+IKBJSNE X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR01MB8365 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240904_171221_679848_CA18547E X-CRM114-Status: GOOD ( 10.61 ) 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 Add map_pgoff parameter to python dictionary so it can be seen by the python script, arm-cs-trace-disasm.py. map_pgoff is forced to zero in the dictionary if file type is MAPPING_TYPE__IDENTITY. Otherwise, the map_pgoff value is directly added to the dictionary. Signed-off-by: Steve Clevenger Reviewed-by: Leo Yan --- .../util/scripting-engines/trace-event-python.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c index 6971dd6c231f..7b96504d5406 100644 --- a/tools/perf/util/scripting-engines/trace-event-python.c +++ b/tools/perf/util/scripting-engines/trace-event-python.c @@ -798,7 +798,8 @@ static int set_regs_in_dict(PyObject *dict, static void set_sym_in_dict(PyObject *dict, struct addr_location *al, const char *dso_field, const char *dso_bid_field, const char *dso_map_start, const char *dso_map_end, - const char *sym_field, const char *symoff_field) + const char *sym_field, const char *symoff_field, + const char *map_pgoff) { char sbuild_id[SBUILD_ID_SIZE]; @@ -814,6 +815,12 @@ static void set_sym_in_dict(PyObject *dict, struct addr_location *al, PyLong_FromUnsignedLong(map__start(al->map))); pydict_set_item_string_decref(dict, dso_map_end, PyLong_FromUnsignedLong(map__end(al->map))); + if (al->map->mapping_type == MAPPING_TYPE__DSO) + pydict_set_item_string_decref(dict, map_pgoff, + PyLong_FromUnsignedLongLong(al->map->pgoff)); + else + pydict_set_item_string_decref(dict, map_pgoff, + PyLong_FromUnsignedLongLong(0)); } if (al->sym) { pydict_set_item_string_decref(dict, sym_field, @@ -900,7 +907,7 @@ static PyObject *get_perf_sample_dict(struct perf_sample *sample, pydict_set_item_string_decref(dict, "comm", _PyUnicode_FromString(thread__comm_str(al->thread))); set_sym_in_dict(dict, al, "dso", "dso_bid", "dso_map_start", "dso_map_end", - "symbol", "symoff"); + "symbol", "symoff", "map_pgoff"); pydict_set_item_string_decref(dict, "callchain", callchain); @@ -925,7 +932,7 @@ static PyObject *get_perf_sample_dict(struct perf_sample *sample, PyBool_FromLong(1)); set_sym_in_dict(dict_sample, addr_al, "addr_dso", "addr_dso_bid", "addr_dso_map_start", "addr_dso_map_end", - "addr_symbol", "addr_symoff"); + "addr_symbol", "addr_symoff", "addr_map_pgoff"); } if (sample->flags)