From mboxrd@z Thu Jan 1 00:00:00 1970 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 8CE33C30653 for ; Wed, 26 Jun 2024 10:03:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E7FDF6B007B; Wed, 26 Jun 2024 06:03:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E3AA06B0082; Wed, 26 Jun 2024 06:03:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CAAEC6B0083; Wed, 26 Jun 2024 06:03:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id ACCD06B007B for ; Wed, 26 Jun 2024 06:03:57 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 2E40C1C0CDC for ; Wed, 26 Jun 2024 10:03:57 +0000 (UTC) X-FDA: 82272603714.06.6A027FD Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2051.outbound.protection.outlook.com [40.107.255.51]) by imf11.hostedemail.com (Postfix) with ESMTP id EAB9C4002A for ; Wed, 26 Jun 2024 10:03:53 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=oppo.com header.s=selector1 header.b=mFQ0FtQL; dmarc=pass (policy=quarantine) header.from=oppo.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf11.hostedemail.com: domain of hailong.liu@oppo.com designates 40.107.255.51 as permitted sender) smtp.mailfrom=hailong.liu@oppo.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1719396222; a=rsa-sha256; cv=pass; b=HyJ5ZK2uimfqzifrEcxYgilsauiyWDwONVnTrKh5IKFMOw8NrnCTKaQv2fmUZM/4WUf17R OlZIF8fxerbXpTZevRYCy9d8icz7i65DD5a0Ex3HQYR+8Qtef2bqlC2PPifSPK7PDd9B5q 5ZssLvpwsFYUDArRq9HEsPjprwFiO3U= ARC-Authentication-Results: i=2; imf11.hostedemail.com; dkim=pass header.d=oppo.com header.s=selector1 header.b=mFQ0FtQL; dmarc=pass (policy=quarantine) header.from=oppo.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf11.hostedemail.com: domain of hailong.liu@oppo.com designates 40.107.255.51 as permitted sender) smtp.mailfrom=hailong.liu@oppo.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719396222; 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=eZvnVaEwxpTQyauTTLqZou+VXTcWoWvqSQsp/cTpTdo=; b=EzOXjIk6+d6pfQW3zr/AzPN9qccBntmHov9prDJ37azJI9STyTAfhqG2ebpFxDeIf3R/oS hHPbblD6Kf3JSrTBQUxhdhK7yyZtS7mpr+2FsWwWD8d8MoRHLXt/C+P+G31OnYJWBySYOz fg/IAzHADeD7F3sIbUyucHb9uBMJjH4= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HYspFKHz2MrFlrrQ3jl3ma6R79zeegXD3bAAyyYi2zX5HmxdNvmGT9QD1gJbBFM3mZffPk5yJhRRfjvsYu6G0wP04Z6oLP70AHiuN/QPhkWkcY84IyqZMCj7AbvRLKx8lhfb6F0p2Pn8Rv4SSlIsms5dji9bxlay7wJSpBskX5K70DWatRy7j3ZuwcPrFnoC5SdoUWlbb9SLoV/P0ay7phaYmmVSXbQSLqSR3ZtIO8URB3fJrpN3YT9rpBeNWFUtnwq/f/Zc+QJGLX/5/UrV8FojvIDd06z00FNqMldrrMmoJunlnNcYqPKh8N7kUrziTEFQ0wpAJ5k4Kc6Vc7t8kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=eZvnVaEwxpTQyauTTLqZou+VXTcWoWvqSQsp/cTpTdo=; b=ZShHD3p1f6KP6ZEn/til5YwRUKFMKLcspSbNKfH6IFBJsS/QorRVigDcEGAQc5LqQZ2s20/cKPQrMgQj2fEt25MgIXUZvFwGaZfzVPl3pen2qRBSvGb2IPnjg8I9aAMYFRlUHnIx0JiVl3yLmvrXTKg7akbSrK5xGlbNfngndMDa++0bOAAs1CFZIP2bkhrutGiwd4fqV8Ls0hB2MCFJ+zFwYREwIriYpemsooYT0Mftt4PvnNTGgEsSjA5BPPNbrU53FGSYCDRc9Db6PebDM0qs+G+5aoXPj3z973BJeQwRp4ZX2kxaFnw6G87iwGQ4WC0N9B8/QANAxGoNNe4voA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 58.252.5.68) smtp.rcpttodomain=gmail.com smtp.mailfrom=oppo.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=oppo.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oppo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eZvnVaEwxpTQyauTTLqZou+VXTcWoWvqSQsp/cTpTdo=; b=mFQ0FtQLWmd40ZOLXtw8822xsrXj0ogOpn0niRqTUAeEgCRHMbWJEblv8hrYHvRzbery/VMwhShRdCGp3PmZQ1nUvmvQxDZefl6q7ZElDW6SOxITQt8roHmHCF9NUUB3ZMMaBGPK+A7/uphxL1YyJyPOhPon5+KtwLVSKEei3aQ= Received: from SGAP274CA0017.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b6::29) by SEZPR02MB5934.apcprd02.prod.outlook.com (2603:1096:101:76::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.30; Wed, 26 Jun 2024 10:03:49 +0000 Received: from SG2PEPF000B66CD.apcprd03.prod.outlook.com (2603:1096:4:b6:cafe::e) by SGAP274CA0017.outlook.office365.com (2603:1096:4:b6::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.22 via Frontend Transport; Wed, 26 Jun 2024 10:03:48 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 58.252.5.68) smtp.mailfrom=oppo.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=oppo.com; Received-SPF: Pass (protection.outlook.com: domain of oppo.com designates 58.252.5.68 as permitted sender) receiver=protection.outlook.com; client-ip=58.252.5.68; helo=mail.oppo.com; pr=C Received: from mail.oppo.com (58.252.5.68) by SG2PEPF000B66CD.mail.protection.outlook.com (10.167.240.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Wed, 26 Jun 2024 10:03:48 +0000 Received: from oppo.com (172.16.40.118) by mailappw31.adc.com (172.16.56.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 26 Jun 2024 18:03:47 +0800 Date: Wed, 26 Jun 2024 18:03:42 +0800 From: Hailong Liu To: Uladzislau Rezki CC: Baoquan He , Nick Bowler , , Linux regressions mailing list , , , Andrew Morton Subject: Re: PROBLEM: kernel crashes when running xfsdump since ~6.4 Message-ID: <20240626100342.2dudj6fjjx6srban@oppo.com> References: <20240626051206.mx2r4iy3wpexykay@oppo.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: X-Originating-IP: [172.16.40.118] X-ClientProxiedBy: mailappw31.adc.com (172.16.56.198) To mailappw31.adc.com (172.16.56.198) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SG2PEPF000B66CD:EE_|SEZPR02MB5934:EE_ X-MS-Office365-Filtering-Correlation-Id: 968c00a8-2aa7-4870-526e-08dc95c745d8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230038|36860700011|376012|1800799022|82310400024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?H6JcD6L7iZFZEU+6qk2QUV5A2BpiKIL1fuVcu9pBc3Vmx/8uz3JXuL5zODG6?= =?us-ascii?Q?GtDhT0FLUwRb2PRpUopRFBoVOuwztmpD3bFQP2eA3D7sVB3XjgpG/pRQTvho?= =?us-ascii?Q?KjYmjOWBSh/lRntgzpOyeZe6FFa/2kRCZciUquLo6x1muwXXjE51OGlr2GyM?= =?us-ascii?Q?OvETPhCWQ3jqY+Kd4XDANQC2bfZCcA7zcLhyb+62qnKs3woK2Pny3p2H5sAR?= =?us-ascii?Q?yz7HqoI/W4OtwJZz4TuLr2qGqL15GjMsi0hIc7XEcHFATxEznJ89idKcC6+q?= =?us-ascii?Q?K0qzM+iZG0dE/WUpOuIB1SMjqWFCgX03helG5aQdskT0ZhajMBeOmp6Y0AHh?= =?us-ascii?Q?ua4yt4NICs63y6vuaC6Z3JgePf8qkwftLJ+B39lHAxIajSelpAhyKwGdFv/8?= =?us-ascii?Q?Tba16y1XeouHD1yY0/RQ+lM/HaBzOJbCokPVhWZ2H8ne5OHNgMA8tM039xkI?= =?us-ascii?Q?g0sr6S4JTXUxKW5HJAgglDZXuRb0Q2zsSTNrtF5rDxOvyEyfPBcL2DLr+i0s?= =?us-ascii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6iQ=3D=3D?= X-Forefront-Antispam-Report: CIP:58.252.5.68;CTRY:CN;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.oppo.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230038)(36860700011)(376012)(1800799022)(82310400024);DIR:OUT;SFP:1101; X-OriginatorOrg: oppo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jun 2024 10:03:48.1665 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 968c00a8-2aa7-4870-526e-08dc95c745d8 X-MS-Exchange-CrossTenant-Id: f1905eb1-c353-41c5-9516-62b4a54b5ee6 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f1905eb1-c353-41c5-9516-62b4a54b5ee6;Ip=[58.252.5.68];Helo=[mail.oppo.com] X-MS-Exchange-CrossTenant-AuthSource: SG2PEPF000B66CD.apcprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR02MB5934 X-Rspamd-Queue-Id: EAB9C4002A X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 6kxigzkox7nqui9rtrff39dyut9zbqa3 X-HE-Tag: 1719396233-504259 X-HE-Meta: U2FsdGVkX1/DXIhyaaJt+kX/ToE+irWlOz1TGyrKibQfchAkIb+0kUAtVVz50bdwzW0RyAfGp3jZsFUJ/NMbO7eA3TlnQVhlPkl/x/tf99LG8Kqc6CeEQrwuu8vKKJ6RKGGg01K6olQjgPWG1rMb417W7KhdTrwMLO2c4WkD+HNvpXT/+TkkNdyOUub73wAuRy/9zs6uSPzLjwe90vuLqfVPkvaoI+UC5Am+64AefSBsNj//HwgiMlEhrhSsQw+nULATXsrUfV+M2MPdCHYmIECGoga2Pv9jg+2LMD4hvAAKUBXvZnDfe1ZfFNXOBwOZOkWqIWxY0yceKccYgSESqhZc/VouBl2K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ender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Wed, 26. Jun 11:15, Uladzislau Rezki wrote: > On Wed, Jun 26, 2024 at 01:12:06PM +0800, Hailong Liu wrote: > > On Tue, 25. Jun 22:05, Uladzislau Rezki wrote: > > > > > > > > /** > > > > > > > > * cpumask_next - get the next cpu in a cpumask > > > > > > > > * @n: the cpu prior to the place to search (i.e. return will be > @n) > > > > > > > > * @srcp: the cpumask pointer > > > > > > > > * > > > > > > > > * Return: >= nr_cpu_ids if no further cpus set. > > > > > > > > > > > > > > Ah, I got what you mean. In the vbq case, it may not have chance to get > > > > > > > a return number as nr_cpu_ids. Becuase the hashed index limits the > > > > > > > range to [0, nr_cpu_ids-1], and cpu_possible(index) will guarantee it > > > > > > > won't be the highest cpu number [nr_cpu_ids-1] since CPU[nr_cpu_ids-1] must > > > > > > > be possible CPU. > > > > > > > > > > > > > > Do I miss some corner cases? > > > > > > > > > > > > > Right. We guarantee that a highest CPU is available by doing: % nr_cpu_ids. > > > > > > So we do not need to use *next_wrap() variant. You do not miss anything :) > > > > > > > > > > > > Hailong Liu has proposed more simpler version: > > > > > > > > > > > > > > > > > > diff --git a/mm/vmalloc.c b/mm/vmalloc.c > > > > > > index 11fe5ea208aa..e1e63ffb9c57 100644 > > > > > > --- a/mm/vmalloc.c > > > > > > +++ b/mm/vmalloc.c > > > > > > @@ -1994,8 +1994,9 @@ static struct xarray * > > > > > > addr_to_vb_xa(unsigned long addr) > > > > > > { > > > > > > int index = (addr / VMAP_BLOCK_SIZE) % num_possible_cpus(); > > > > > > + int cpu = cpumask_nth(index, cpu_possible_mask); > > > > > > > > > > > > - return &per_cpu(vmap_block_queue, index).vmap_blocks; > > > > > > + return &per_cpu(vmap_block_queue, cpu).vmap_blocks; > > > > > > > > > > > > > > > > > > which just takes a next CPU if an index is not set in the cpu_possible_mask. > > > > > > > > > > > > The only thing that can be updated in the patch is to replace num_possible_cpu() > > > > > > by the nr_cpu_ids. > > > > > > > > > > > > Any thoughts? I think we need to fix it by a minor change so it is > > > > > > easier to back-port on stable kernels. > > > > > > > > > > Yeah, sounds good since the regresson commit is merged in v6.3. > > > > > Please feel free to post this and the hash array patch separately for > > > > > formal reviewing. > > > > > > > > > Agreed! The patch about hash array i will post later. > > > > > > > > > By the way, when I am replying this mail, I check the cpumask_nth() > > > > > again. I doubt it may take more checking then cpu_possible(), given most > > > > > of systems don't have gaps in cpu_possible_mask. I could be dizzy at > > > > > this moment. > > > > > > > > > > static inline unsigned int cpumask_nth(unsigned int cpu, const struct cpumask *srcp) > > > > > { > > > > > return find_nth_bit(cpumask_bits(srcp), small_cpumask_bits, cpumask_check(cpu)); > > > > > } > > > > > > > > > Yep, i do not think it is a big problem based on your noted fact. > > > > > > > Checked. There is a difference: > > > > > > 1. Default > > > > > > > > > ... > > > + 15.95% 6.05% [kernel] [k] __vmap_pages_range_noflush > > > + 15.91% 1.74% [kernel] [k] addr_to_vb_xa <--------------- > > > + 15.13% 12.05% [kernel] [k] vunmap_p4d_range > > > + 14.17% 13.38% [kernel] [k] __find_nth_bit <-------------- > > > + 10.62% 0.00% [kernel] [k] ret_from_fork_asm > > > + 10.62% 0.00% [kernel] [k] ret_from_fork > > > + 10.62% 0.00% [kernel] [k] kthread > > > ... > > > > > > > > > 2. Check if cpu_possible() and then fallback to cpumask_nth() if not > > > > > > > > > ... > > > + 6.84% 0.29% [kernel] [k] alloc_vmap_area > > > + 6.80% 6.70% [kernel] [k] native_queued_spin_lock_slowpath > > > + 4.24% 0.09% [kernel] [k] free_vmap_block > > > + 2.41% 2.38% [kernel] [k] addr_to_vb_xa <----------- > > > + 1.94% 1.91% [kernel] [k] xas_start > > > ... > > > > > > > > > It is _worth_ to check if an index is in possible mask: > > > > > > diff --git a/mm/vmalloc.c b/mm/vmalloc.c > > > index 45e1506d58c3..af20f78c2cbf 100644 > > > --- a/mm/vmalloc.c > > > +++ b/mm/vmalloc.c > > > @@ -2542,7 +2542,10 @@ static DEFINE_PER_CPU(struct vmap_block_queue, vmap_block_queue); > > > static struct xarray * > > > addr_to_vb_xa(unsigned long addr) > > > { > > > - int index = (addr / VMAP_BLOCK_SIZE) % num_possible_cpus(); > > > + int index = (addr / VMAP_BLOCK_SIZE) % nr_cpu_ids; > > IIUC, use nr_cpu_ids here maybe incorrect. > > > > take b101 as example, nr_cpu_ids is 3. if index is 2 cpumask_nth(2, cpu_possible_mask); > > might return 64. > > > But then a CPU2 becomes possible? Cutting by % nr_cpu_ids generates values < nr_cpu_ids. > So, last CPU is always possible and we never do cpumask_nth() on a last possible CPU. > > What i miss here? > Sorry, I forget to reply to all :), I write a demo to test as follows: static int cpumask_init(void) { struct cpumask mask; unsigned int cpu_id; cpumask_clear(&mask); cpumask_set_cpu(1, &mask); cpumask_set_cpu(3, &mask); cpumask_set_cpu(5, &mask); cpu_id = find_last_bit(cpumask_bits(&mask), NR_CPUS) + 1; pr_info("cpu_id:%d\n", cpu_id); for (; i < nr_cpu_ids; i++) { pr_info("%d: cpu_%d\n", i, cpumask_nth(i, &mask)); } return 0; } [ 1.337020][ T1] cpu_id:6 [ 1.337338][ T1] 0: cpu_1 [ 1.337558][ T1] 1: cpu_3 [ 1.337751][ T1] 2: cpu_5 [ 1.337960][ T1] 3: cpu_64 [ 1.338183][ T1] 4: cpu_64 [ 1.338387][ T1] 5: cpu_64 [ 1.338594][ T1] 6: cpu_64 In summary, the nr_cpu_ids = last_bit + 1, and cpumask_nth() return the nth cpu_id. -- help you, help me, Hailong. > -- > Uladzislau Rezki -- help you, help me, Hailong.