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 v2 1/8] mm: introduce hw_pte_t for PTE table storage
Date: Wed, 23 Sep 2026 14:44:40 +0100 [thread overview]
Message-ID: <b9054539-2f3c-4fee-aad5-c6e725c6ea1c@arm.com> (raw)
In-Reply-To: <4fb9f42e-73c3-46db-ac10-351a90901b7c-agordeev@linux.ibm.com>
On 23/09/2026 12:52 pm, Alexander Gordeev wrote:
> On Thu, Sep 03, 2026 at 11:29:53AM +0100, Muhammad Usama Anjum wrote:
>> pte_t is used both for software PTE values and for entries stored in a PTE
>> table, so pte_t * does not distinguish a pointer to a software PTE
>> value from a pointer to table storage.
>>
>> Introduce hw_pte_t as the generic name for a PTE table element. Define it
>> as a macro alias of pte_t by default. When an architecture selects
>> ARCH_HAS_HW_PTE_T, define it as a structure containing a pte_t instead.
>> This preserves the representation while allowing converted architectures
>> to enforce the distinction at compile time.
>>
>> Name the generic wrapper structure __hw_pte_t so architectures can
>> forward-declare it when pgtable_t must be defined before the generic
>> hw_pte_t typedef is visible. This avoids header-order dependencies.
>>
>> Keep the C type definitions behind an __ASSEMBLY__ check because
>> architecture assembly sources can include this header indirectly. Include
>> asm/page.h so consumers such as linux/vmalloc.h retain the page definitions
>> they previously obtained from that header.
>>
>> Signed-off-by: Muhammad Usama Anjum <usama.anjum@arm.com>
>> ---
>> Changes since v1:
>> - Name the generic wrapper structure __hw_pte_t so architectures can
>> forward-declare it, and explain why this is required.
>> - Use software PTE value terminology.
>>
>> Changes since RFC v1:
>> - Add the ARCH_HAS_HW_PTE_T opt-in and generic wrapper definition.
>> - Exclude the C type definitions from assembly sources.
>> - Update the description for the new opt-in model.
>> ---
>> MAINTAINERS | 1 +
>> include/linux/pgtable_types.h | 17 +++++++++++++++++
>> mm/Kconfig | 3 +++
>> 3 files changed, 21 insertions(+)
>> create mode 100644 include/linux/pgtable_types.h
>>
>> diff --git a/MAINTAINERS b/MAINTAINERS
>> index 2133aec4a2004..da60a8bdcddb5 100644
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> @@ -17140,6 +17140,7 @@ F: include/linux/mmu_notifier.h
>> F: include/linux/pagewalk.h
>> F: include/linux/pgalloc.h
>> F: include/linux/pgtable.h
>> +F: include/linux/pgtable_types.h
>> F: include/linux/ptdump.h
>> F: include/linux/vmpressure.h
>> F: include/linux/vmstat.h
>> diff --git a/include/linux/pgtable_types.h b/include/linux/pgtable_types.h
>> new file mode 100644
>> index 0000000000000..07da05d375c2c
>> --- /dev/null
>> +++ b/include/linux/pgtable_types.h
>> @@ -0,0 +1,17 @@
>> +/* SPDX-License-Identifier: GPL-2.0 */
>> +#ifndef _LINUX_PGTABLE_TYPES_H
>> +#define _LINUX_PGTABLE_TYPES_H
>> +
>> +#include <asm/page.h>
>> +
>> +#ifndef __ASSEMBLY__
>> +
>> +#ifdef CONFIG_ARCH_HAS_HW_PTE_T
>> +typedef struct __hw_pte_t { pte_t __pte; } hw_pte_t;
>> +#else
>> +#define hw_pte_t pte_t
>> +#endif
>
> I would suggest to provide __hw_pte() in this series - it is needed
> by architectures along with __pte_from_hw() right away (as opposed
> to when lands in arm64).
* __pte_from_hw() is added by 4th patch in this series.
* __hw_pte() was added in arm64 specific series. But it has been dropped
because of [1] in v2 of arm64 series [2]. There is no user of it in my both series.
Please feel free to add it if s390 needs it.
* hw_pte_val() was in arm64 specific series. It has since been moved to generic
series in v3 [3].
[1] https://lore.kernel.org/all/86d4aea6-4272-427e-9229-295489e068d7@arm.com
[2] arm64 v2: https://lore.kernel.org/all/20260922-pte0_arm-v2-0-a3f1ddff0a8a@arm.com
[3] genric v3: https://lore.kernel.org/all/20260922-pte0-v3-0-5670b8cb9059@arm.com
>
>> +#endif /* !__ASSEMBLY__ */
>> +
>> +#endif /* _LINUX_PGTABLE_TYPES_H */
>> diff --git a/mm/Kconfig b/mm/Kconfig
>> index c1ddf59c0d71a..5f462ec6fa5e5 100644
>> --- a/mm/Kconfig
>> +++ b/mm/Kconfig
>> @@ -1312,6 +1312,9 @@ comment "GUP_TEST needs to have DEBUG_FS enabled"
>> config GUP_GET_PXX_LOW_HIGH
>> bool
>>
>> +config ARCH_HAS_HW_PTE_T
>> + bool
>> +
>> config DMAPOOL_TEST
>> tristate "Enable a module to run time tests on dma_pool"
>> depends on HAS_DMA
>> --
>> 2.47.3
>>
--
Thanks,
Usama
next prev parent reply other threads:[~2026-09-23 13:45 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 10:29 [PATCH v2 0/8] mm: distinguish PTE table storage from PTE values Muhammad Usama Anjum
2026-09-03 10:29 ` [PATCH v2 1/8] mm: introduce hw_pte_t for PTE table storage Muhammad Usama Anjum
2026-09-03 10:36 ` sashiko-bot
2026-09-11 17:00 ` David Hildenbrand (Arm)
2026-09-23 11:52 ` Alexander Gordeev
2026-09-23 13:44 ` Muhammad Usama Anjum [this message]
2026-09-03 10:29 ` [PATCH v2 2/8] mm: rename pointers to software PTE values as ptentp Muhammad Usama Anjum
2026-09-03 10:35 ` sashiko-bot
2026-09-11 17:01 ` David Hildenbrand (Arm)
2026-09-03 10:29 ` [PATCH v2 3/8] mm: use hw_pte_t for generic PTE table storage Muhammad Usama Anjum
2026-09-03 10:48 ` sashiko-bot
2026-09-11 17:09 ` David Hildenbrand (Arm)
2026-09-03 10:29 ` [PATCH v2 4/8] mm: convert PTE table entries in ptep_get() Muhammad Usama Anjum
2026-09-03 10:45 ` sashiko-bot
2026-09-03 10:29 ` [PATCH v2 5/8] mm: convert PTE table entry to pte Muhammad Usama Anjum
2026-09-03 10:40 ` sashiko-bot
2026-09-03 10:29 ` [PATCH v2 6/8] mm/kasan: use hw_pte_t for the early shadow PTE table Muhammad Usama Anjum
2026-09-03 10:36 ` sashiko-bot
2026-09-03 10:29 ` [PATCH v2 7/8] drm/i915: use hw_pte_t for PTE range callbacks Muhammad Usama Anjum
2026-09-03 10:36 ` sashiko-bot
2026-09-03 10:30 ` [PATCH v2 8/8] xen: " Muhammad Usama Anjum
2026-09-03 10:43 ` sashiko-bot
2026-09-03 11:36 ` ✗ Fi.CI.BUILD: failure for mm: distinguish PTE table storage from PTE values (rev4) Patchwork
2026-09-11 16:55 ` [PATCH v2 0/8] mm: distinguish PTE table storage from PTE values David Hildenbrand (Arm)
2026-09-14 14:27 ` Muhammad Usama Anjum
2026-09-18 12:57 ` Alexander Gordeev
2026-09-11 16:59 ` David Hildenbrand (Arm)
2026-09-14 14:20 ` Muhammad Usama Anjum
2026-09-23 12:25 ` Alexander Gordeev
2026-09-23 13:47 ` Muhammad Usama Anjum
2026-09-23 14:19 ` Alexander Gordeev
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=b9054539-2f3c-4fee-aad5-c6e725c6ea1c@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 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.