From: Alexander Gordeev <agordeev@linux.ibm.com>
To: Muhammad Usama Anjum <usama.anjum@arm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
David Hildenbrand <david@kernel.org>,
Lorenzo Stoakes <ljs@kernel.org>,
"Liam R. Howlett" <liam@infradead.org>,
Vlastimil Babka <vbabka@kernel.org>,
Mike Rapoport <rppt@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>, Xu Xin <xu.xin16@zte.com.cn>,
Chengming Zhou <chengming.zhou@linux.dev>,
Jann Horn <jannh@google.com>, Muchun Song <muchun.song@linux.dev>,
Oscar Salvador <osalvador@suse.de>,
Pedro Falcato <pfalcato@suse.de>, Arnd Bergmann <arnd@arndb.de>,
Will Deacon <will@kernel.org>,
"Aneesh Kumar K.V" <aneesh.kumar@kernel.org>,
Nick Piggin <npiggin@gmail.com>,
Peter Zijlstra <peterz@infradead.org>,
Pasha Tatashin <pasha.tatashin@soleen.com>,
Rik van Riel <riel@surriel.com>, Harry Yoo <harry@kernel.org>,
Lance Yang <lance.yang@linux.dev>, Chris Li <chrisl@kernel.org>,
Kairui Song <kasong@tencent.com>,
Kemeng Shi <shikemeng@huaweicloud.com>,
Nhat Pham <nphamcs@gmail.com>, Baoquan He <baoquan.he@linux.dev>,
Barry Song <baohua@kernel.org>,
Youngjun Park <youngjun.park@lge.com>,
Uladzislau Rezki <urezki@gmail.com>,
Steven Rostedt <rostedt@goodmis.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
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>,
Martin KaFai Lau <martin.lau@linux.dev>,
Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
Jiri Olsa <jolsa@kernel.org>,
Emil Tsalapatis <emil@etsalapatis.com>,
Ihor Solodrai <ihor.solodrai@linux.dev>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
James Clark <james.clark@linaro.org>, SJ Park <sj@kernel.org>,
"Matthew Wilcox (Oracle)" <willy@infradead.org>,
Jan Kara <jack@suse.cz>, Jason Gunthorpe <jgg@ziepe.ca>,
John Hubbard <jhubbard@nvidia.com>, Peter Xu <peterx@redhat.com>,
Leon Romanovsky <leon@kernel.org>, Zi Yan <ziy@nvidia.com>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
Nico Pache <nico.pache@linux.dev>,
Ryan Roberts <ryan.roberts@arm.com>, Dev Jain <dev.jain@arm.com>,
Usama Arif <usama.arif@linux.dev>,
Kiryl Shutsemau <kas@kernel.org>,
Andrey Ryabinin <ryabinin.a.a@gmail.com>,
Alexander Potapenko <glider@google.com>,
Andrey Konovalov <andreyknvl@gmail.com>,
Dmitry Vyukov <dvyukov@google.com>,
Vincenzo Frascino <vincenzo.frascino@arm.com>,
Miaohe Lin <linmiaohe@huawei.com>,
Naoya Horiguchi <nao.horiguchi@gmail.com>,
Matthew Brost <matthew.brost@intel.com>,
Joshua Hahn <joshua.hahnjy@gmail.com>,
Rakie Kim <rakie.kim@sk.com>, Byungchul Park <byungchul@sk.com>,
Gregory Price <gourry@gourry.net>,
Ying Huang <ying.huang@linux.alibaba.com>,
Alistair Popple <apopple@nvidia.com>,
Dennis Zhou <dennis@kernel.org>, Tejun Heo <tj@kernel.org>,
Christoph Lameter <cl@gentwo.org>,
Johannes Weiner <hannes@cmpxchg.org>,
Qi Zheng <qi.zheng@linux.dev>,
Shakeel Butt <shakeel.butt@linux.dev>,
Axel Rasmussen <axelrasmussen@google.com>,
Yuanchu Xie <yuanchu@google.com>, Wei Xu <weixugc@google.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>,
Juergen Gross <jgross@suse.com>,
Stefano Stabellini <sstabellini@kernel.org>,
Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org,
linux-trace-kernel@vger.kernel.org, bpf@vger.kernel.org,
linux-perf-users@vger.kernel.org, damon@lists.linux.dev,
kasan-dev@googlegroups.com, intel-gfx@lists.freedesktop.org,
dri-devel@lists.freedesktop.org, xen-devel@lists.xenproject.org
Subject: Re: [PATCH v3 0/9] mm: distinguish HW PTE pointers from SW PTE value pointers
Date: Mon, 28 Sep 2026 09:09:29 +0200 [thread overview]
Message-ID: <20260928070929.80522Ae0-agordeev@linux.ibm.com> (raw)
In-Reply-To: <20260922-pte0-v3-0-5670b8cb9059@arm.com>
On Tue, Sep 22, 2026 at 06:12:28PM +0100, Muhammad Usama Anjum wrote:
> Hi,
>
> pte_t currently describes both a software PTE value and an element stored
> in a PTE table. Consequently, pte_t * can point either to a software PTE
> value, often a stack copy, or to a PTE-table slot. The compiler cannot
> distinguish these cases. A value pointer can therefore be passed to an
> interface that expects table storage, while table storage can be read by
> direct dereference instead of the architecture accessor.
>
> This series begins a staged conversion at the PTE level. It introduces
> hw_pte_t as the element type for PTE-table storage and converts generic
> MM to use hw_pte_t *. Software PTE values remain pte_t. Interfaces that
> intentionally return a value through pte_t *, such as install_pte,
> remain value interfaces; the relevant parameters are named ptentp to
> make that distinction explicit.
>
> The generic definition aliases hw_pte_t to pte_t unless an architecture
> selects ARCH_HAS_HW_PTE_T, which enables a distinct generic wrapper named
> __hw_pte_t. Some architectures define pgtable_t in headers parsed before
> the generic hw_pte_t typedef is visible. The structure tag allows those
> headers to define pgtable_t as struct __hw_pte_t * without creating an
> include-order dependency. This is required when converting s390, m68k,
> powerpc and sparc.
>
> No architecture selects ARCH_HAS_HW_PTE_T in this series, so the
> representation and behavior of every architecture are preserved. ptep_get()
> keeps its existing READ_ONCE() semantics and converts the stored element
> through __pte_from_hw(). An architecture can later select the option and
> convert its PTE interfaces to make the distinction compiler-enforced.
> Architecture PTE implementations and most architecture code are
> deliberately left for those later opt-in conversions.
>
> Here, hw_pte_t identifies PTE-table storage rather than table lifetime:
> complete PTE tables use hw_pte_t whether or not they are currently
> linked into a page-table hierarchy, while software PTE values use
> pte_t. The distinction between complete but unlinked tables and
> hardware-reachable tables was raised during discussion and remains an
> important point for review.
>
> PMD, PUD, P4D and PGD storage are deliberately out of scope. They can be
> converted in later series after the PTE boundary is agreed, avoiding the
> PMD-specific cases that made an all-level conversion difficult to
> review.
>
> Most mechanical pointer conversions were generated with the Coccinelle
> script included below, then audited and fixed by hand.
>
> This series does not add a second ptep_get_once() accessor and does not
> remove or replace STRICT_MM_TYPECHECKS.
>
> The design discussion is available at [1]; while the original idea came
> from [2].
>
> I've the patches here [3] for arm64 conversion which I used to find
> usages in generic code which I missed during development.
>
> [1] https://lore.kernel.org/all/6110202c-057b-4701-8c04-1a76ee7bb9ab@arm.com/
> [2] https://lore.kernel.org/all/a063f6c5-2785-4a9f-8079-25edb3e54cef@arm.com
> [3] https://lore.kernel.org/all/20260914-pte0_arm-v1-0-bb53b663e396@arm.com
>
> Testing:
> Testing was performed with and without the series on both x86_64 and
> arm64. KUnit and the MM kselftests produced matching before-and-after
> results problems or regressions. Fastpath performance testing was also
> completed on arm64. No regression was found.
>
> Thanks,
> Usama
...
> Muhammad Usama Anjum (9):
> mm: introduce hw_pte_t for PTE table storage
> mm: rename pointers to software PTE values as ptentp
> mm: use hw_pte_t for generic PTE table storage
> mm: convert PTE table entries in ptep_get()
> mm: convert PTE table entry to pte
> mm: add hw_pte_val for HW PTE storage
> mm/kasan: use hw_pte_t for the early shadow PTE table
> drm/i915: use hw_pte_t for PTE range callbacks
> xen: use hw_pte_t for PTE range callbacks
>
> MAINTAINERS | 1 +
> drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c | 4 +--
> drivers/gpu/drm/i915/i915_mm.c | 4 +--
> drivers/xen/gntdev.c | 2 +-
> drivers/xen/privcmd.c | 2 +-
> drivers/xen/xenbus/xenbus_client.c | 2 +-
> drivers/xen/xlate_mmu.c | 4 +--
> fs/hugetlbfs/inode.c | 3 +-
> fs/proc/task_mmu.c | 33 ++++++++++----------
> include/asm-generic/hugetlb.h | 15 ++++-----
> include/asm-generic/pgalloc.h | 6 ++--
> include/asm-generic/tlb.h | 5 +--
> include/linux/hugetlb.h | 53 +++++++++++++++++--------------
> include/linux/kasan.h | 2 +-
> include/linux/mm.h | 26 ++++++++--------
> include/linux/page_table_check.h | 10 ++++--
> include/linux/pagewalk.h | 10 +++---
> include/linux/pgtable.h | 81 +++++++++++++++++++++++++-----------------------
> include/linux/pgtable_types.h | 23 ++++++++++++++
> include/linux/rmap.h | 2 +-
> include/linux/swapops.h | 6 ++--
> include/linux/vmalloc.h | 4 +--
> include/trace/events/xen.h | 10 +++---
> kernel/bpf/arena.c | 9 +++---
> kernel/events/core.c | 3 +-
> mm/Kconfig | 3 ++
> mm/damon/ops-common.c | 2 +-
> mm/damon/ops-common.h | 2 +-
> mm/damon/vaddr.c | 20 ++++++------
> mm/debug_vm_pgtable.c | 2 +-
> mm/filemap.c | 4 +--
> mm/gup.c | 9 +++---
> mm/highmem.c | 15 ++++-----
> mm/hmm.c | 6 ++--
> mm/huge_memory.c | 4 +--
> mm/hugetlb.c | 60 ++++++++++++++++++-----------------
> mm/hugetlb_vmemmap.c | 13 ++++----
> mm/internal.h | 16 +++++-----
> mm/kasan/init.c | 14 ++++-----
> mm/kasan/shadow.c | 6 ++--
> mm/khugepaged.c | 50 ++++++++++++++++++------------
> mm/ksm.c | 11 ++++---
> mm/madvise.c | 18 ++++++-----
> mm/mapping_dirty_helpers.c | 4 +--
> mm/memory-failure.c | 6 ++--
> mm/memory.c | 78 +++++++++++++++++++++++-----------------------
> mm/mempolicy.c | 4 +--
> mm/migrate.c | 4 +--
> mm/migrate_device.c | 4 +--
> mm/mincore.c | 4 +--
> mm/mlock.c | 4 +--
> mm/mprotect.c | 19 ++++++------
> mm/mremap.c | 4 +--
> mm/page_table_check.c | 4 +--
> mm/pagewalk.c | 9 +++---
> mm/percpu.c | 2 +-
> mm/pgtable-generic.c | 20 ++++++------
> mm/ptdump.c | 4 +--
> mm/rmap.c | 6 ++--
> mm/sparse-vmemmap.c | 22 ++++++-------
> mm/swap_state.c | 3 +-
> mm/swapfile.c | 5 +--
> mm/userfaultfd.c | 32 ++++++++++---------
> mm/util.c | 2 +-
> mm/vmalloc.c | 11 ++++---
> mm/vmscan.c | 6 ++--
> 66 files changed, 457 insertions(+), 375 deletions(-)
> ---
> base-commit: ead700ca770c82167af32622cf8b68c9f87c3c7c
> change-id: 20260914-pte0-6c88f5592d79
I backported this series to the Linus master and tested on s390
with the lazy mmu series applied on top. In case it still counts:
Tested-by: Alexander Gordeev <agordeev@linux.ibm.com>
> Best regards,
> --
> Usama
Thanks!
prev parent reply other threads:[~2026-09-28 7:10 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-22 17:12 Muhammad Usama Anjum
2026-09-22 17:12 ` [PATCH v3 1/9] mm: introduce hw_pte_t for PTE table storage Muhammad Usama Anjum
2026-09-22 17:12 ` [PATCH v3 2/9] mm: rename pointers to software PTE values as ptentp Muhammad Usama Anjum
2026-09-22 17:12 ` [PATCH v3 3/9] mm: use hw_pte_t for generic PTE table storage Muhammad Usama Anjum
2026-09-22 17:12 ` [PATCH v3 4/9] mm: convert PTE table entries in ptep_get() Muhammad Usama Anjum
2026-09-22 17:12 ` [PATCH v3 5/9] mm: convert PTE table entry to pte Muhammad Usama Anjum
2026-09-22 17:12 ` [PATCH v3 6/9] mm: add hw_pte_val for HW PTE storage Muhammad Usama Anjum
2026-09-22 17:12 ` [PATCH v3 7/9] mm/kasan: use hw_pte_t for the early shadow PTE table Muhammad Usama Anjum
2026-09-22 17:12 ` [PATCH v3 8/9] drm/i915: use hw_pte_t for PTE range callbacks Muhammad Usama Anjum
2026-09-22 17:12 ` [PATCH v3 9/9] xen: " Muhammad Usama Anjum
2026-09-28 7:09 ` Alexander Gordeev [this message]
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=20260928070929.80522Ae0-agordeev@linux.ibm.com \
--to=agordeev@linux.ibm.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=airlied@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=andreyknvl@gmail.com \
--cc=andrii@kernel.org \
--cc=aneesh.kumar@kernel.org \
--cc=apopple@nvidia.com \
--cc=arnd@arndb.de \
--cc=ast@kernel.org \
--cc=axelrasmussen@google.com \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=baoquan.he@linux.dev \
--cc=bpf@vger.kernel.org \
--cc=byungchul@sk.com \
--cc=chengming.zhou@linux.dev \
--cc=chrisl@kernel.org \
--cc=cl@gentwo.org \
--cc=damon@lists.linux.dev \
--cc=daniel@iogearbox.net \
--cc=david@kernel.org \
--cc=dennis@kernel.org \
--cc=dev.jain@arm.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=dvyukov@google.com \
--cc=eddyz87@gmail.com \
--cc=emil@etsalapatis.com \
--cc=glider@google.com \
--cc=gourry@gourry.net \
--cc=hannes@cmpxchg.org \
--cc=harry@kernel.org \
--cc=ihor.solodrai@linux.dev \
--cc=intel-gfx@lists.freedesktop.org \
--cc=irogers@google.com \
--cc=jack@suse.cz \
--cc=james.clark@linaro.org \
--cc=jani.nikula@linux.intel.com \
--cc=jannh@google.com \
--cc=jgg@ziepe.ca \
--cc=jgross@suse.com \
--cc=jhubbard@nvidia.com \
--cc=jolsa@kernel.org \
--cc=joonas.lahtinen@linux.intel.com \
--cc=joshua.hahnjy@gmail.com \
--cc=kas@kernel.org \
--cc=kasan-dev@googlegroups.com \
--cc=kasong@tencent.com \
--cc=lance.yang@linux.dev \
--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-perf-users@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=ljs@kernel.org \
--cc=mark.rutland@arm.com \
--cc=martin.lau@linux.dev \
--cc=mathieu.desnoyers@efficios.com \
--cc=matthew.brost@intel.com \
--cc=memxor@gmail.com \
--cc=mhiramat@kernel.org \
--cc=mhocko@suse.com \
--cc=mingo@redhat.com \
--cc=muchun.song@linux.dev \
--cc=namhyung@kernel.org \
--cc=nao.horiguchi@gmail.com \
--cc=nico.pache@linux.dev \
--cc=nphamcs@gmail.com \
--cc=npiggin@gmail.com \
--cc=oleksandr_tyshchenko@epam.com \
--cc=osalvador@suse.de \
--cc=pasha.tatashin@soleen.com \
--cc=peterx@redhat.com \
--cc=peterz@infradead.org \
--cc=pfalcato@suse.de \
--cc=qi.zheng@linux.dev \
--cc=rakie.kim@sk.com \
--cc=riel@surriel.com \
--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=shakeel.butt@linux.dev \
--cc=shikemeng@huaweicloud.com \
--cc=simona@ffwll.ch \
--cc=sj@kernel.org \
--cc=song@kernel.org \
--cc=sstabellini@kernel.org \
--cc=surenb@google.com \
--cc=tj@kernel.org \
--cc=tursulin@ursulin.net \
--cc=urezki@gmail.com \
--cc=usama.anjum@arm.com \
--cc=usama.arif@linux.dev \
--cc=vbabka@kernel.org \
--cc=vincenzo.frascino@arm.com \
--cc=weixugc@google.com \
--cc=will@kernel.org \
--cc=willy@infradead.org \
--cc=xen-devel@lists.xenproject.org \
--cc=xu.xin16@zte.com.cn \
--cc=ying.huang@linux.alibaba.com \
--cc=yonghong.song@linux.dev \
--cc=youngjun.park@lge.com \
--cc=yuanchu@google.com \
--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
all inboxes | Powered by JetHome®