From patchwork Thu Sep 5 22:28:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Clevenger X-Patchwork-Id: 13793043 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 E3591CE7AA0 for ; Thu, 5 Sep 2024 22:30: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=/d8sKDDfqhX0VFAITI+x4NbusmqUD10ZNAfW0BKTdEY=; b=E5uwjGdPczlO996Qlpnqox8ZwZ WajFwM9CXn+3wrKARwKllOm0oRVNiRrUJM7+e7O5vPWRyVestFXi68ZIfiGYjxQGvrPPkLvG7DAPh JeEn7f+EDGprsbAcTxFO/Rd35erlngduTevjRNjkWGeyMuK/PAwM2qQ0OYb4aFqX8adb1AOsa02Cp gDJEK7IzsoHDHATI9qhcrhrRDZFkAHQ0kARNeslnJeVWppwHfDO/0iPP2LEOxH1uP1SdSCoOF2xsW /C+jqq8kvSdhYxaZVgr/LySp6ui0Qpn81qTrXanndJz3P7MNTN2uFa2pHDE0u2xd+3bhnV6NmzPtg h1fnWPzQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1smKzE-0000000A1O0-2PHE; Thu, 05 Sep 2024 22:29:56 +0000 Received: from mail-eastusazlp170100000.outbound.protection.outlook.com ([2a01:111:f403:c101::] helo=BL2PR02CU003.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1smKyF-0000000A1JA-3nTK for linux-arm-kernel@lists.infradead.org; Thu, 05 Sep 2024 22:28:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=LG7sbvIzTIr1BOq3g3zXH65A7533A3hTEubbtjsFOSKINFWydW233W+A1N21CHmKpe30F6QG2sJUNAuXRkHRLlO6bHcgRwmMU10QA2ppPZWo2i49m5awiHd8i1mlcMZsFQtdiHVyFJM8TgtmDdvddJnpInNrqvj7ZvT5ayQuysEdIYe+Abyy4FBayF2/s7/O7OryUa0kcecrpmOTnN9Hkou4vyvflsrc036bgxH4l+jFSYp2Miemc31XEbUaGCfaj2YRrUN+utIbmvZlOHYxyEoK1VcMrOGZ5o8k841bN6vk9CzBkJzXvdCZcVdDn7zDxYs1gPKGOmVU947is5ntiw== 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=ayBk0mmQ4WP1fjtmYW86xi4yX320CzNN4tzAZYTJSbDa94si0AwryKnNjVwGeIeg/6QSexF4aKdoipYmfBKmtLbuBdy+2vINbx5XsQwoflu7eZs9fHkb9aN3RLNRJW1JGCg4ZrsUzrVKu4cxL+AmFxlZtM8DoU5jiQKVN3T+J1FK7/XbEwnEWsjsrjiwWlINCzFwqHYOBR1pcLPEFfDCkIKYIiYsjKNqBpACqEia5T/I/MDFLcu9UhxqtPSBqB5Xb5iKWe+ow812/a0X/H5LeLVwvcGP2g8QKA+qdsVWq/QXs8luII3WgF3gg/jPeMcWvvPr7s9UPRg1Efeqx0IpMg== 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=h/RE4pnGt6VSyeK7urkPfe7b2eUriA60LHtFCPAouWNom3fHRT0ysqqgwAUrLdNjiWgGKWy1cR54xNrDr39Zkl3QNbEb1XFL7TsORrxAZbKOMc7WwMZNN4PFRbj/wufo8sS162DpDVLTteiN10HFzDpZBeouia4Z7GWeDOHGlz8= 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 PH0PR01MB6501.prod.exchangelabs.com (2603:10b6:510:15::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.27; Thu, 5 Sep 2024 22:28:44 +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 22:28:44 +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 V7 3/4] Add map pgoff to python dictionary based on MAPPING_TYPE Date: Thu, 5 Sep 2024 16:28:26 -0600 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: CH2PR18CA0056.namprd18.prod.outlook.com (2603:10b6:610:55::36) To PH7PR01MB8146.prod.exchangelabs.com (2603:10b6:510:2bd::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH7PR01MB8146:EE_|PH0PR01MB6501:EE_ X-MS-Office365-Filtering-Correlation-Id: 85eb8080-3692-48df-c120-08dccdfa19e0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|52116014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: Cz3XV9IzWnfxxEstKqCwfgj+75MToBdLfYv/o1CzG4RGufxSHb5ZC9gaPIWkuYpzDPv6t0PiO1cSRR8Q5pRl9NOR1+uYNCQ8sa8X9JCsVF7c14gjppLjmUJZ0Qn32WJxdC1ouFHw0xyNJ9oPzrdsrtwPs6t2KL9LvYZg4QXPSrq+mNXM+OEuA2mKP1W4Pa7Ul/NM/ETpzBjN5+dlNBe+bhtOuEQhWqkw+wnZu8YgHTRI3VWcTj9SHeipgdR4LZ2/qDQNhYRUOEU6Y9si0oloyxmJrjtMTxUayopcFtvbjtY+tpC46jw2nKAi04jjf+htQ0+nqTGLmaNDblaY/HKCFKkufw6eyHxlN9IPltGEe/MaqI9L/NVcyha2XozttykEgKFnMITHgM4rDkEYqmJxBsW5SLZYRkzh3omv8K5tV5eKiQojsbCiH8prP2hTKTyv2q1l3tMw+4Bd0Use2ernPq6mnHeW/STHhG5FY/SOBQe0VVA5EMMESGSLKzTOVcaVPTJFEVbIaDIPaLIsbywOeAMWy1ZoGw/5mMkTnDSwrnKxrc8xSsvhUDrSMK6auP3w9rzVo8bnaiF68Pebh2k+rrdj2oJ89YneZLf854PMLqooNVXjtM3xxAafweAKhoiKep7W5fZQFUpjvaLOx83zcxONgu6rXO6ifXh0Irzfc4mMf2xIB2gzkk7HJDWl7HjLrTQ7HtA9cqq7zXiGFubQM8eMQK8pkNFUqw9n3rUpkokYu9gcye4T84j7Y3fXuOUKXIy/hDx/aEWHGBg3ulBu5Sgpdu3yj0yWS7TOKN0wAfC1wubWZvZinD+BDqayHwJ2n95o/40VyUfHz6/qXNv2AZRnoLoB/yiW97MgCJ4vdCaAMK1n19XL0kk9GJRf/D8DD1lACMxjzmxYvUMlHrpNFYeJagM2hS6XnF2q/dSUqzKkn1nic6B6Kg6dpCA6uxBvpOczsIQ2Ifl+okw9apEbjxD+4lJ7pkmOFgA3SmlQ8hW+PF1o2x7jUcS7PpfjXVtlIRmB3Q+6YAT+m3+jXJUijcMUGj5064Ws6vLefshZFHAGYtASRHVNiHMGfb1DBqqsjBUM87B9WueitMRS9tZMq1AMxyte1f1OE/tUsyuy64PdBXQy+gtwK4BC8aivcOUN+KmJS4C93uOycdO2AYtDxsQ8FjkNjIqc/wcw9no+KxcmF3XV6WyJfRbxzLBPIZVezRYLurbM0agpXBCBJyDNE0ba3T0GsiAgtgsPIr/ZH+7xN9n8Vmq7ndNRafbB6Ji5B+O/1W3evczjRBQGC8gS9LaLhiEBckBehL9NYss2A82Hbe3To1w9j4ugVCLr0gFfCY0hDIVhyVAzc7BUYbh9mCh+A0+mClepqv8S1AWyD4qNszxu61At3sWSaXfSHPgm7UfQUiy+CLqDFWd8H5r8VA== 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)(52116014)(366016)(1800799024)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 35C9syKdldV/DHjXPydZZenVK8mw8hRf7lXuUcL8BA9KRWhPokcvYgVEL1WHQXBDIfJinerZIfse8U+NDdgatoe6MQ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fiEvcd2LAh8bW+kINs5bCJ2RnSHqW9P9oH8ApsnEHB4cN9LdxS360HrrF/7AXOIS4KsvfTPiY2/Lv7j89lnNqTAFqop/QhrjPTZ2xn4wHKtBzsgYbKs74FcBUa+G3pV7jcOdyDQp4UlYc1AtpmHCj+0Ziek3eKVusywK6qu5TBz3q7aCL79EswS6OnH7tBE/U9ieYHfNn7rdgn5DJ3rexKUkWkpIWLtQ7nuXXzJABB8w+zonLIIML/T22OA+auxg3MmNWvLDHebhne2xastjDOpdLXekSAtBTodlR94ioFkrmTR4AOJg15btqNq/OK3NuCvauJE1ba6lI02Vg+wLqWbTWA+jlLg1+QXGAViEIjDe76CV2oSNvrZM9P7D/EIZtdtSJwUHuXCfMbOwoS+JdTE0N7oVjNaSSPwJ4BRClWk6TdOeXMIVL9px51zxYH9i8/9QYJ76SiDPofYgnm3fqHon5WIFQ1Xo X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 85eb8080-3692-48df-c120-08dccdfa19e0 X-MS-Exchange-CrossTenant-AuthSource: PH7PR01MB8146.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2024 22:28:44.0464 (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: qA3htBzPdjUBYGeed3mXYvp8lCoo6rYg4wBHbQQ3mICgIt1Yziuo+tlMvHbgbid0mUssQC6jwr7JQkJ04oivwYYisfuylxXrJYjykfKa7mnSsIGYTB9BdKxJl9vSDN/o X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB6501 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240905_152856_139083_B9C3C719 X-CRM114-Status: GOOD ( 10.76 ) 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)