Received: by 2002:a05:7412:2a8a:b0:fc:a2b0:25d7 with SMTP id u10csp231466rdh; Wed, 7 Feb 2024 03:13:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IGJJ+fe5LDarrdREAwXX3d3CxHNCia0msi004q/x1/HoYp5FsP2buaKn9jvC8wGpzxMKpQy X-Received: by 2002:a17:906:e8e:b0:a38:51c2:68a5 with SMTP id p14-20020a1709060e8e00b00a3851c268a5mr1906450ejf.7.1707304384734; Wed, 07 Feb 2024 03:13:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707304384; cv=pass; d=google.com; s=arc-20160816; b=dXWbIXGFvVYKVk/FDTUVxkq4Od5lv1UGn1MFJTqHetAkDXI7dN+9556bHLdvBqSSpz 3rJF3YPpVk9znE/s/d1WW46B5NuUe2au6Q84AoQFOz6+BQyl5SLHgmOd74wukm568Hnj cVTubr0J7b0uhu277XW+ScKxVlygfES76Yy0FjZUG88dk/sfqfNxWIywc1dZnVS6x/2z G+NB0z4tzx105Jpf+RwgO8eEmAKKD05XTvRk2ZIyERY1AtZYiwNbZyHZiGGpVod8mUjY lC6TIibQDG4ZpbgZiAQWFy2gynZOEi299PP6G0/o+eSNg7d2Bn4cjjBrubSQmIreRy3p ij8Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:dkim-signature; bh=k6bynGvSB3bW4A1nOQ0Ulh3u69qvHB3qLOySjtY/DaM=; fh=N9cYMCQzmzxezzdTdPVCzW8NuVVAKoNxyh/LSf0FY9A=; b=y/QhDvsnrIH9TFUtLn9cWYV/WTTDLijm7EOChFDr1/rb37BMTWfohyBuO2Pa+Fp3So NzYc4TpylNuyQrP0Mh19khQFDZ4gefkvPePpLoKh8dxEOHwXllQfbTfE1RlviJ+2q4SI WmgOgzEEUdQ3WU1iTMmDzQivVAWOb/Xx0txozYzoj2myrl5RhoeRAbS2QfWoI47JLf3N Jbx1j0uQxoHfDrTRrMFrQRECpRx0leQkA2OtVpY3sZ2HNph8k8RVFHd7NOK99GCvXi6k j2cJYQmXODZv7Tq5xW0hFGshtyFp4pdDZTPuhfoz/U6tzUdorZ3+vIG7hj9fgpGc8z6u +tiw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BR7gVvcB; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-56364-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56364-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCUs/RSdI0iQUAwZveEZK13oZpA39Thw59l5JvBe0bivncGwoHHGl+5RokDrvxS+9YaGzUAFVrMMkLuJCa0jKPSvZvoQ2PBlED+RE/rPTA== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id d11-20020a17090648cb00b00a3741771f3dsi790810ejt.418.2024.02.07.03.13.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 03:13:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-56364-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BR7gVvcB; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-56364-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56364-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 6AE8E1F27877 for ; Wed, 7 Feb 2024 11:13:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C903D1AAD3; Wed, 7 Feb 2024 11:12:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BR7gVvcB" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0145C19BA5 for ; Wed, 7 Feb 2024 11:12:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707304379; cv=none; b=ta2pBt3YRo5aT4e6Uc05KxpU2XBQXx82VN3MUL9lGHjUmoY/3Q015idf98PZ722qlef9A2VNoPIsr7t5vnvRWUmUw0COrHl3uAvWZB1wFQh+JsX1tn4Hh1AkOvKvDwJ88ctqsatAtpfu26itR2FpB3qn/JJnWqsxhrHgRSw8M8M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707304379; c=relaxed/simple; bh=Wdwlj8End667TasRIp745gWvCi1r+Z+ho/QV9RjE1iM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=VlWy7tQW+yUV05WcXm4gOG5EBLYT3OxE0Ql+Mwx2wCE6/NPq27k51nA3pun85KXV00xbySP7q8/93WM/sbzC2xFiMbSmbzRR+iAOGc14cc8b4WCfcG7gbqiiBz3WyGg4oX/gmLy1A/e/qyqVvvkLuXKVjO4WTaF8XVii36g4Oy8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BR7gVvcB; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D42EC433F1; Wed, 7 Feb 2024 11:12:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707304378; bh=Wdwlj8End667TasRIp745gWvCi1r+Z+ho/QV9RjE1iM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BR7gVvcBwGGbvbZfh7xizzOqoGFPTI0JQWsV7ndm9o6m3Ea8vwZVbv/9ygor6Vx4W qZU5i/hgHxS9F7vgiKb3m/YM9C/JQbILhIG58u0xr8GwjEynXC2o3FUpkX47vTzBi8 RT9oYPYnBzc0lcB6QUQLHD0HHuF3CLlRn8+0pMlp4pHpTrSzJvCK8c833CQRRJocLl GFhSagN7yVuG0QqORcjvg+FhmUtwd9Sj+LddWIN4v+MloroBcWy7FADQHVWahafU0g G3+NbfE6o/szBGOVSMw+nHdIA2eEeqzrlm5STgTFp38hcoaDdLcmo9CWKbu4rEa89X xaS/xIlnSDqzg== Date: Wed, 7 Feb 2024 11:12:52 +0000 From: Will Deacon To: Nanyong Sun Cc: Catalin Marinas , mike.kravetz@oracle.com, muchun.song@linux.dev, akpm@linux-foundation.org, anshuman.khandual@arm.com, willy@infradead.org, wangkefeng.wang@huawei.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v3 0/3] A Solution to Re-enable hugetlb vmemmap optimize Message-ID: <20240207111252.GA22167@willie-the-truck> References: <20240113094436.2506396-1-sunnanyong@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) On Sat, Jan 27, 2024 at 01:04:15PM +0800, Nanyong Sun wrote: > > On 2024/1/26 2:06, Catalin Marinas wrote: > > On Sat, Jan 13, 2024 at 05:44:33PM +0800, Nanyong Sun wrote: > > > HVO was previously disabled on arm64 [1] due to the lack of necessary > > > BBM(break-before-make) logic when changing page tables. > > > This set of patches fix this by adding necessary BBM sequence when > > > changing page table, and supporting vmemmap page fault handling to > > > fixup kernel address translation fault if vmemmap is concurrently accessed. > > I'm not keen on this approach. I'm not even sure it's safe. In the > > second patch, you take the init_mm.page_table_lock on the fault path but > > are we sure this is unlocked when the fault was taken? > I think this situation is impossible. In the implementation of the second > patch, when the page table is being corrupted > (the time window when a page fault may occur), vmemmap_update_pte() already > holds the init_mm.page_table_lock, > and unlock it until page table update is done.Another thread could not hold > the init_mm.page_table_lock and > also trigger a page fault at the same time. > If I have missed any points in my thinking, please correct me. Thank you. It still strikes me as incredibly fragile to handle the fault and trying to reason about all the users of 'struct page' is impossible. For example, can the fault happen from irq context? If we want to optimise the vmemmap mapping for arm64, I think we need to consider approaches which avoid the possibility of the fault altogether. It's more complicated to implement, but I think it would be a lot more robust. Andrew -- please can you drop these from -next? Thanks, Will