All of lore.kernel.org
 help / color / mirror / Atom feed
From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Muhammad Usama Anjum <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>,
	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 00/11] mm: distinguish PTE table storage from PTE values
Date: Wed, 29 Jul 2026 13:51:17 +0200	[thread overview]
Message-ID: <26b1cb23-bb68-45c4-a28f-698b34fa3aed@kernel.org> (raw)
In-Reply-To: <e3b6dd13-2cea-4dc5-9038-a3abde71ec10-agordeev@linux.ibm.com>

On 7/29/26 13:44, Alexander Gordeev wrote:
> On Wed, Jul 29, 2026 at 01:05:35PM +0200, David Hildenbrand (Arm) wrote:
>> On 7/29/26 12:13, Alexander Gordeev wrote:
>>> ...
>>>
>>> May be we need the generic hw_pte_t implementation as { pte_t pte; }
>>> right away?
>>
>> Indeed, that makes sense. We just need a way for the architecture to opt-in that
>> it did the conversion.
>>
>>>
>>> Also, can you envision a case when sizeof(pte_t) != sizeof(hw_pte_t)?
>>> If not, the compile-time check is worth adding.
>>
>> That wouldn't work as is. We'd have to intercept ptep++ and instead have a
>> helper to advance the ptep pointer.
> 
> I think I am missing the point. That is my takeaway from your previous mail:
> https://lore.kernel.org/lkml/31d36023-d728-4eee-90f8-158c7066f565@kernel.org/
> 
> <quote>
>>    {
>>       page_table_check_ptes_set(mm, addr, ptep, pte, nr);
>>       for (;;) {
>>               set_pte(ptep, pte);
>>               if (--nr == 0)
>>                       break;
>>   -           ptep++;
>>   +           ptep = hw_pte_next(ptep);
> 
> We should really just let ptep++ work as before.
> 
>>               pte = pte_next_pfn(pte);
>>       }
>>    }
> </quote>
> 
> So are we going after hw_pte_next(ptep) or ptep++?

As I said "That wouldn't work as is. We'd have ".

So in this series here we are clearly going for ptep++ and sizeof(pte_t) ==
sizeof(hw_pte_t).

Because otherwise it wouldn't work.

> 
>> One idea for that would be to let the compiler catch that by marking hw_pte_t an
>> undefined struct (unknown size), such that the compiler would indicate any usage
>> of ptep++ properly.
> 
> What is the purpose of that? I mean when pte_t vs hw_pte_t uses are sorted
> out what is the benefit of preventing hw_ptep++?

One thing I could pull out of my magic hat is that you might be able to decide
at runtime the size of your underlying page table entries.

E.g., have 128bit pteval, but allow running on HW with either 64bit ptes or
128bit ptes.

I'm sure there are more challenges to that, but that's an easy thing to imagine.

But again, the focus of this patch set here is ptep++ to just keep working.

-- 
Cheers,

David

  reply	other threads:[~2026-07-29 11:51 UTC|newest]

Thread overview: 30+ 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:58   ` sashiko-bot
2026-07-28 14:48     ` 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-27 16:58   ` sashiko-bot
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-27 16:46 ` [PATCH RFC 07/11] mm/mremap: use ptep_get() for the destination PTE 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-27 17:09   ` sashiko-bot
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-27 17:06   ` sashiko-bot
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) [this message]
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=26b1cb23-bb68-45c4-a28f-698b34fa3aed@kernel.org \
    --to=david@kernel.org \
    --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=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=usama.anjum@arm.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.