From patchwork Wed Nov 29 06:51:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?S3Vhbi1ZaW5nIExlZSAo5p2O5Yag56mOKQ==?= X-Patchwork-Id: 13472277 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E02DC4167B for ; Wed, 29 Nov 2023 06:52:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6C69C6B03AC; Wed, 29 Nov 2023 01:52:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 628066B03AD; Wed, 29 Nov 2023 01:52:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4C8CC6B03AE; Wed, 29 Nov 2023 01:52:32 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 322A26B03AC for ; Wed, 29 Nov 2023 01:52:32 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 13E3740147 for ; Wed, 29 Nov 2023 06:52:32 +0000 (UTC) X-FDA: 81510073344.04.93DB289 Received: from mailgw02.mediatek.com (mailgw02.mediatek.com [216.200.240.185]) by imf07.hostedemail.com (Postfix) with ESMTP id 6036640011 for ; Wed, 29 Nov 2023 06:52:29 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=mediatek.com header.s=dk header.b=InL70sed; dmarc=pass (policy=quarantine) header.from=mediatek.com; spf=pass (imf07.hostedemail.com: domain of kuan-ying.lee@mediatek.com designates 216.200.240.185 as permitted sender) smtp.mailfrom=kuan-ying.lee@mediatek.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1701240749; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=HSLnY3xqrwn+hgoTLGJH8USVe7mquDMPoI+jvrGs6a0=; b=5rLfiZvxPAF5wlew6UirHwdjjAQbJRgl/h4yp5DrLv8pUOsmBDswozhtjKY5YSMFrMGJ2y 4eynhjonoAIQXpOvuj/Y9EbsTP4R0Z01pahAFlKRJftC+GSp6ZnNBRVpMvNsm94K8JDy2i Y2C2eJdPGIRgD9y16TFJBWHrXUWdi8c= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=mediatek.com header.s=dk header.b=InL70sed; dmarc=pass (policy=quarantine) header.from=mediatek.com; spf=pass (imf07.hostedemail.com: domain of kuan-ying.lee@mediatek.com designates 216.200.240.185 as permitted sender) smtp.mailfrom=kuan-ying.lee@mediatek.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1701240749; a=rsa-sha256; cv=none; b=VrXFGOrL/NKskw+L6thymDx7FhwmGLvR7cpIRIYb2VayObfDWPSTPudCRU/vq635Q8AhGn RGfjQ1/V41nBMJsEIqDmH8OUvFzzVhjFkuBAcetzXiG4BFV35DfNI/EELU1sHslW1ywpKn l7s7A/fctWROPp3xxpB+k07CZGWRRg0= X-UUID: d75775c28e8311ee86758d4a7c00f3a0-20231128 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=HSLnY3xqrwn+hgoTLGJH8USVe7mquDMPoI+jvrGs6a0=; b=InL70seds0n1y0DxEG1DBI/ltO8Nik7kro64Uc801Fy2mA5HsuAMVudxqWG+hwDSBVzRHgqgjmIKbVczTk/55G95Y4F6elc6ZcyW6Yg6mHClY8f8DDEI1BjVadRqcirKThfh9r7jkFkfvwgczW6t630GUdMPuWPIYz2EqFvvxVw=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.34,REQID:076c3bd7-49fb-4c1b-b832-904744867f2b,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:abefa75,CLOUDID:0c7bf095-10ce-4e4b-85c2-c9b5229ff92b,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:11|1,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR: NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_ULN X-UUID: d75775c28e8311ee86758d4a7c00f3a0-20231128 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1055065825; Tue, 28 Nov 2023 23:52:19 -0700 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Wed, 29 Nov 2023 14:51:45 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Wed, 29 Nov 2023 14:51:45 +0800 From: Kuan-Ying Lee To: Jan Kiszka , Kieran Bingham , Matthias Brugger , AngeloGioacchino Del Regno , Andrew Morton , Oleg Nesterov CC: , , , , Kuan-Ying Lee , , , , Subject: [PATCH v2 1/3] scripts/gdb/tasks: Fix lx-ps command error Date: Wed, 29 Nov 2023 14:51:38 +0800 Message-ID: <20231129065142.13375-2-Kuan-Ying.Lee@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20231129065142.13375-1-Kuan-Ying.Lee@mediatek.com> References: <20231129065142.13375-1-Kuan-Ying.Lee@mediatek.com> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-AS-Result: No-10--5.095600-8.000000 X-TMASE-MatchedRID: TCPSmmY0AVNXKLar1IWcqhIRh9wkXSlFBdebOqawiLujC1E/zCEIr8Rk oeJ3OFRc3k+CPiKHMcLBSaBGgOy3GNEdmUPXI8FxWd1vvclMcXUUqWKocoJo6WrVm7PW4m4ILPJ tWpbJjY1VzwOWOJEzlnATsg8MODVIHxPMjOKY7A8LbigRnpKlKSPzRlrdFGDwgNwDygWeOSz4rz 9LHo1WfqmfSlSAB+6ZRR6TlvCxdzkqKAHuRowG7g== X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--5.095600-8.000000 X-TMASE-Version: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-SNTS-SMTP: 1549B13AAC282B14084AFFAD7663CDDD84A55DADBFBB687B81633AF352EAF3E42000:8 X-MTK: N X-Rspamd-Queue-Id: 6036640011 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 8ny9txrzpo7yycsf58dbnuutwfg8mmi7 X-HE-Tag: 1701240749-703122 X-HE-Meta: U2FsdGVkX1+NsotYwEgE0T9GG6jWPCDgfQiAf8rdW79p7xryQpll5hDO8ZxGtE0Bb7Vv+gAKXNkvxM+/YgLSY/NTqceqK4C0dMoZNoY5VOfaLZ6aA12/W5qDYDlu2T/MmJMSq6VlP49j2Bfgdd64LXnWdzurzMlYxQdj1tMDtXYx18ahjr9B8QPeRsjixiNRpsYWoDusI8ggK0sHiYqI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LBLg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Since commit 8e1f385104ac ("kill task_struct->thread_group") remove the thread_group, we will encounter below issue. (gdb) lx-ps TASK PID COMM 0xffff800086503340 0 swapper/0 Python Exception : There is no member named thread_group. Error occurred in Python: There is no member named thread_group. We use signal->thread_head to iterate all threads instead. Fixes: 8e1f385104ac ("kill task_struct->thread_group") Cc: stable@vger.kernel.org Signed-off-by: Kuan-Ying Lee Acked-by: Oleg Nesterov Tested-by: Florian Fainelli --- scripts/gdb/linux/tasks.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/scripts/gdb/linux/tasks.py b/scripts/gdb/linux/tasks.py index 17ec19e9b5bf..aa5ab6251f76 100644 --- a/scripts/gdb/linux/tasks.py +++ b/scripts/gdb/linux/tasks.py @@ -13,7 +13,7 @@ import gdb -from linux import utils +from linux import utils, lists task_type = utils.CachedType("struct task_struct") @@ -22,19 +22,15 @@ task_type = utils.CachedType("struct task_struct") def task_lists(): task_ptr_type = task_type.get_type().pointer() init_task = gdb.parse_and_eval("init_task").address - t = g = init_task + t = init_task while True: - while True: - yield t + thread_head = t['signal']['thread_head'] + for thread in lists.list_for_each_entry(thread_head, task_ptr_type, 'thread_node'): + yield thread - t = utils.container_of(t['thread_group']['next'], - task_ptr_type, "thread_group") - if t == g: - break - - t = g = utils.container_of(g['tasks']['next'], - task_ptr_type, "tasks") + t = utils.container_of(t['tasks']['next'], + task_ptr_type, "tasks") if t == init_task: return From patchwork Wed Nov 29 06:51:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?S3Vhbi1ZaW5nIExlZSAo5p2O5Yag56mOKQ==?= X-Patchwork-Id: 13472274 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 357FDC10DAA for ; Wed, 29 Nov 2023 06:52:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5CB046B03AA; Wed, 29 Nov 2023 01:52:31 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 404986B03AD; Wed, 29 Nov 2023 01:52:31 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1E2166B03AC; Wed, 29 Nov 2023 01:52:31 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 073936B03AB for ; Wed, 29 Nov 2023 01:52:31 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id D255D160469 for ; Wed, 29 Nov 2023 06:52:30 +0000 (UTC) X-FDA: 81510073260.11.4F1F994 Received: from mailgw02.mediatek.com (mailgw02.mediatek.com [216.200.240.185]) by imf14.hostedemail.com (Postfix) with ESMTP id EE26E10000F for ; Wed, 29 Nov 2023 06:52:27 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=mediatek.com header.s=dk header.b=V0o9TPNJ; dmarc=pass (policy=quarantine) header.from=mediatek.com; spf=pass (imf14.hostedemail.com: domain of kuan-ying.lee@mediatek.com designates 216.200.240.185 as permitted sender) smtp.mailfrom=kuan-ying.lee@mediatek.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1701240748; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=n+R9PEoL0ecclUC6WsOy0WMmNQrV/Y6UQqst6Epr4yM=; b=KFQVAw63VDv6KmDoN89fpoPlnFhgncLInb5xTcR2ao4Rtfje9wJ2nzzrYThQmujAz74qhD nPXGQTyiU6b+9BhXb41vTfjab23UIUJswWcrYdZM5Ic09KvarqqbmDOgKzT0Bq0BaSZrvu y7WRl7x59aQwUYI1xhM1KtgKHHpAD50= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=mediatek.com header.s=dk header.b=V0o9TPNJ; dmarc=pass (policy=quarantine) header.from=mediatek.com; spf=pass (imf14.hostedemail.com: domain of kuan-ying.lee@mediatek.com designates 216.200.240.185 as permitted sender) smtp.mailfrom=kuan-ying.lee@mediatek.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1701240748; a=rsa-sha256; cv=none; b=MWazbeGqR4udHIS1jNMhn8pWsHJERgyD6UePwEZjSvsM4SAHv1F9tgBbhHqJbFLfCnS+iz pNxeVS6bURNIiNNguNv/WtLA/rfAKBLkb0RO+GvpVaiuMNs8uZ67oGIsx+4L4N+2Ifmy89 PQ+GYHS9SsQaMhYGcKrg3ZOuW/snDUA= X-UUID: d7e1f30a8e8311ee86758d4a7c00f3a0-20231128 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=n+R9PEoL0ecclUC6WsOy0WMmNQrV/Y6UQqst6Epr4yM=; b=V0o9TPNJcFSFmjfQ2E72V0bm5mC/33n9Mw1MKA06neCxe/rM9T/05c1qVE0NH8RH5Tk0cIWM1j1CxM1E1zIdIRz21Exp7YkQ2kREofcQSZ/nUF2Fi8sgAWkDLnzkhgMfmJjZI65y0l7gXisSX5Za/99TSsyDZECcE7nKQsw/TpM=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.34,REQID:5a5b7f6a-8bf7-44e1-b63b-13fa0b4293d5,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:abefa75,CLOUDID:79669b60-c89d-4129-91cb-8ebfae4653fc,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:11|1,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR: NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_ULN X-UUID: d7e1f30a8e8311ee86758d4a7c00f3a0-20231128 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1440792775; Tue, 28 Nov 2023 23:52:20 -0700 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Wed, 29 Nov 2023 14:51:46 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Wed, 29 Nov 2023 14:51:46 +0800 From: Kuan-Ying Lee To: Jan Kiszka , Kieran Bingham , Matthias Brugger , AngeloGioacchino Del Regno CC: , , , , , Kuan-Ying Lee , Andrey Konovalov , , , Subject: [PATCH v2 2/3] scripts/gdb/stackdepot: Rename pool_index to pools_num Date: Wed, 29 Nov 2023 14:51:39 +0800 Message-ID: <20231129065142.13375-3-Kuan-Ying.Lee@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20231129065142.13375-1-Kuan-Ying.Lee@mediatek.com> References: <20231129065142.13375-1-Kuan-Ying.Lee@mediatek.com> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-AS-Result: No-10--0.835400-8.000000 X-TMASE-MatchedRID: +ngMWxkROpBo3s9tP0IpFpA6S0SjvcYU2D9FbDg9BP4gOnjvjQ5gMV6Z DDGofYWNjwQarLbSitQRs1kezRVUMnAd/ISL1gqdA9lly13c/gFKKWJchzA/cTrJEXlYPBg2o8W MkQWv6iXBcIE78YqRWo6HM5rqDwqt8qdBHO1HlsES+YTonSEiTt0PqFWU/tup5zAcFqh011MOMd /q/g+8AskTTa0GhEGXTIXOwb8AX0MtexYu1hdC+zRYUfCeJoD9wZBgUyJVEbl6Fw8/PpTMRaVvm iAyeA2kc5MSfkiJFI5p3LlElBHTlw== X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--0.835400-8.000000 X-TMASE-Version: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-SNTS-SMTP: 7739E709B4D66CEF45A0A4020D64F3EA433CEF59176414BBAB9CD3D85FE3845F2000:8 X-MTK: N X-Rspamd-Queue-Id: EE26E10000F X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: pefc7jojqs4ufcbbk4sjpcgdx6k5e1tn X-HE-Tag: 1701240747-458360 X-HE-Meta: U2FsdGVkX1/ZzTc2dyu8DPSaErs4R9Sh/u3C1dgPI+fhILnyL/wgN4PPI82qK4MW5LstmLxXskFSlEqSrp0t5QAm1eHCpPEYg2d7zTWza+m4KrMQpfbUv3O3ytyR99curE+gf9wAJUwUomWW/hsCdwP6Y/0vaF99N99GiWluDrSZKSKdz2cNAvRq/Oy8kA7IP3xrZRWTkOwbAv9g3fiAl4dmHSVuVRhVAQI5eYZr9MRVlWboNA1AWGjoU2h5Htca9JqK8vra/anHQILX5eB3mMSXqYMIO2EA/IXKx5gOH7ocyTjTY2tluvLZAHvj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ity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: After stackdepot evicting support patchset[1], we rename pool_index to pools_num. To avoid from the below issue, we rename consistently in gdb scripts. Python Exception : No symbol "pool_index" in current context. Error occurred in Python: No symbol "pool_index" in current context. [1] https://lore.kernel.org/linux-mm/cover.1700502145.git.andreyknvl@google.com/ Cc: Andrey Konovalov Signed-off-by: Kuan-Ying Lee Reviewed-by: Florian Fainelli --- scripts/gdb/linux/stackdepot.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/gdb/linux/stackdepot.py b/scripts/gdb/linux/stackdepot.py index 047d329a6a12..0281d9de4b7c 100644 --- a/scripts/gdb/linux/stackdepot.py +++ b/scripts/gdb/linux/stackdepot.py @@ -25,10 +25,10 @@ def stack_depot_fetch(handle): handle_parts_t = gdb.lookup_type("union handle_parts") parts = handle.cast(handle_parts_t) offset = parts['offset'] << DEPOT_STACK_ALIGN - pool_index_cached = gdb.parse_and_eval('pool_index') + pools_num = gdb.parse_and_eval('pools_num') - if parts['pool_index'] > pool_index_cached: - gdb.write("pool index %d out of bounds (%d) for stack id 0x%08x\n" % (parts['pool_index'], pool_index_cached, handle)) + if parts['pool_index'] > pools_num: + gdb.write("pool index %d out of bounds (%d) for stack id 0x%08x\n" % (parts['pool_index'], pools_num, handle)) return gdb.Value(0), 0 stack_pools = gdb.parse_and_eval('stack_pools') From patchwork Wed Nov 29 06:51:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?S3Vhbi1ZaW5nIExlZSAo5p2O5Yag56mOKQ==?= X-Patchwork-Id: 13472275 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0222CC46CA3 for ; Wed, 29 Nov 2023 06:52:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 392746B03A9; Wed, 29 Nov 2023 01:52:31 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 341AA6B03AA; Wed, 29 Nov 2023 01:52:31 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 16CF26B03AD; Wed, 29 Nov 2023 01:52:31 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 05E746B03AA for ; Wed, 29 Nov 2023 01:52:31 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id D35751C0424 for ; Wed, 29 Nov 2023 06:52:30 +0000 (UTC) X-FDA: 81510073260.12.3D2D5CF Received: from mailgw01.mediatek.com (mailgw01.mediatek.com [216.200.240.184]) by imf27.hostedemail.com (Postfix) with ESMTP id E1FEB40005 for ; Wed, 29 Nov 2023 06:52:27 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=mediatek.com header.s=dk header.b=uUnShdgD; dmarc=pass (policy=quarantine) header.from=mediatek.com; spf=pass (imf27.hostedemail.com: domain of kuan-ying.lee@mediatek.com designates 216.200.240.184 as permitted sender) smtp.mailfrom=kuan-ying.lee@mediatek.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1701240748; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=08vSeE6OW9EXx9SVxCK+5GtLZk0M4OycbZa7bfVQrkA=; b=eIBlpZAeJN5/ght9czTe39KITv8joEZ69a/aOE+Fdabv5fFQIZEvaHrycsIELSfeU+naV3 NCsm6H0HTcSWfD4Pv1dSKKfilHGsG3TGL40QC5CvB6az4j9ePdgE2MpO85SuGMrDZw//Z0 jx70fhCccvW4+LKFWtgQhEPhSRekIFU= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=mediatek.com header.s=dk header.b=uUnShdgD; dmarc=pass (policy=quarantine) header.from=mediatek.com; spf=pass (imf27.hostedemail.com: domain of kuan-ying.lee@mediatek.com designates 216.200.240.184 as permitted sender) smtp.mailfrom=kuan-ying.lee@mediatek.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1701240748; a=rsa-sha256; cv=none; b=o/sNQTKM7vpuzKpWTxcX/+/XJl0USGu6QZpWM0uFMWAr4p88cTJWkgwPiEJWwwGbf7qyhi xTlyUzl8NUPKpAOFJMJGj3j0JXV/SB+gf6IFX8zdZGmYjxg7McF3KF3ILIToM8H3s8j9RN UXqCmEQQphKfiaJ4Knt1xb1A1s9dlzY= X-UUID: d81f9f528e8311ee9b7791016c24628a-20231128 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=08vSeE6OW9EXx9SVxCK+5GtLZk0M4OycbZa7bfVQrkA=; b=uUnShdgDLaoKix/086WA47nYc/91Xx9IKD49aLMmCKJnesFJqSBZGRR6QH5p6E3ypkiZiBAOIlLjywAdz//UFkq5nt7Ss82RivuByIfc9xjUCbzcdjbs4Zn65HxudOxL+HZf2GTw3WPcWPSY71n3D7eSgB4NUo2UItCTnUkIPAM=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.34,REQID:9aef4303-3cc5-4e1c-8dc1-cea72f03f761,IP:0,U RL:0,TC:0,Content:42,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:42 X-CID-META: VersionHash:abefa75,CLOUDID:70e73273-1bd3-4f48-b671-ada88705968c,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:4,EDM:-3,IP:nil,U RL:11|1,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR: NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_ULN X-UUID: d81f9f528e8311ee9b7791016c24628a-20231128 Received: from mtkmbs13n1.mediatek.inc [(172.21.101.193)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 152090873; Tue, 28 Nov 2023 23:52:21 -0700 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Wed, 29 Nov 2023 14:51:48 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Wed, 29 Nov 2023 14:51:47 +0800 From: Kuan-Ying Lee To: Jan Kiszka , Kieran Bingham , Matthias Brugger , AngeloGioacchino Del Regno CC: , , , , , Kuan-Ying Lee , , , Subject: [PATCH v2 3/3] scripts/gdb: Remove exception handling and refine print format Date: Wed, 29 Nov 2023 14:51:40 +0800 Message-ID: <20231129065142.13375-4-Kuan-Ying.Lee@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20231129065142.13375-1-Kuan-Ying.Lee@mediatek.com> References: <20231129065142.13375-1-Kuan-Ying.Lee@mediatek.com> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-AS-Result: No-10--0.929400-8.000000 X-TMASE-MatchedRID: jdTirKra2+aWHmpvkeKJB0hwlOfYeSqx3xlpFMX5MCCQ2TbICkFOdk69 FgKoS/097PSkEF73uYd7VWtw6SMI5Kawq2pdPD7UA9lly13c/gGb/LTS0T1K1k4K0IMk2m3GwVB JSJ8GjJw3fJWouRpjSXrw5BSR88yeSoBVPxvX5SSQOktEo73GFOTWKSbLQnNI0w5IABkoK4ejxY yRBa/qJcFwgTvxipFajoczmuoPCq19P2b/9z7kWHSNJjw0OCy9gb7Td4d4rgQuZNN5SUKmZTcKk lC0AO+P7Q3LxoZAUkRSnlLzDnqOReV52TIVUC4lGG2UoSCAHI/BkGBTIlURuXoXDz8+lMxFpW+a IDJ4DaRzkxJ+SIkUjmncuUSUEdOX X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--0.929400-8.000000 X-TMASE-Version: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-SNTS-SMTP: 1709499E65CB7E7AF41F04E97E4A617AD0E61BE14F55DA8E7D4C9D52B5C7303A2000:8 X-MTK: N X-Rspamd-Queue-Id: E1FEB40005 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: rexowim6wcwdatrj3bwciky4jk5ko4dd X-HE-Tag: 1701240747-71495 X-HE-Meta: U2FsdGVkX18aNygqA0YOz7Qz+pVTCkXVL24BOd8+OUulVCCHxoiyDmKViZ2CeULwsT+4P69bOZlptF2GJ+j075CbpJ0ju6S4UE+u3sxhrK6NT5TVL4GdxNFu2grqfcSqvE7iM9t97cbYn7La7G9Uh2Bj8M1hh9Xd0SCxzHiwwnSabbTBDc8wuadn7YRIGbA9jmC0dugEGcAi2Mw/DsKBiqqmcVpTgtf4sxHRNCE3fPPvBygdCfJSZCThEsqAEPmH+oLkUDGgMIsIzUiANx0YK6yxp7Whs6ApGXp8ERxYeGjnQ40hU3IBC78PCtdcUCv5ho4G5XHMAGaVieeoEiai48nf79zgeUtj1AjWa3cPC1jLrWfoh/buWD8vHAonCVCg0z4X/A1CriJEW82qNrVYmbaQpJYYzgdE7PuxYDMJVYNYLetHivWvXWqYFoYo87vLbhWB9c/wadrNtOSFLBjw8mgd4+W1xN2m7F7mwlmu7Qn+a2JWGD7EQjCm8Fqfk16xU/8ZQq48IbTSpDmv01I+VpaUukyuVD62mmC6Qo1oqLFdHdxR+YAut8o/21b+WJWsic3lQ+mUXN/WES4weJwVEjoHocfT3dKjJjPwrVOUo07Kyd23m58cbyCdz+xguXlaf5KxrjsXMAlw2qp40oiHNnQ/jbBriwRcGyB+37oxCaqZn4608CyymTv+A5SKZkLANsb0JzChPZKYHLs+W+/tIQqGyjSlo0zKt6Vpdr6No0eN3LbhD3uHuC/bRDsHjemxSq4Iw9xJNeO1vUuqtU5PD8Fkh82gozv8lohmrJCywym6CKikLUK2xIrBv2kiAWCjM4xzpacMZE3IQjLEI2L5qTcILh+AiP4yosQyQXXuYOZMUaxKUbUdGAEvLqomXQskvrB2J0QAqcQ/XEGGvBKQYtD6WlrNuJym3ti/TZAbBo/8rNkkiVNqN60X/IaciPhzaBqznRy5U/lDsd9pGBg XdklN2md xyz7WCDHPUHYwIKwNHEEzEGAuRmEyuSfCGaXy6A5xOFn674queFS+jivJUC7cun3izT8r2qHygpF6ONoPbyWUe6pUk/8agi47fDoWDy22l78IoAmyxy8q7PrbAxvO91s1dCBpjBvJ3Q03geGJ74bpRlZjDQGE3Qf2o+6htzbuTP9lRCFWLvduuHLTaDDNXIInyVSh1G5PuwX5ydNPEtX6991abnl0uZbsl79w9ZUn4o1j6K6njs8yzrKFXg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 1. When we crash on a page, we want to check what happened on this page instead of skipping this page by try-catch block. Thus, removing the try-catch block. 2. Remove redundant comma and print the task name properly. Signed-off-by: Kuan-Ying Lee --- scripts/gdb/linux/page_owner.py | 58 ++++++++++++++------------------- scripts/gdb/linux/slab.py | 3 +- 2 files changed, 26 insertions(+), 35 deletions(-) diff --git a/scripts/gdb/linux/page_owner.py b/scripts/gdb/linux/page_owner.py index 844fd5d0c912..8e713a09cfe7 100644 --- a/scripts/gdb/linux/page_owner.py +++ b/scripts/gdb/linux/page_owner.py @@ -122,27 +122,24 @@ class DumpPageOwner(gdb.Command): if not (page_ext['flags'] & (1 << PAGE_EXT_OWNER_ALLOCATED)): gdb.write("page_owner is not allocated\n") - try: - page_owner = self.get_page_owner(page_ext) - gdb.write("Page last allocated via order %d, gfp_mask: 0x%x, pid: %d, tgid: %d (%s), ts %u ns, free_ts %u ns\n" %\ - (page_owner["order"], page_owner["gfp_mask"],\ - page_owner["pid"], page_owner["tgid"], page_owner["comm"],\ - page_owner["ts_nsec"], page_owner["free_ts_nsec"])) - gdb.write("PFN: %d, Flags: 0x%x\n" % (pfn, page['flags'])) - if page_owner["handle"] == 0: - gdb.write('page_owner allocation stack trace missing\n') - else: - stackdepot.stack_depot_print(page_owner["handle"]) + page_owner = self.get_page_owner(page_ext) + gdb.write("Page last allocated via order %d, gfp_mask: 0x%x, pid: %d, tgid: %d (%s), ts %u ns, free_ts %u ns\n" %\ + (page_owner["order"], page_owner["gfp_mask"],\ + page_owner["pid"], page_owner["tgid"], page_owner["comm"].string(),\ + page_owner["ts_nsec"], page_owner["free_ts_nsec"])) + gdb.write("PFN: %d, Flags: 0x%x\n" % (pfn, page['flags'])) + if page_owner["handle"] == 0: + gdb.write('page_owner allocation stack trace missing\n') + else: + stackdepot.stack_depot_print(page_owner["handle"]) - if page_owner["free_handle"] == 0: - gdb.write('page_owner free stack trace missing\n') - else: - gdb.write('page last free stack trace:\n') - stackdepot.stack_depot_print(page_owner["free_handle"]) - if page_owner['last_migrate_reason'] != -1: - gdb.write('page has been migrated, last migrate reason: %s\n' % self.migrate_reason_names[page_owner['last_migrate_reason']]) - except: - gdb.write("\n") + if page_owner["free_handle"] == 0: + gdb.write('page_owner free stack trace missing\n') + else: + gdb.write('page last free stack trace:\n') + stackdepot.stack_depot_print(page_owner["free_handle"]) + if page_owner['last_migrate_reason'] != -1: + gdb.write('page has been migrated, last migrate reason: %s\n' % self.migrate_reason_names[page_owner['last_migrate_reason']]) def read_page_owner(self): pfn = self.min_pfn @@ -173,18 +170,13 @@ class DumpPageOwner(gdb.Command): pfn += 1 continue - try: - page_owner = self.get_page_owner(page_ext) - gdb.write("Page allocated via order %d, gfp_mask: 0x%x, pid: %d, tgid: %d (%s), ts %u ns, free_ts %u ns\n" %\ - (page_owner["order"], page_owner["gfp_mask"],\ - page_owner["pid"], page_owner["tgid"], page_owner["comm"],\ - page_owner["ts_nsec"], page_owner["free_ts_nsec"])) - gdb.write("PFN: %d, Flags: 0x%x\n" % (pfn, page['flags'])) - stackdepot.stack_depot_print(page_owner["handle"]) - pfn += (1 << page_owner["order"]) - continue - except: - gdb.write("\n") - pfn += 1 + page_owner = self.get_page_owner(page_ext) + gdb.write("Page allocated via order %d, gfp_mask: 0x%x, pid: %d, tgid: %d (%s), ts %u ns, free_ts %u ns\n" %\ + (page_owner["order"], page_owner["gfp_mask"],\ + page_owner["pid"], page_owner["tgid"], page_owner["comm"].string(),\ + page_owner["ts_nsec"], page_owner["free_ts_nsec"])) + gdb.write("PFN: %d, Flags: 0x%x\n" % (pfn, page['flags'])) + stackdepot.stack_depot_print(page_owner["handle"]) + pfn += (1 << page_owner["order"]) DumpPageOwner() diff --git a/scripts/gdb/linux/slab.py b/scripts/gdb/linux/slab.py index f012ba38c7d9..0e2d93867fe2 100644 --- a/scripts/gdb/linux/slab.py +++ b/scripts/gdb/linux/slab.py @@ -228,8 +228,7 @@ def slabtrace(alloc, cache_name): nr_cpu = gdb.parse_and_eval('__num_online_cpus')['counter'] if nr_cpu > 1: gdb.write(" cpus=") - for i in loc['cpus']: - gdb.write("%d," % i) + gdb.write(','.join(str(cpu) for cpu in loc['cpus'])) gdb.write("\n") if constants.LX_CONFIG_STACKDEPOT: if loc['handle']: