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