From mboxrd@z Thu Jan 1 00:00:00 1970 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 E3F422571A7 for ; Mon, 24 Feb 2025 12:04:46 +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=1740398686; cv=none; b=EfszkbiDy8rwG5tL5bEyjn32FRb1Uu3xpWzjiVi+Ttil/vi4ZNsCuMGoCa2v5mj7UhHnvjAxLD0ZOox1vyc+4ITDsmQqU6rHxEhxaGrZSfjWQ7r9iVqqd6ujBtuH2w4Kr9xuBQYSBzENQnIpADuDlVPtaBSjulAZF0b9d3GQEt0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740398686; c=relaxed/simple; bh=wo1ObagDB2U0ZWwz2/5QlJhqoV4Y8cUAnTOznR7jTOo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=BnifoK+hiEyB9S+ZQwvogrIV1ac826HZo4c0LJPtEeEl4BwHhwb42bFPzi43POx+C+T1JmqZrUBa7oeLN2fBCbDY7e3pfl9sAcHH857PJ2f0n+Tccoph9RrtiJrVADJGkytLEYgTQ7TXZlJ7s43qOYPCArT8Hp3dxs3bs89bJI4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 492DBC4CED6; Mon, 24 Feb 2025 12:04:44 +0000 (UTC) Date: Mon, 24 Feb 2025 12:04:42 +0000 From: Catalin Marinas To: Ryan Roberts Cc: Will Deacon , Pasha Tatashin , Andrew Morton , Uladzislau Rezki , Christoph Hellwig , David Hildenbrand , "Matthew Wilcox (Oracle)" , Mark Rutland , Anshuman Khandual , Alexandre Ghiti , Kevin Brodsky , linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 09/14] mm/vmalloc: Gracefully unmap huge ptes Message-ID: References: <20250217140809.1702789-1-ryan.roberts@arm.com> <20250217140809.1702789-10-ryan.roberts@arm.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: <20250217140809.1702789-10-ryan.roberts@arm.com> On Mon, Feb 17, 2025 at 02:08:01PM +0000, Ryan Roberts wrote: > Commit f7ee1f13d606 ("mm/vmalloc: enable mapping of huge pages at pte > level in vmap") added its support by reusing the set_huge_pte_at() API, > which is otherwise only used for user mappings. But when unmapping those > huge ptes, it continued to call ptep_get_and_clear(), which is a > layering violation. To date, the only arch to implement this support is > powerpc and it all happens to work ok for it. > > But arm64's implementation of ptep_get_and_clear() can not be safely > used to clear a previous set_huge_pte_at(). So let's introduce a new > arch opt-in function, arch_vmap_pte_range_unmap_size(), which can > provide the size of a (present) pte. Then we can call > huge_ptep_get_and_clear() to tear it down properly. > > Note that if vunmap_range() is called with a range that starts in the > middle of a huge pte-mapped page, we must unmap the entire huge page so > the behaviour is consistent with pmd and pud block mappings. In this > case emit a warning just like we do for pmd/pud mappings. > > Reviewed-by: Anshuman Khandual > Signed-off-by: Ryan Roberts Reviewed-by: Catalin Marinas