BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Muhammad Usama Anjum" <usama.anjum@arm.com>
Cc: bpf@vger.kernel.org, linux-perf-users@vger.kernel.org,
	dri-devel@lists.freedesktop.org, damon@lists.linux.dev
Subject: Re: [PATCH 5/9] mm: convert PTE table entries in ptep_get()
Date: Thu, 06 Aug 2026 08:57:03 +0000	[thread overview]
Message-ID: <20260806085703.C2BF01F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260806083926.1807279-6-usama.anjum@arm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] ptep_get_lockless() fails to compile when both CONFIG_ARCH_HAS_HW_PTE_T and CONFIG_GUP_GET_PXX_LOW_HIGH are enabled.
--

--- Patch [5]: [PATCH 5/9] mm: convert PTE table entries in ptep_get() ---
commit 697ecf53dc0bc83c57005a208e0294657ed963f8
Author: Muhammad Usama Anjum <usama.anjum@arm.com>

mm: convert PTE table entries in ptep_get()

ptep_get() now accepts a pointer to hw_pte_t storage but must continue to
return a logical pte_t value. Add __pte_from_hw for both generic hw_pte_t
definitions. Read the hw_pte_t table element atomically before converting
it to pte_t.

> diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h
> index dad80d264aac2..1768421755a9c 100644
> --- a/include/linux/pgtable.h
> +++ b/include/linux/pgtable.h
> @@ -493,7 +493,7 @@ static inline int pudp_set_access_flags(struct vm_area_struct *vma,
>  #ifndef ptep_get
>  static inline pte_t ptep_get(hw_pte_t *ptep)
>  {
> -	return READ_ONCE(*ptep);
> +	return __pte_from_hw(READ_ONCE(*ptep));
>  }
>  #endif

[Severity: Low]
Does this change cause a compilation failure in ptep_get_lockless() when
CONFIG_GUP_GET_PXX_LOW_HIGH and CONFIG_ARCH_HAS_HW_PTE_T are both enabled?

When CONFIG_ARCH_HAS_HW_PTE_T is enabled, hw_pte_t becomes a wrapper struct.
However, ptep_get_lockless() still attempts to access pte_low and pte_high
directly from the hw_pte_t pointer:

include/linux/pgtable.h:ptep_get_lockless() {
        ...
	do {
		pte.pte_low = ptep->pte_low;
		smp_rmb();
		pte.pte_high = ptep->pte_high;
		smp_rmb();
	} while (unlikely(pte.pte_low != ptep->pte_low));
        ...
}

Should ptep_get_lockless() be updated to handle the wrapper struct, perhaps
by accessing the __pte member or extracting the logical pte_t first?

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260806083926.1807279-1-usama.anjum@arm.com?part=5

  reply	other threads:[~2026-08-06  8:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-06  8:38 [PATCH 0/9] mm: distinguish PTE table storage from PTE values Muhammad Usama Anjum
2026-08-06  8:38 ` [PATCH 1/9] mm: introduce hw_pte_t for PTE table storage Muhammad Usama Anjum
2026-08-07  7:09   ` Alexander Gordeev
2026-08-06  8:38 ` [PATCH 2/9] mm: make hw_pte_t visible to generic PTE interfaces Muhammad Usama Anjum
2026-08-06  8:38 ` [PATCH 3/9] mm: name pointers to copied PTE values ptentp Muhammad Usama Anjum
2026-08-06  8:38 ` [PATCH 4/9] mm: use hw_pte_t for generic PTE table storage Muhammad Usama Anjum
2026-08-06  9:00   ` sashiko-bot
2026-08-06  8:38 ` [PATCH 5/9] mm: convert PTE table entries in ptep_get() Muhammad Usama Anjum
2026-08-06  8:57   ` sashiko-bot [this message]
2026-08-06  8:38 ` [PATCH 6/9] mm: convert PTE table entry to pte Muhammad Usama Anjum
2026-08-07  6:58   ` Alexander Gordeev
2026-08-06  8:38 ` [PATCH 7/9] mm/kasan: use hw_pte_t for the early shadow PTE table Muhammad Usama Anjum
2026-08-06  9:01   ` sashiko-bot
2026-08-06  8:38 ` [PATCH 8/9] drm/i915: use hw_pte_t for PTE range callbacks Muhammad Usama Anjum
2026-08-06  8:38 ` [PATCH 9/9] xen: " Muhammad Usama Anjum

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=20260806085703.C2BF01F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=damon@lists.linux.dev \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=usama.anjum@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox