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 06FF6C2BA1A for ; Fri, 21 Jun 2024 11:16:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3AD288D0152; Fri, 21 Jun 2024 07:16:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 35C728D00DB; Fri, 21 Jun 2024 07:16:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1AF5D8D0152; Fri, 21 Jun 2024 07:16:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id EAAB48D00DB for ; Fri, 21 Jun 2024 07:16:01 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 5980040DBA for ; Fri, 21 Jun 2024 11:16:01 +0000 (UTC) X-FDA: 82254641322.23.9660096 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2073.outbound.protection.outlook.com [40.107.255.73]) by imf19.hostedemail.com (Postfix) with ESMTP id 130CC1A0003 for ; Fri, 21 Jun 2024 11:15:57 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=oppo.com header.s=selector1 header.b=gWqfZNRi; dmarc=pass (policy=quarantine) header.from=oppo.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf19.hostedemail.com: domain of hailong.liu@oppo.com designates 40.107.255.73 as permitted sender) smtp.mailfrom=hailong.liu@oppo.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1718968550; a=rsa-sha256; cv=pass; b=RW7v+MCLxj93NC2nChSV8FplSUXPnyOcrjde+ttEdd3IFx7AsAEqV8gw/4PwmLWDp30xWq TPW7Xm0cecr5JS52abKP0eqvIACfkuFw2qlZH+fy9shazzwaxAl37lnXKP7oKsl4zcFEAB BfAhT0yveIsL0Bg2+H/UomVOHN9ypYg= ARC-Authentication-Results: i=2; imf19.hostedemail.com; dkim=pass header.d=oppo.com header.s=selector1 header.b=gWqfZNRi; dmarc=pass (policy=quarantine) header.from=oppo.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf19.hostedemail.com: domain of hailong.liu@oppo.com designates 40.107.255.73 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=1718968550; 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=Aul5vaVzJf++w+6GW0Zz8yhsj/0b1HhMbOFLJk61bkI=; b=4RXB7Z6uCTS/0mkncOpcNUyEBOlwWBhFQvDp2ti7MjCCGuKB4wIieClANAb1nFBLuEGuq2 eTHoE/0j4ob+0ZlP0VJKIYXLHm2OVp25G1KPuiebz4xnl5/HVa8KVobuAxxcGamfAj86pd alj67pYD/ZfLpoxJfU7Q62t0t4eb0Wc= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RPWH7J3if0/Fx9k6yKObkpd2+UnmkD8vV8TROWJ8QZ6P4uXLG9UyKcOrxfW3/lhQYj7XWbLFhvZMAkJVhNGoHCZNFSDmAZvBki7Iuvj/saH4voSv5jGiY3VqUMMqc2aUaoGo58OAyrUwSTZyDnyfCl2IQVRAyZEIRI6AWxmGVoF7A9J8lsuEEzqt4HPfTuZARgTeRXmxaClR4KkvaKkAnIpx5ECWjld8Ck+7UT1V46YSi6wd67qd82KbOkEilw5mUb4W5VXBkXAemuCQEHntkQSC+CcSPUDY6//pu8cbrzIuPCQzA3ltNgC+sSSNcelO6JYznbqTfmp3T2AtuGqYkw== 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=Aul5vaVzJf++w+6GW0Zz8yhsj/0b1HhMbOFLJk61bkI=; b=XYFvTOjsjee1iBHIEVeY8i2iRjhVWxKzY2sp5M31//af2B9/idU0OjCEoSPCCYjgOrDlh/irEPXwBCAZXyt9oy+ylDxZ6aHyEaOYf61+VQa63ljaw2QkXuUAbvQBTbKVoZlEZLPQ5RPdMGuTLD6ObUi1EGBjmZfx/Sr8lP2RE5D6cGPsvDqMffpCAo6RXEsYNosSNvkDpchdUUV9nYnLL9O2Pqoj/QcQ6i+wcS3QQWCDsfBE43OogXD+zGyQF8Rzy+2G/1yKeLD7JtYvHrsSVTn7L1XGrIi4/lvo+vbhI8ZyynuwMTxjOrFoDQm1ZmaEkLi0ZpYfYPhfIHb5GlCvUQ== 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=Aul5vaVzJf++w+6GW0Zz8yhsj/0b1HhMbOFLJk61bkI=; b=gWqfZNRi2/mQIcrYjuFAQm9DNnNkXDmAHB285kwSqI9AEnmmcvjOPCHrYov6Uk8383j9j7QXxFLOawbitTy0nMUz9eJRWWqRGvfV65ZkXB6QdC2tQHTA5s7NoLpD/BUdHjA6Cp8uV2S8HQ00x7EjKt7HfzNnTBKLwyXvay76+6c= Received: from SI2PR01CA0008.apcprd01.prod.exchangelabs.com (2603:1096:4:191::10) by SG2PR02MB5724.apcprd02.prod.outlook.com (2603:1096:4:1b4::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.34; Fri, 21 Jun 2024 11:15:51 +0000 Received: from SG1PEPF000082E6.apcprd02.prod.outlook.com (2603:1096:4:191:cafe::48) by SI2PR01CA0008.outlook.office365.com (2603:1096:4:191::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.34 via Frontend Transport; Fri, 21 Jun 2024 11:15:51 +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 SG1PEPF000082E6.mail.protection.outlook.com (10.167.240.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.15 via Frontend Transport; Fri, 21 Jun 2024 11:15:51 +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; Fri, 21 Jun 2024 19:15:50 +0800 Date: Fri, 21 Jun 2024 19:15:45 +0800 From: Hailong Liu To: Uladzislau Rezki , Baoquan He CC: Nick Bowler , , Linux regressions mailing list , , , Andrew Morton Subject: Re: PROBLEM: kernel crashes when running xfsdump since ~6.4 Message-ID: <20240621111545.awvgrap2nscgehxv@oppo.com> References: <75e17b57-1178-4288-b792-4ae68b19915e@draconx.ca> <00d74f24-c49c-460e-871c-d5af64701306@draconx.ca> <20240621033005.6mccm7waduelb4m5@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: SG1PEPF000082E6:EE_|SG2PR02MB5724:EE_ X-MS-Office365-Filtering-Correlation-Id: 1542f1f7-172f-4d61-1e89-08dc91e382b7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|1800799021|82310400023|376011|36860700010; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Zm7oMC2yOGdOgIzta3wdwwJVrQ7sNIrIUGL8VWKoGr2Dwcxd9R2oE+dpEsm/?= =?us-ascii?Q?kV/aq01Uu2VsNlQ++06rFGfb6Pk3KdppF7L+xUUfbH3f5qlg2zGZT/6udlfD?= =?us-ascii?Q?EEFaOxT2c1/RQ4soR4CL+yMykaN6rSQ5OPg4Wi6WrGXaIKjDJpuUbqrvhiWs?= =?us-ascii?Q?3kMdy1gAzIV4yCMWoa8ZyFMzRJ5L4o4YfHy4TICE3zYGCJjf9Mtout08tjqE?= =?us-ascii?Q?FzDWTZpDdJF3emlc2by30HB9I9Nep/vpUiIuN/hT6gTXqvyfMEHyOyw0V/8L?= =?us-ascii?Q?O9KtjoLPbdCQ2byCPdYfRn0X9J7qUoadUuoCHqBKvk1k8nfQmC0d7ng8ht3c?= =?us-ascii?Q?j7Hzti+DUesDt4N0ur34ewe22bFEd/b8dQDXsoETs6wkvDHemoHu8Zx/chJL?= =?us-ascii?Q?i+NuTpehqVd+ZWlzonE45C3HruZncd924p4F0nkX22dBc+5f0GSiPfkUmXj2?=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WCiP5aZz/yf9D0d1eXih9Uhed?= =?us-ascii?Q?J0YlwFRV3x4lF72lqVmA0obn30Tc9Obe51ZVrwfnmTo+waqnMQ=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:(13230037)(1800799021)(82310400023)(376011)(36860700010);DIR:OUT;SFP:1101; X-OriginatorOrg: oppo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jun 2024 11:15:51.5473 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1542f1f7-172f-4d61-1e89-08dc91e382b7 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: SG1PEPF000082E6.apcprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SG2PR02MB5724 X-Rspamd-Queue-Id: 130CC1A0003 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: n79j89sdcdu189ncqpuemg61hz4ntq1g X-HE-Tag: 1718968557-530455 X-HE-Meta: U2FsdGVkX18UesJ0YIfxXr6B5bSbz16+wrvRJbKeJLyCxTa1mbK8KCkaSkIqbJxkjWnyGD2jF7dPro4y9qdkBbgx5gUY3aZE3BT0ltQq/iS3XS+5I2f9Ic2n+E647+hPrtOAzqSKGx4qmnduFAhZ3m649qjL2qyopWlRMklxzow9Nv7g2/wcIhwQrOzIOt88v7d7yWtWSP7Un/ch2xh3AqG0o0zz2DDqSDDD4ZhdUYlrCu2cWhIJEqo1JaVDbh0+OAGiIyg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LH4seyAcmoMFD85SvYX+sxql7ee3P1a5Gt3h0eBwUb+0yFtMgXREXhkOT3oNllSNT5o 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: On Fri, 21. Jun 11:44, Uladzislau Rezki wrote: > On Fri, Jun 21, 2024 at 03:07:16PM +0800, Baoquan He wrote: > > On 06/21/24 at 11:30am, Hailong Liu wrote: > > > On Thu, 20. Jun 14:02, Nick Bowler wrote: > > > > On 2024-06-20 02:19, Nick Bowler wrote: > > > > > After upgrading my sparc to 6.9.5 I noticed that attempting to run > > > > > xfsdump instantly (within a couple seconds) and reliably crashes the > > > > > kernel. The same problem is also observed on 6.10-rc4. > > > > [...] > > > > > 062eacf57ad91b5c272f89dc964fd6dd9715ea7d is the first bad commit > > > > > commit 062eacf57ad91b5c272f89dc964fd6dd9715ea7d > > > > > Author: Uladzislau Rezki (Sony) > > > > > Date: Thu Mar 30 21:06:38 2023 +0200 > > > > > > > > > > mm: vmalloc: remove a global vmap_blocks xarray > > > > > > > > I think I might see what is happening here. > > > > > > > > On this machine, there are two CPUs numbered 0 and 2 (there is no CPU1). > > > > > > > +Baoquan > > > > Thanks for adding me, Hailong. > > > > > > > > Ahh, I thought you are right. addr_to_vb_xa assume that the CPU numbers are > > > contiguous. I don't have knowledge about CPU at all. > > > Technically change the implement addr_to_vb_xa() to > > > return &per_cpu(vmap_block_queue, raw_smp_processor_id()).vmap_blocks; > > > would also work, but it violate the load balance. Wating for > > > experts reply. > > > > Yeah, I think so as you explained. > > > > > > > > > The per-cpu variables in mm/vmalloc.c are initialized like this, in > > > > vmalloc_init > > > > > > > > for_each_possible_cpu(i) { > > > > /* ... */ > > > > vbq = &per_cpu(vmap_block_queue, i); > > > > /* initialize stuff in vbq */ > > > > } > > > > > > > > This loops over the set bits of cpu_possible_mask, bits 0 and 2 are set, > > > > so it initializes stuff with i=0 and i=2, skipping i=1 (I added prints to > > > > confirm this). > > > > > > > > Then, in vm_map_ram, with the problematic change it calls the new > > > > function addr_to_vb_xa, which does this: > > > > > > > > int index = (addr / VMAP_BLOCK_SIZE) % num_possible_cpus(); > > > > return &per_cpu(vmap_block_queue, index).vmap_blocks; > > > > > > > > The num_possible_cpus() function counts the number of set bits in > > > > cpu_possible_mask, so it returns 2. Thus, index is either 0 or 1, which > > > > does not correspond to what was initialized (0 or 2). The crash occurs > > > > when the computed index is 1 in this function. In this case, the > > > > returned value appears to be garbage (I added prints to confirm this). > > > > This is a great catch. > > > Indeed :) > > > > > > > > > If I change addr_to_vb_xa function to this: > > > > > > > > int index = ((addr / VMAP_BLOCK_SIZE) & 1) << 1; /* 0 or 2 */ > > > > return &per_cpu(vmap_block_queue, index).vmap_blocks; > > > > Yeah, while above change is not generic, e.g if it's CPU0 and CPU3. > > I think we should take the max possible CPU number as the hush bucket > > size. The vb->va is also got from global free_vmap_area, so no need to > > worry about the waste. > > > Agree. > > > diff --git a/mm/vmalloc.c b/mm/vmalloc.c > > index be2dd281ea76..18e87cafbaf2 100644 > > --- a/mm/vmalloc.c > > +++ b/mm/vmalloc.c > > @@ -2542,7 +2542,7 @@ 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; > > > > return &per_cpu(vmap_block_queue, index).vmap_blocks; > > } > > > The problem i see is about not-initializing of the: > > for_each_possible_cpu(i) { > struct vmap_block_queue *vbq; > struct vfree_deferred *p; > > vbq = &per_cpu(vmap_block_queue, i); > spin_lock_init(&vbq->lock); > INIT_LIST_HEAD(&vbq->free); > p = &per_cpu(vfree_deferred, i); > init_llist_head(&p->list); > INIT_WORK(&p->wq, delayed_vfree_work); > xa_init(&vbq->vmap_blocks); > } > > > correctly or fully. It is my bad i did not think that CPUs in a possible mask > can be non sequential :-/ > > nr_cpu_ids - is not the max possible CPU. For example, in Nick case, > when he has two CPUs, num_possible_cpus() and nr_cpu_ids are the same. > > Or i missed something in your patch, Baoquan? > > -- > Uladzislau Rezki IMO, I thought we can fix this by following. It doesn't initialize unused variables and utilize the percpu xarray. If I said anything wrong, please do let me know. I can learn a lot from you all :). diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 11fe5ea208aa..f9f981674b2d 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -4480,17 +4480,21 @@ void __init vmalloc_init(void) */ vmap_area_cachep = KMEM_CACHE(vmap_area, SLAB_PANIC); - for_each_possible_cpu(i) { + for (i = 0; i < nr_cpu_ids; i++) { struct vmap_block_queue *vbq; struct vfree_deferred *p; vbq = &per_cpu(vmap_block_queue, i); + xa_init(&vbq->vmap_blocks); + + if (!cpu_possible(i)) + continue; + spin_lock_init(&vbq->lock); INIT_LIST_HEAD(&vbq->free); p = &per_cpu(vfree_deferred, i); init_llist_head(&p->list); INIT_WORK(&p->wq, delayed_vfree_work); - xa_init(&vbq->vmap_blocks); } -- help you, help me, Hailong.