Generic Linux architectural discussions
 help / color / mirror / Atom feed
From: Muhammad Usama Anjum <usama.anjum@arm.com>
To: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: usama.anjum@arm.com, Jani Nikula <jani.nikula@linux.intel.com>,
	Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>,
	Tvrtko Ursulin <tursulin@ursulin.net>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	Dimitri Sivanich <dimitri.sivanich@hpe.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"James E.J. Bottomley" <James.Bottomley@hansenpartnership.com>,
	Helge Deller <deller@gmx.de>, Juergen Gross <jgross@suse.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Muchun Song <muchun.song@linux.dev>,
	Oscar Salvador <osalvador@suse.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	"Liam R. Howlett" <liam@infradead.org>,
	Lorenzo Stoakes <ljs@kernel.org>, Will Deacon <will@kernel.org>,
	"Aneesh Kumar K.V" <aneesh.kumar@kernel.org>,
	Nick Piggin <npiggin@gmail.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Andrey Ryabinin <ryabinin.a.a@gmail.com>,
	David Hildenbrand <david@kernel.org>,
	Pasha Tatashin <pasha.tatashin@soleen.com>,
	Chris Li <chrisl@kernel.org>, Kairui Song <kasong@tencent.com>,
	Uladzislau Rezki <urezki@gmail.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Eduard Zingerman <eddyz87@gmail.com>,
	Kumar Kartikeya Dwivedi <memxor@gmail.com>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>, SJ Park <sj@kernel.org>,
	"Matthew Wilcox (Oracle)" <willy@infradead.org>,
	Jan Kara <jack@suse.cz>, Jason Gunthorpe <jgg@ziepe.ca>,
	Leon Romanovsky <leon@kernel.org>,
	Miaohe Lin <linmiaohe@huawei.com>,
	Dennis Zhou <dennis@kernel.org>, Tejun Heo <tj@kernel.org>,
	Christoph Lameter <cl@gentwo.org>,
	Mike Rapoport <rppt@kernel.org>,
	Johannes Weiner <hannes@cmpxchg.org>,
	ziy@nvidia.com, pfalcato@suse.de, ryan.roberts@arm.com,
	linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org, linux-parisc@vger.kernel.org,
	xen-devel@lists.xenproject.org, linux-mm@kvack.org,
	linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org,
	kasan-dev@googlegroups.com, linux-trace-kernel@vger.kernel.org,
	bpf@vger.kernel.org, linux-perf-users@vger.kernel.org,
	damon@lists.linux.dev
Subject: Re: [PATCH RFC 05/11] mm: convert PTE table entries in ptep_get()
Date: Thu, 30 Jul 2026 11:25:29 +0100	[thread overview]
Message-ID: <cc3cbd79-d606-41dc-a83e-220ccc220ea8@arm.com> (raw)
In-Reply-To: <9ac3f058-2a22-4801-8633-65635053c8ea-agordeev@linux.ibm.com>

On 30/07/2026 11:24 am, Alexander Gordeev wrote:
> On Thu, Jul 30, 2026 at 11:11:35AM +0100, Muhammad Usama Anjum wrote:
>> On 30/07/2026 11:08 am, Alexander Gordeev wrote:
>>> On Mon, Jul 27, 2026 at 05:46:56PM +0100, Muhammad Usama Anjum wrote:
>>>> 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() as the conversion hook
>>>> and apply it in the generic ptep_get() implementation.
>>>>
>>>> Signed-off-by: Muhammad Usama Anjum <usama.anjum@arm.com>
>>>> ---
>>>>  include/linux/pgtable.h       | 2 +-
>>>>  include/linux/pgtable_types.h | 1 +
>>>>  2 files changed, 2 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h
>>>> index dad80d264aac2..3003ac9cd81fe 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 READ_ONCE(__pte_from_hw(*ptep));
>>>
>>> Should it be something like?
>>>
>>> 	return __pte_from_hw(READ_ONCE(*ptep));
>> I'd thought about it. My thinking is that we should get the pte_t first before
>> before calling READ_ONCE(). Please correct me what makes more sense?
> 
> I have a problem with "get the pte_t first" part ;) I think what we want
> is atomically read the hw_pte_t from the HW table and then convert the
> result to pte_t.
Got it. I'll fix it in the next version.

> 
>>>
>>>>  }
>>>>  #endif
>>>>  
>>>> diff --git a/include/linux/pgtable_types.h b/include/linux/pgtable_types.h
>>>> index ed5dba42a4f8c..61afe27307ec2 100644
>>>> --- a/include/linux/pgtable_types.h
>>>> +++ b/include/linux/pgtable_types.h
>>>> @@ -6,6 +6,7 @@
>>>>  
>>>>  #ifndef __HAVE_ARCH_HW_PTE_T
>>>>  #define hw_pte_t pte_t
>>>> +#define __pte_from_hw(pte)	(pte)
>>>>  #endif
>>>>  
>>>>  #endif /* _LINUX_PGTABLE_TYPES_H */
>>>> -- 
>>>> 2.47.3
>>>>
>>
>> -- 
>> Thanks,
>> Usama
>>

-- 
Thanks,
Usama


  reply	other threads:[~2026-07-30 10:26 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-27 16:46 [PATCH RFC 00/11] mm: distinguish PTE table storage from PTE values Muhammad Usama Anjum
2026-07-27 16:46 ` [PATCH RFC 01/11] mm: introduce hw_pte_t for PTE table storage Muhammad Usama Anjum
2026-07-27 16:46 ` [PATCH RFC 02/11] mm: make hw_pte_t visible to generic PTE interfaces Muhammad Usama Anjum
2026-07-27 16:46 ` [PATCH RFC 03/11] mm: name pointers to copied PTE values ptentp Muhammad Usama Anjum
2026-07-27 16:46 ` [PATCH RFC 04/11] mm: use hw_pte_t for generic PTE table storage Muhammad Usama Anjum
2026-07-27 16:46 ` [PATCH RFC 05/11] mm: convert PTE table entries in ptep_get() Muhammad Usama Anjum
2026-07-30 10:08   ` Alexander Gordeev
2026-07-30 10:11     ` Muhammad Usama Anjum
2026-07-30 10:24       ` Alexander Gordeev
2026-07-30 10:25         ` Muhammad Usama Anjum [this message]
2026-07-27 16:46 ` [PATCH RFC 06/11] mm/kasan: use hw_pte_t for the early shadow PTE table Muhammad Usama Anjum
2026-07-30 11:26   ` Alexander Gordeev
2026-07-30 13:11     ` Muhammad Usama Anjum
2026-07-27 16:46 ` [PATCH RFC 07/11] mm/mremap: use ptep_get() for the destination PTE Muhammad Usama Anjum
2026-07-30 11:29   ` Alexander Gordeev
2026-07-30 12:59     ` Muhammad Usama Anjum
2026-07-27 16:46 ` [PATCH RFC 08/11] drm/i915: use hw_pte_t for PTE range callbacks Muhammad Usama Anjum
2026-07-27 16:47 ` [PATCH RFC 09/11] misc/sgi-gru: use ptep_get() for page-table reads Muhammad Usama Anjum
2026-07-29 12:36   ` Pedro Falcato
2026-07-29 12:42     ` David Hildenbrand (Arm)
2026-07-29 17:03     ` Muhammad Usama Anjum
2026-07-27 16:47 ` [PATCH RFC 10/11] parisc: use hw_pte_t for the data-break callback Muhammad Usama Anjum
2026-07-27 16:47 ` [PATCH RFC 11/11] xen: use hw_pte_t for PTE range callbacks Muhammad Usama Anjum
2026-07-28 19:26 ` [PATCH RFC 00/11] mm: distinguish PTE table storage from PTE values David Hildenbrand (Arm)
2026-07-29 10:13   ` Alexander Gordeev
2026-07-29 11:05     ` David Hildenbrand (Arm)
2026-07-29 11:33       ` Muhammad Usama Anjum
2026-07-29 11:52         ` David Hildenbrand (Arm)
2026-07-29 12:21           ` Muhammad Usama Anjum
2026-07-29 12:28             ` David Hildenbrand (Arm)
2026-07-29 11:44       ` Alexander Gordeev
2026-07-29 11:51         ` David Hildenbrand (Arm)
2026-07-29 11:18   ` 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=cc3cbd79-d606-41dc-a83e-220ccc220ea8@arm.com \
    --to=usama.anjum@arm.com \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=acme@kernel.org \
    --cc=agordeev@linux.ibm.com \
    --cc=airlied@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=andrii@kernel.org \
    --cc=aneesh.kumar@kernel.org \
    --cc=arnd@arndb.de \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=chrisl@kernel.org \
    --cc=cl@gentwo.org \
    --cc=damon@lists.linux.dev \
    --cc=daniel@iogearbox.net \
    --cc=david@kernel.org \
    --cc=deller@gmx.de \
    --cc=dennis@kernel.org \
    --cc=dimitri.sivanich@hpe.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=eddyz87@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jack@suse.cz \
    --cc=jani.nikula@linux.intel.com \
    --cc=jgg@ziepe.ca \
    --cc=jgross@suse.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=kasong@tencent.com \
    --cc=leon@kernel.org \
    --cc=liam@infradead.org \
    --cc=linmiaohe@huawei.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=ljs@kernel.org \
    --cc=memxor@gmail.com \
    --cc=mhiramat@kernel.org \
    --cc=mingo@redhat.com \
    --cc=muchun.song@linux.dev \
    --cc=namhyung@kernel.org \
    --cc=npiggin@gmail.com \
    --cc=osalvador@suse.de \
    --cc=pasha.tatashin@soleen.com \
    --cc=peterz@infradead.org \
    --cc=pfalcato@suse.de \
    --cc=rodrigo.vivi@intel.com \
    --cc=rostedt@goodmis.org \
    --cc=rppt@kernel.org \
    --cc=ryabinin.a.a@gmail.com \
    --cc=ryan.roberts@arm.com \
    --cc=simona@ffwll.ch \
    --cc=sj@kernel.org \
    --cc=sstabellini@kernel.org \
    --cc=tj@kernel.org \
    --cc=tursulin@ursulin.net \
    --cc=urezki@gmail.com \
    --cc=will@kernel.org \
    --cc=willy@infradead.org \
    --cc=xen-devel@lists.xenproject.org \
    --cc=ziy@nvidia.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