From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 28BC220A5F3 for ; Thu, 11 Dec 2025 09:36:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765445793; cv=none; b=fhFChoXYIK/70B1lmWWxciKJkAuf2vO1xije28t8Qrhj4+tGE+Owb9DSQqCXmo8tfEN8cv46L8adPZQ0VGYG/rUncd21IZMGbf/EyFddnpm0+32LN19/uMQMh53kqtbbYY7UG/p1zEZDADW5RHGKvxBKChqWBs6Mr6VCflGI6qc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765445793; c=relaxed/simple; bh=WrueKsGiDWZdyQY49M6fQXjY/Jizo+p7hbd4YQRMyRE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=XG9VMmKcoUhh/8vVa+bOXIKrqdJqmLlJYXaRo9OP1L4g0R4gxwahor5UHAOuLInWXH0IBksnwdRBdgfvWgH+/IKwyDrp6QNiFHy5XaqYNVN1lZ9XlZzup571PGEugxcwMyttyEiQ7SgAs728EvmD0Kt2Nd/uvQiDAtIUS1yO2ec= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0563B153B; Thu, 11 Dec 2025 01:36:24 -0800 (PST) Received: from [10.57.90.205] (unknown [10.57.90.205]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1B32D3F740; Thu, 11 Dec 2025 01:36:28 -0800 (PST) Message-ID: <12ac22e3-d943-431e-a3da-15987fbb458e@arm.com> Date: Thu, 11 Dec 2025 09:36:27 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/2] mm/debug_vm_pgtable: Use set_pXd() to write page tables Content-Language: en-GB To: Samuel Holland , Andrew Morton , "Liam R . Howlett" , Lorenzo Stoakes , David Hildenbrand , Vlastimil Babka , Jann Horn Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Anshuman Khandual , Gavin Shan , Zi Yan References: <20251211081117.1126521-1-samuel.holland@sifive.com> <20251211081117.1126521-2-samuel.holland@sifive.com> From: Ryan Roberts In-Reply-To: <20251211081117.1126521-2-samuel.holland@sifive.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 11/12/2025 08:11, Samuel Holland wrote: > Generic code must always use the architecture-provided helper function > to write page tables. > > Fixes: a5c3b9ffb0f4 ("mm/debug_vm_pgtable: add tests validating advanced arch page table helpers") > Fixes: c0fe07b0aa72 ("mm/debug_vm_pgtable: use struct pgtable_debug_args in PMD modifying tests") > Signed-off-by: Samuel Holland > --- > > mm/debug_vm_pgtable.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c > index ae9b9310d96fd..8c7996d6c1f2a 100644 > --- a/mm/debug_vm_pgtable.c > +++ b/mm/debug_vm_pgtable.c > @@ -445,7 +445,7 @@ static void __init pmd_huge_tests(struct pgtable_debug_args *args) > * X86 defined pmd_set_huge() verifies that the given > * PMD is not a populated non-leaf entry. > */ > - WRITE_ONCE(*args->pmdp, __pmd(0)); > + set_pmd(args->pmdp, __pmd(0)); My guess is that this should actually be: pmd_clear(args->pmdp); As the "clear" value may not be zero on some arches (see um) or there may be more to do on other arches (see arm32's 2 level pgtable). > WARN_ON(!pmd_set_huge(args->pmdp, __pfn_to_phys(args->fixed_pmd_pfn), args->page_prot)); > WARN_ON(!pmd_clear_huge(args->pmdp)); > pmd = pmdp_get(args->pmdp); > @@ -465,7 +465,7 @@ static void __init pud_huge_tests(struct pgtable_debug_args *args) > * X86 defined pud_set_huge() verifies that the given > * PUD is not a populated non-leaf entry. > */ > - WRITE_ONCE(*args->pudp, __pud(0)); > + set_pud(args->pudp, __pud(0)); Likewise, I think this should be: pud_clear(args->pudp); Thanks, Ryan > WARN_ON(!pud_set_huge(args->pudp, __pfn_to_phys(args->fixed_pud_pfn), args->page_prot)); > WARN_ON(!pud_clear_huge(args->pudp)); > pud = pudp_get(args->pudp);