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+u3sxh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ydNPEtX6991abnl0uZbsl79w9ZUn4o1j6K6njs8yzrKFXg== 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']: