All of lore.kernel.org
 help / color / mirror / Atom feed
From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Anshuman Khandual <anshuman.khandual@arm.com>, linux-mm@kvack.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, Ryan Roberts <ryan.roberts@arm.com>
Subject: Re: [PATCH] mm/debug_vm_pgtable: Replace WRITE_ONCE() with pxd_clear()
Date: Fri, 27 Feb 2026 21:55:20 +0100	[thread overview]
Message-ID: <e16f31ea-3713-4149-b60d-655b52845644@kernel.org> (raw)
In-Reply-To: <20260227061204.2215395-1-anshuman.khandual@arm.com>

On 2/27/26 07:12, Anshuman Khandual wrote:
> Replace WRITE_ONCE() with generic pxd_clear() to clear out the page table
> entries as required. Besides this does not cause any functional change as
> well.
> 
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: David Hildenbrand <david@kernel.org>
> Cc: linux-mm@kvack.org
> Cc: linux-kernel@vger.kernel.org
> Suggested-by: Ryan Roberts <ryan.roberts@arm.com>
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
> Applies on mm-unstable and tested only on arm64 platform.
> 
>  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 83cf07269f13..23dc3ee09561 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));
> +	pmd_clear(args->pmdp);
>  	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));
> +	pud_clear(args->pudp);
>  	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);

On some architectures, pmd_clear() does not set the pmd to zero.

See s390x as an example:

	set_pmd(pmdp, __pmd(_SEGMENT_ENTRY_EMPTY));

Which results on 0x20 being set.

Maybe we're lucky and all relevant architectures do not have
CONFIG_HAVE_ARCH_HUGE_VMAP.

Or maybe it just doesn't matter.

We'll find out :)

Acked-by: David Hildenbrand (Arm) <david@kernel.org>

-- 
Cheers,

David


  reply	other threads:[~2026-02-27 20:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-27  6:12 [PATCH] mm/debug_vm_pgtable: Replace WRITE_ONCE() with pxd_clear() Anshuman Khandual
2026-02-27 20:55 ` David Hildenbrand (Arm) [this message]
2026-02-28 16:59 ` SeongJae Park

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e16f31ea-3713-4149-b60d-655b52845644@kernel.org \
    --to=david@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=anshuman.khandual@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ryan.roberts@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.