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 9D029C54E64 for ; Mon, 25 Mar 2024 10:09:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C54496B0082; Mon, 25 Mar 2024 06:09:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C04D66B0083; Mon, 25 Mar 2024 06:09:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ACE2C6B0085; Mon, 25 Mar 2024 06:09:46 -0400 (EDT) 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 9D6686B0082 for ; Mon, 25 Mar 2024 06:09:46 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 646DD40B72 for ; Mon, 25 Mar 2024 10:09:46 +0000 (UTC) X-FDA: 81935139972.26.6D6203D Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf21.hostedemail.com (Postfix) with ESMTP id 83AF21C0005 for ; Mon, 25 Mar 2024 10:09:44 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Tagzy2xd; spf=pass (imf21.hostedemail.com: domain of bhe@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1711361384; 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=9S05SCRpMYvA+toy0tHe1naxURHrZ58qKUQ3/5tsGzc=; b=VrNyIdD4S7yTB7EBSWbrj6kk+XHekJZ60kg2rzlVzlsDLwvh8fSeip5Y5+Lqoo5Lkf8Rtb kX7dtKk2e7KW+dlAz7bmDiAQuxRY4Bi6ZLBF6WJh3tbKjhrHqrDJ3IchJmrw5Nc27rMsQe MD9Fl3fYMGVfvS5OLp/dVeflLpKaSKQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711361384; a=rsa-sha256; cv=none; b=c4kpC0W6rr2cRsuFgqWoqkWtmRRIaEer4n0AhLccWaza4UFM6c7AJ3dOhkbnZHNEW8RAaQ AB6GrffMbeUWBSDDm9c7zZsHkhs4lkRefDxm5ww9XfkrKgHjDyFrWp25JwnTJAZ8ibv5m1 uz5NwByjtQavi2ojk8ec3cJCy/yStBQ= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Tagzy2xd; spf=pass (imf21.hostedemail.com: domain of bhe@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711361383; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=9S05SCRpMYvA+toy0tHe1naxURHrZ58qKUQ3/5tsGzc=; b=Tagzy2xd6V2oitEtCg0/QOrjiVrER2hkKOoUya4Fl3MjlOeRwifcxAUIdW8Sm1Dh92LMb7 4RJyeM+joRly26drtnzmnPK7zwxo5bqOdsAlxSwRXV30gzmmeWJdtKWELcqUpSX0Lh0vOh bx5CAIrIaQe15XPoUDSkaTC0CyxwnKk= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-150-sEcjEcK4NAmQNj1b5hd2_Q-1; Mon, 25 Mar 2024 06:09:36 -0400 X-MC-Unique: sEcjEcK4NAmQNj1b5hd2_Q-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BBC25891E68; Mon, 25 Mar 2024 10:09:35 +0000 (UTC) Received: from localhost (unknown [10.72.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 98561492D17; Mon, 25 Mar 2024 10:09:34 +0000 (UTC) Date: Mon, 25 Mar 2024 18:09:26 +0800 From: Baoquan He To: Heiko Carstens Cc: Christoph Hellwig , "Uladzislau Rezki (Sony)" , linux-mm@kvack.org, Andrew Morton , LKML , Lorenzo Stoakes , Matthew Wilcox , Dave Chinner , Guenter Roeck , Oleksiy Avramchenko , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , linux-s390@vger.kernel.org Subject: Re: [PATCH 1/1] mm: vmalloc: Bail out early in find_vmap_area() if vmap is not init Message-ID: References: <20240323141544.4150-1-urezki@gmail.com> <20240325093959.9453-B-hca@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240325093959.9453-B-hca@linux.ibm.com> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-Stat-Signature: 49fsoo93131ft78ekam7mkofzth38pqn X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 83AF21C0005 X-Rspam-User: X-HE-Tag: 1711361384-407282 X-HE-Meta: U2FsdGVkX1/julJfkSu4/0JznSz0r+JSOQcxLQFE7CYhJ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1DRuRM/v9eAJPdG0Bs5m+DU6WEyBmZgmRDYxrqFEtgt5WZMa2S10gvGQlECedrNYTt2BB9MZsdORgkNoP5vy7ZznXG5gKmuycwYAERz+BfAC+FJHERSNCETtyZMIUoJZATj7PRZjR5owJ3y4bJdR8DYsUwA== 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 03/25/24 at 10:39am, Heiko Carstens wrote: > On Sun, Mar 24, 2024 at 04:32:00PM -0700, Christoph Hellwig wrote: > > On Sat, Mar 23, 2024 at 03:15:44PM +0100, Uladzislau Rezki (Sony) wrote: ......snip > > I guess this is ok as an urgend bandaid to get s390 booting again, > > but calling find_vmap_area before the vmap area is initialized > > seems an actual issue in the s390 mm init code. > > > > Adding the s390 maintainers to see if they have and idea how this could > > get fixed in a better way. > > I'm going to push the patch below to the s390 git tree later. This is not a > piece of art, but I wanted to avoid to externalize vmalloc's vmap_initialized, > or come up with some s390 specific change_page_attr_alias_early() variant where > sooner or later nobody remembers what "early" means. > > So this seems to be "good enough". > > From 0308cd304fa3b01904c6060e2115234101811e48 Mon Sep 17 00:00:00 2001 > From: Heiko Carstens > Date: Thu, 21 Mar 2024 09:41:20 +0100 > Subject: [PATCH] s390/mm,pageattr: avoid early calls into vmalloc code > > The vmalloc code got changed and doesn't have the global statically > initialized vmap_area_lock spinlock anymore. This leads to the following > lockdep splat when find_vm_area() is called before the vmalloc code is > initialized: > > BUG: spinlock bad magic on CPU#0, swapper/0 > lock: single+0x1868/0x1978, .magic: 00000000, .owner: swapper/0, .owner_cpu: 0 > > CPU: 0 PID: 0 Comm: swapper Not tainted 6.8.0-11767-g23956900041d #1 > Hardware name: IBM 3931 A01 701 (KVM/Linux) > Call Trace: > [<00000000010d840a>] dump_stack_lvl+0xba/0x148 > [<00000000001fdf5c>] do_raw_spin_unlock+0x7c/0xd0 > [<000000000111d848>] _raw_spin_unlock+0x38/0x68 > [<0000000000485830>] find_vmap_area+0xb0/0x108 > [<0000000000485ada>] find_vm_area+0x22/0x40 > [<0000000000132bbc>] __set_memory+0xbc/0x140 > [<0000000001a7f048>] vmem_map_init+0x40/0x158 > [<0000000001a7edc8>] paging_init+0x28/0x80 > [<0000000001a7a6e2>] setup_arch+0x4b2/0x6d8 > [<0000000001a74438>] start_kernel+0x98/0x4b0 > [<0000000000100036>] startup_continue+0x36/0x40 > INFO: lockdep is turned off. > > Add a slab_is_available() check to change_page_attr_alias() in order to > avoid early calls into vmalloc code. slab_is_available() is not exactly > what is needed, but there is currently no other way to tell if the vmalloc > code is initialized or not, and there is no reason to expose > e.g. vmap_initialized from vmalloc to achieve the same. If so, I would rather add a vmalloc_is_available() to achieve the same. The added code and the code comment definitely will confuse people and make people to dig why. > > The fixes tag does not mean that the referenced commit is broken, but that > there is a dependency to this commit if the vmalloc commit should be > backported. > > Fixes: d093602919ad ("mm: vmalloc: remove global vmap_area_root rb-tree") > Signed-off-by: Heiko Carstens > --- > arch/s390/mm/pageattr.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/arch/s390/mm/pageattr.c b/arch/s390/mm/pageattr.c > index 01bc8fad64d6..b6c6453d66e2 100644 > --- a/arch/s390/mm/pageattr.c > +++ b/arch/s390/mm/pageattr.c > @@ -344,6 +344,9 @@ static int change_page_attr_alias(unsigned long addr, unsigned long end, > struct vm_struct *area; > int rc = 0; > > + /* Avoid early calls into not initialized vmalloc code. */ > + if (!slab_is_available()) > + return 0; > /* > * Changes to read-only permissions on kernel VA mappings are also > * applied to the kernel direct mapping. Execute permissions are > -- > 2.40.1 >