From patchwork Mon Sep 9 21:29:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Clevenger X-Patchwork-Id: 13797611 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 5DA2EECE589 for ; Mon, 9 Sep 2024 21:32:36 +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=oNpF2r4iUF7M3JTkCcJ1+ovz6i fmAgh+dE1qCL4lpdgKeg8F5ZxOlRfzpRa5qk1l4tPfdn6v659qYP/1ypjcb2tpOKO2Yeb80ny1W5z OObyCNHUYxiiNCazg3YqVzdgWv4PdP1DsrcWe4Atplpi4EguVPc2u7cUZixEYRFZFhe1ULd2aMn7n lptr48c9oUvae9c8wA/vuViRNTuZ0FpmgIOlAbkhrp6Jb1e1o/3EOYHbZrdmfrMVerlDn3zAB5s92 GDlaTXCTAmAieG9Hzn1Ig69k7+u8bB10vqsYwk22qn4rKEPNGdT9pi0n+RDbLfbm/lH+IZ6NQTRN8 td3zsZgw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1snlzk-00000003N1n-3bPe; Mon, 09 Sep 2024 21:32:24 +0000 Received: from mail-dm6nam10on20719.outbound.protection.outlook.com ([2a01:111:f400:7e88::719] helo=NAM10-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1snlxn-00000003MpL-0Fvu for linux-arm-kernel@lists.infradead.org; Mon, 09 Sep 2024 21:30:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rljFgZTn0AkQwpx00rclzEsXwQEzB6GNfTnNEK6LSwGWF9DaFsRiWSmo9DTXnWUFcJaeCnL7qv0ZQ74zDGct+1e9pRpE3v/PY8NisfOLgB38jzGnk+d3XrHQ14NM1kw2RuMMjiEeyCjMNtYfU7tMIvClu8D56vLlwJ05mW2rNMgTURtc0QuTM3pc190YR2sBtjASUuT/6EITcH/UUdHjaKJ1GORO8wTv5Bk4trt1ovCeoNwnuqVhcLZopFPVGcdJHG2gZ5owiUXxBSdatZymtqYOu38xaOmqcb/V/33AmKc1qcN7nvZRiCLUrBe6sHjI2vdO5xUKDEGxZ8w3U8qb8w== 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=NCSaUwzIQPrB4mPPx20JWL6RrG4rkdZnklxJ8a7ZiIL7SJN8+S/BtQ3gn1SHozArbSL+YWml6x1JZg5T6rt9MhLUDUPZh8kKZE0RpelhyRNyN74t/7+xPMy6w5qQWV1NPiYIY1DG8pvcRf9Xk27jExQKtOKxthfm22FRMa8VYm7EcmtIWNPlxRjYBgnIEpOaQfIR/sFQxZ00Gdypvtj7tSuzYQw0M4Y/P7va/kqxFC1mVyTxs1JyJKi4xPPFlpNAMmvaejYkW9aGyQxwaeaVq0B3t8+HKKPZ0ivhBC5b56QKGuEx2OlnAePgJap9HQVtg1d2no+QyfDjJusasnDwSA== 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=nuT1CG25wJ3a8Yxys3GQV8RdY1OponRee1VO+f4pvB3wO85J/WyMBmh2RgcSqGo7UFqOUwi5EfmJmJH3s5JJhEHG+C86KKZKsnV+KpN5om42axYvONhfDdoclkDVbre9qNya5jbQiwX7jHH7pfOKOIXc97jjOQXZm9fnlTEjWLA= 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 DM8PR01MB6919.prod.exchangelabs.com (2603:10b6:8:14::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.24; Mon, 9 Sep 2024 21:30:17 +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; Mon, 9 Sep 2024 21:30:17 +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 V8 3/4] Add map pgoff to python dictionary based on MAPPING_TYPE Date: Mon, 9 Sep 2024 15:29:59 -0600 Message-Id: <8ac2631b113ad83553981795bcc509d9c6f55495.1725667397.git.scclevenger@os.amperecomputing.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: CH3P220CA0010.NAMP220.PROD.OUTLOOK.COM (2603:10b6:610:1e8::20) To PH7PR01MB8146.prod.exchangelabs.com (2603:10b6:510:2bd::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH7PR01MB8146:EE_|DM8PR01MB6919:EE_ X-MS-Office365-Filtering-Correlation-Id: f941c3bf-cfde-4ae2-fcd4-08dcd11699a4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: 2f73kLhrIMsU9H+QpUf/nqm0MPkLTg9JwX9vcApASZ+7viFNCX9g5sFzJLVfylVNMXfIxmUh8L2yjUWnSceMmW5hb2XdyMqQUqDyEQFeXlCvdAakIKwQzPI/9Kt/Kj4UohUoxa1SsUVWWIV7XXhMXHThnzoImp7IPj52ys4nXxqX9UGZs8zRLLcJ1ye+cqkj79bEWkBDAc3JzZfnJKhGgSgjlxZdCS0kRpdsbRnG1+JaDD9wP3NcvBJFKfJoHyPtMaIt5fqTn/x76vx7f/ypy1+unDeN2dOhnFF6i30w+tNUy2kEx2vflFaxsxDtIOO7FXIsvO6l0r5RLdP0yQWW1XCqnsguGjimJrWvd30YWVQRhI6r9xk6oZsAJr2ZLS5HYAdutgneGGxTo2bsf0h/PGPw/bhDxVaCuHYdxGPynlxGlJWTP/8NH7EaYhZJsbO/GCjTJsOf513Uh7fT3BxXbc8TAnYSBJ1D67cm0yHdPfYueV1MCclnqNOgEVDFnO1Txh8s4f4yVYBH4kS8bqzoc5tRloMkP4tvOYU/JM9Y22zTemi309r0x2uLXFZimYYg2mGV5io57MZVvq3QDjksMxxw19oLxpNxX9LnYPWLHdyr7cPUxczIPIuwVjzzjeNWMLJCn35zn3cnikPB/Pj53s2BTd/v/HLasyjbXPUaPaZ+W+tmc/tT958/u6BKYHewt0DDSVpEpGcIbRx881rSJZONmCFTN5Ow1gAYpCltb6UJ0mtw/x/RqwhIpnF23afXsMYVAiT196W7UmYZHJ1wdrmRDnYiThIeKRjemTnpP96wEVkHCQETDN/UUG6raKf82IrLRpzCzGfkteRc/ITtTXReVG/nibKsB8XYmbkSaxNeOImlFqz/x9pyXLQa0dKfub5pIw7TZ8vOfjaWTpJTwClhfvQR8Go06/popTn4FZ0xr2ua/VqdC8TD+Hh+31QEpw+ioLl2TpLK83OTsenWYKznOme0hAAZbmjGQLbNtc2LKjIJMqxvVcqNAULxJN3zwy+iU2rVgwrUFF+oQC5Cl5PJHqKxGb86K9ym2wqhQ7S4/lPezRharQ0z8aubjNwoibjMgKIG5l812LBSquaHpStMytQD6/WUJ4yK//UhbTMCbFL/Ty/Gd6xXE1BgmVuLmyzXs+pTyCR/ZYINqkP7/2k3xddUV52AFc/1UDe1t4Iq7iArknAd8FG5n7flJhRy/SKQsWimQkPMQ8nY8Qc9LLs/T7cL9OTEf+RrDYlq8d5zNQhcUsxxYUGiQ/3F0WoEpRo8faUBbseRV78DLlWHrG1stqF7CHEwN5Kjto4wCKcV8uTxYANPLl3Apc0nrG8T2fQLFcjqtZsDsyB7tY3ejY8sIJTPlCiKIPGyLUNE7RlqDdSGaC/xgtw3zPukLxnAqdcHuTQkFqUZUJ2rmHrlYQ== 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)(376014)(52116014)(1800799024)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: J7gpSR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TAD7BLGIhVo43F2KVeMbWc0bXVZ552RP4EVA3MKh5MVS07b7jZmP2UIWmRvAokfqv+dx66P+uLjdosqStABXiC6Pcde6IdXRhRnyChVIjD7WNSW1J1pFyIBT0pXUw4PTxjWb7MzmFNEIfw/6C84bwE9Eh8JwZZwx3TqVvMe03YoNWlhlnnN93873zA3oXGKS2/1lfJ8N9Sdu60vfW1WUE9fKzBW8HbSPYUIokMk7p0d3tZEGt7gczAGQbY2R0QQPz1lkGJPDn45tuDWEVarEMZpwCOHvads4TAm3tCi/k4Zkv4YdFrIlNv9sJtCbLrcf/QPLMJBaEOAzqlETWb67x4UojpKkejGvYB4ugxjMG/Ts6lCY98mR3djpsPHMBj05+uAudq/ww+UQmsJ33T4kbWtBoXCf87sPZ0YA1n99WQdsLAp71CDUqYhwWS76W9Kj73KBvgyHcD2a/f4vrNSmJLvX774iE5CuCDavykaqGaFazlvYDKJX7QgMiA5mDF7EmXyk3XrqlmFXV11fdeU3Npd7WByygRKUbAyn1j17ct15fF/gOw44xkUvVhub3YvmjJqsHMktOALDUJiNZI X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: f941c3bf-cfde-4ae2-fcd4-08dcd11699a4 X-MS-Exchange-CrossTenant-AuthSource: PH7PR01MB8146.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Sep 2024 21:30:17.8064 (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: THfXKaeC09GNBn1MffUJq6txHafAmKth0Ncr6mLJv3TrIJy/rGRl8xxkGJOTHAtv8lUmZUs1q7ez0ovunW3yjxJGQS7FaVk3QcX3olBTlDE4wOZ8ViJ433Pr/8FO1JzP X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR01MB6919 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240909_143023_120550_7DAF054F X-CRM114-Status: GOOD ( 11.13 ) 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)