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 063D8C2BD09 for ; Mon, 24 Jun 2024 12:17:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 869F76B03A8; Mon, 24 Jun 2024 08:17:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8163A6B03D6; Mon, 24 Jun 2024 08:17:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 690696B03DD; Mon, 24 Jun 2024 08:17:01 -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 43D8F6B03A8 for ; Mon, 24 Jun 2024 08:17:01 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id F2639A0EA9 for ; Mon, 24 Jun 2024 12:17:00 +0000 (UTC) X-FDA: 82265681400.08.7CE1ACA Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) by imf05.hostedemail.com (Postfix) with ESMTP id EE970100021 for ; Mon, 24 Jun 2024 12:16:58 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=g5EYRkmu; spf=pass (imf05.hostedemail.com: domain of urezki@gmail.com designates 209.85.167.47 as permitted sender) smtp.mailfrom=urezki@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719231405; 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=VOwwUCn4o91Hx00RzgGfd9DNWIUVFFDkTLA5vyA8/fM=; b=FV4ayv/BnRdC+pEh/fGy00nNAGUhAWWpN4uk4d2zpvh1W90oOOcAZfY29sOSazAOiuhand nVVX4iWtZdWqF4FpGS1aFQ359lp6FRVWwTRVntvSeXr7NnaZEMZrTwURcWBOI6FsPXCCq1 1kjvtH0smWZQ6qNWVCoQH493h7UK6Cc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719231405; a=rsa-sha256; cv=none; b=LLb/++dA6hZBcrVU91x4WXJoJoRv+8T5F8An8OKbUx0dkV20p+oODiohRF0AxETcXqaS4u 8PwLfxhorpsKsmidcUrnl2f1jBksWzOpgLm+a2YbdmGLtwuONTXDc5Ixsnnz36q6m2UJeW E7zb7H7cbSy+q1pLxSnbjoh0dWNIx80= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=g5EYRkmu; spf=pass (imf05.hostedemail.com: domain of urezki@gmail.com designates 209.85.167.47 as permitted sender) smtp.mailfrom=urezki@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-52ce01403f6so1608593e87.0 for ; Mon, 24 Jun 2024 05:16:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719231417; x=1719836217; darn=kvack.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:from:to:cc:subject:date:message-id:reply-to; bh=VOwwUCn4o91Hx00RzgGfd9DNWIUVFFDkTLA5vyA8/fM=; b=g5EYRkmu/rxwBVWcEdORDdWKpObSQ/B2NXuyvFdnDxBCXW28w0eDng4w1+YXt/elIG JoBIIiJEVNPMjk/JNIHdLwzbR3KhusbBI4wqoHbUuqmpEYxEF2MA2kF5nofxcKI75AoF Xmn5ky0YKzCOrIcEiQB76SyAv8mMtEiX1ZuWBFPHW2wbxjwRXcc3lDXubajl0/ol1kx1 eKVjvRWCmXeTmah+ew9CPe2ebXDLdhL9RHQEY1zUxI8GVRZBBhRavCNff4ziQJaZzJKn LZOSdogvkFYmWGwzqviqkgv3qhsRVz6eQdLch1X6/RvtSkBM8/e9QDnYzKU/DmoAaQw6 QW/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719231417; x=1719836217; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=VOwwUCn4o91Hx00RzgGfd9DNWIUVFFDkTLA5vyA8/fM=; b=Bm4cF1Pu7+HTRiwbTR0P8mQrN5NtLQXHI2ukJItzln7Qy8Q4tmzfqmNS7jbcjiXQcg UoWOMsuy1RIbe8ZUed4328xgMRnJmmuPwi0X+sWFS9oDoH9jFVI3PNdMxzXoIKqtwAto dSYYX6XUSmaDu3oHTV28nEIJ/Ny5sjaScRyLa6yUckHs+yz37W1a4+otODkeMMbOp9G/ Up9uOOhKJDzzx6zn2m3J/Re6XFF8c0cYsdR/S8/foUJwudOFiRMa/bvSoOhJyWAVbq8V dDmxRnQ3488xHWu1VH8af5yWecTw6HWNEnRNt71a+J/tAOJvE3JtjUIiBawJ6+zbtPNi jqig== X-Forwarded-Encrypted: i=1; AJvYcCX2Hy0EPRwPDv+RaOZEww7aLF7IXymU0GbTapH0Q20SFFijSTbYLpkQ4SiRKMahpiQOXQX+zcJncem40Jg/C7Gexc0= X-Gm-Message-State: AOJu0YweJ5/try87MPDL8c7o64eXRW4WjqHX44FzpivX8OXuGc3I8rjj 3mTBokg3G6dA3D78WedDsE9kSIw9osqiu55qEjFEr6iR62NGHGzZ X-Google-Smtp-Source: AGHT+IEsFRWCKZJoK13E+Pt3s17fNddxxyoVj/A//QIxbCu+pr046XEFbPnc02WFGZ3DEx8RMoJ0rA== X-Received: by 2002:a05:6512:3b13:b0:52c:dbee:bdb0 with SMTP id 2adb3069b0e04-52ce186271amr3543920e87.59.1719231416848; Mon, 24 Jun 2024 05:16:56 -0700 (PDT) Received: from pc636 (host-90-233-219-252.mobileonline.telia.com. [90.233.219.252]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52cd6449b48sm957965e87.275.2024.06.24.05.16.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 05:16:56 -0700 (PDT) From: Uladzislau Rezki X-Google-Original-From: Uladzislau Rezki Date: Mon, 24 Jun 2024 14:16:54 +0200 To: Baoquan He Cc: Uladzislau Rezki , Nick Bowler , Hailong Liu , linux-kernel@vger.kernel.org, Linux regressions mailing list , linux-mm@kvack.org, sparclinux@vger.kernel.org, Andrew Morton Subject: Re: PROBLEM: kernel crashes when running xfsdump since ~6.4 Message-ID: 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-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: EE970100021 X-Stat-Signature: oxqtfconsetewxewuzqykezx5xwqxsef X-HE-Tag: 1719231418-354010 X-HE-Meta: U2FsdGVkX194b+IWmlaGh50vLQrgpIlVsaRj0OrwcyYFXDKLfrsWnCWbVDkYwgOFC6gmqa/Lg0WHalcytdS27qUvQvKEgMeH1pEXc53CJDjGukCInpCFlfRt5oHA//Zl91qkpIQaaEZk4ql+uSraUKJXSCkIeqrRnC2xxkxEogUunkklTg0oR4uTUB58E7C9hwRy/SrvhDaamp6W/9In4NgQgken6M0q6TqdQNj7yoZM41JjUfdv+fFNUtOPMqXxZFhwcU2E2YTZNl5IDYKX6Mi0GOVMDJoz8dfi0Prv/uDkiwPOZsXVW4tmvgWb1+4rwomwDxwpLkRO/xh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owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Fri, Jun 21, 2024 at 10:02:50PM +0800, Baoquan He wrote: > On 06/21/24 at 11:44am, 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: > ...... > > > 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. > > I checked the generic version of setup_nr_cpu_ids(), from codes, they > are different with my understanding. > > kernel/smp.c > void __init setup_nr_cpu_ids(void) > { > set_nr_cpu_ids(find_last_bit(cpumask_bits(cpu_possible_mask), NR_CPUS) + 1); > } > I see that it is not a weak function, so it is generic, thus the behavior can not be overwritten, which is great. This does what we need. Thank you for checking this you are right! Then it is just a matter of proper initialization of the hash: diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 5d3aa2dc88a8..1733946f7a12 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -5087,7 +5087,13 @@ void __init vmalloc_init(void) */ vmap_area_cachep = KMEM_CACHE(vmap_area, SLAB_PANIC); - for_each_possible_cpu(i) { + /* + * We use "nr_cpu_ids" here because some architectures + * may have "gaps" in cpu-possible-mask. It is OK for + * per-cpu approaches but is not OK for cases where it + * can be used as hashes also. + */ + for (i = 0; i < nr_cpu_ids; i++) { struct vmap_block_queue *vbq; struct vfree_deferred *p; -- Uladzislau Rezki