From patchwork Wed Aug 28 23:17:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Clevenger X-Patchwork-Id: 13782084 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 AC716C7114C for ; Wed, 28 Aug 2024 23:20:10 +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=5TbPovjZNBNXh/GT67apuayFIV+YMHPFXW1udh43QOQ=; b=d5GncGieZI6fRIPc3u0Xu0+cxx osUg4v0PzE1T93VMWDYAgFxyMm2bvCyBQIy8IEHLgmtxBhTIWNev8tAK9N4RbPMhSxE7p/I5xUd2T 5jI82PAM81RVkjEnwXbCCpsMGzoVBm9M7yW7hIbv1+ZihVR+Uz+dCZ7ig5DO25dcmt9OSJfA8V25n FFzupXui9b5Vq0KK14loFw2RxC5hr00R/zoO9TAvu+9rpGjXP0FbNwU+QnHyryC7/QHN/x79yqWKc IVD3Fk61s70FSLCRnUTar4EHMsMzzpGGZ0P2oLOd/uLxIyJseEfg7FJCTnFcAUtNf/V8wSVEyBhV4 Sdd4n5vQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjRxH-0000000HJtw-16NR; Wed, 28 Aug 2024 23:19:59 +0000 Received: from mail-dm6nam11on20708.outbound.protection.outlook.com ([2a01:111:f403:2415::708] helo=NAM11-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjRve-0000000HJho-2MFI for linux-arm-kernel@lists.infradead.org; Wed, 28 Aug 2024 23:18:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=N3ysuXwPY45dRCZuqFJzSPFaHxlzl7Fa1gSM3KXTP6Ep3l/Oj7XMNC97qZ9ZdE5SMN1WnHkNEZ75Loh0TvoYX4SBhQWpvwF4w6mTGOAKx9gejMq/svW+wg97jloIGba8+sGGxo65VOm4nGjuPFCfhhAckWvkGoBwuPe0X/5M8TUc2fcrEcrB7Yz5N2DVvDD4t03lkSADq/ub1dpCdxxhkpH0vygFYTRcSIHwTyNQcDL/IDXB2jVpBA1CNutFsxH6snBj8oFVe5NE2a6kjibAPxsaU1L6rStROGVIyeDJrivVhrz+WnkUP4RgCzpzjVrHRZgPooNKbqLii/GI5D0I7w== 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=5TbPovjZNBNXh/GT67apuayFIV+YMHPFXW1udh43QOQ=; b=wyfL/K+9kUK1VAc4QHd8tIkHd3BqpFU28/1fwDAKM0XYhOboKX07c9KeQsC82aaRVjl03xRMbjPL4dfxMjUK2QCtChTtKawzlWMPXYWCzpxkR2iWQFAE3MJato3XwQGaetWQiJqR8rKcOXBu0Q7gtcJNtF26M7laDZR/DpQUL0SHBKNZymgPUr1OmRMbOET32GLxWSTVPhHT0XUoChKJpTRq9jQYA+TXAuAvlRWZe6j3oqBDtdEz+2H6RKWvxwFqegwVTcW4T1Y2JCE4aV9hraJIMP5XTWwGXEVfEcYU7JD5mYd+y/IvWnHGHMzG66moyu193Ko3SLRO+sRTohtVPA== 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=5TbPovjZNBNXh/GT67apuayFIV+YMHPFXW1udh43QOQ=; b=MScw1ToTtpeJv2pxh+0Gv26dYmYXebxEHuY2gs9olo96ntlzeTDHK1pJKhFxCRx0XysaQmHuoXqIJV1qAH0A/mon5VY2XwP44Hdyz3NHaKndzulUB1AMI7N/cllcbNnFH0lYvs6r+IyNQ0Zm3nLgyTa1naGGHEuikazIwE5IEgc= 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 PH0PR01MB7895.prod.exchangelabs.com (2603:10b6:510:28a::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.25; Wed, 28 Aug 2024 23:18:13 +0000 Received: from PH7PR01MB8146.prod.exchangelabs.com ([fe80::2972:642:93d1:e9d4]) by PH7PR01MB8146.prod.exchangelabs.com ([fe80::2972:642:93d1:e9d4%4]) with mapi id 15.20.7897.027; Wed, 28 Aug 2024 23:18:13 +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 V5 3/4] Add map pgoff to python dictionary based on MAPPING_TYPE Date: Wed, 28 Aug 2024 17:17:56 -0600 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: BL1PR13CA0109.namprd13.prod.outlook.com (2603:10b6:208:2b9::24) To PH7PR01MB8146.prod.exchangelabs.com (2603:10b6:510:2bd::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH7PR01MB8146:EE_|PH0PR01MB7895:EE_ X-MS-Office365-Filtering-Correlation-Id: 4b97ef2c-bbb6-414c-ef6f-08dcc7b7b0bc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|1800799024|366016|376014|38350700014; X-Microsoft-Antispam-Message-Info: 7GXcZPfE871BtOS+AKRKMV5wkU8PF5j84qPb0CYdMju4iv0OhBfqQhPFfuiwUWMETbp9GfoIHE/3OZs62+5/C0XcPl9i2xDMXkHShmKsVTGV/6dOQgmkpYVh70DyWP68O4CiC6HDI5mhCX6gFQhu/6B6RzthAvN58tmE9WdWn/fBPz+vK35YLr9f+z5fhRdsdnTj+W96e9q/VCZ/n5UD6Yp1FqpRtCIOpJZ7cm8U44rPNz3FTz2P4qQaPGimsBwe5lRipaw+XCccbJlmbwgHpbygBbJ7TGg/a7rfC35rESwbBnaCLOB9yQ4sQoZnqdf0ZxLEw+mQfATuo/K3P3lmOrkJa89Rxmac8e2ph/rTGAeMXKCTP1590U4PFws3tgFf8RwthxRXrhtT3fsuzwYwXIww43zmy67sTiA4lVzVEmXh/ISqnx4Vhg1isoc/99yVt/clPfMnBSANUStKSJfsLuIKK2GXJOtQPxbP1mggx1RqI2NRIuhGb9BonYy64KOtnr2GtTNCgQwWUXPC15rWziZ3OJxKbTwFVqxBYSMXDKXNbFpJ1gfJBe9oKD2ZyoQbRoriUjlvzOX2vEvR3FJw2O17efary6e0QuYb95u7bYwaZhnfoda/Bwf/qAUXGD3o47YE1sje++CHyWyFveQ+hwVnskIS9TGht6n2GeD1ZjgB4ANRkhi87XaFbSo93NM06hF/ciyrxL/Eo6T4bEdQ9hk63y5mpNmomR11sD6zpxeMc1vuS2J2W1KEwP+ayDfKD6RQmizwex4UOGNoBWNGMpVxtorwwRM9cewK/oLspb59Pc1NZwVkqqI00oEEUcrPt/JJfTaEdeNmqzGlDckCtAYJV6ua4GdD2krF3Xa/mqfNCs/3YWfmrhKZ90oF8348QzUsALx/W5DTeEmYq5t4xXTcgXi3cF8rwhwiJhhkXqHQaTaTuARTbfOe/9u9k5ysVMm0mRR/oi6dqkoA7XunN0bo+/I7kLra05VgAWblmfU0Q/Fe+ASe1Bb+sJPiUKXUFwMVeA/WaqgGyZ2tug3PWOnNQuYq8ejsLYpwwACI9tUlbS1tCtVrjCQT1vw6w6w3S6ly5UjQasNeCLIl+VINomGB2OKcCpyG0H9rPQ1e7AXtxVe8VP+qXhZP8T7Jd9BX6tMRnkvnrCMXPAMw3D5vhHmai2OJDpsjzy1oojFwzKwU0RctQCIkfhaoNR9YGt4ubRPd9e11+qbXccI9nGIjnwtGU8xuBR2V1XHDXfqgpuBqgnh+NECQmjmSP6juBPxN8zSbTt2RRli0hwZrKbXXl5mW+5lcgpJkrxxmt9Yne1yKczrQ8DlCHj1DjgelT37UAAb0nxY0V5i+VW4DRjnTsAwoE71imCk+Nnb4aQvQD9uwhXnbDrDb8ti3lX5XKo/9diOkF5fseDRHjgt0ol9/pA== 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)(52116014)(1800799024)(366016)(376014)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: AJ10Sz+fZuUExzdGEQGtQr4+LVGK+2dliJDnR9tpf0rsFyX4symS4VtVSmEzgmq3gjj4H30w9dwM7/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DdgS3U8xkn7UkA5Dcb9GDTTa6sZkeAwhSIv8GzTweFlBN5WOeGJ21AzWiAa2YNAlX2Ok3JkLMP7DjeUzf9HF8HEVulnlsiTK4bswaybp6PQNeodjMjmtQtzU1Dheb70IHkSLI0cN4qgvV7RSxLNP4kGYXe/zAtVtLdfCK3+6rFJsTdmUkQEzAJkHU0UBP/6VVv7DcZzU/94v9djNM28zEj0w1mkgormwGQMV1PWI7aBtcIAhqXtxKpjrRYRJfHotGtZzMBCl6Q+RhS9yySBzLZs/QBwj2rt234K26Mv+fVFI+WAbHX7FkgTPSegcsMRwaJUlK2UnfkPPNwh78iSKLz6MO5MDXLCwbiUwRW8sWyp/DXEnpCsWggvWoIIbjxw52yBtw4ssz/uAjif+t9Xp70GarmblHLQ20N3nF36prYbmRgVCk1hL5tlqoapYW2Bt8/fuDuv8TpjxBhAkcLg5wlmXm8yVzJRMrJWQHYhnSl2jsz6pGNIvt95LidtMWCRl8C X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4b97ef2c-bbb6-414c-ef6f-08dcc7b7b0bc X-MS-Exchange-CrossTenant-AuthSource: PH7PR01MB8146.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Aug 2024 23:18:13.9008 (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: iV3wBXs9omSVyzicOPKefhigOuTxuWVCDt/0vxYzk2jmHdXO1PmT7QRf5tGSHfSKWyeP6uxq4wOBf9OQrA+gMXoAPVt/6IF9CeKskYv7g+3QOlt3d974BjEwW1IJEp9p X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB7895 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240828_161818_629566_96C12905 X-CRM114-Status: GOOD ( 10.97 ) 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 --- .../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)