Re: [PATCH 1/9] x86/mm/pat: flush the TLB when only an alias mapping changed

From: Mike Rapoport

Date: Tue Dec 01 2026 - 06:50:21 EST


On Mon, Nov 30, 2026 at 10:55:14PM +0000, Edgecombe, Rick P wrote:
> On Thu, 2026-11-26 at 09:34 +0200, Mike Rapoport wrote:
> > On Wed, Nov 25, 2026 at 08:38:18PM +0000, Edgecombe, Rick P wrote:
> > > On Wed, 2026-11-25 at 10:59 +0200, Mike Rapoport wrote:
> > > > Like the cover letter said it's "unlikely to happen in practice" :)
> > > >
> > > > Currently there are no callers in the tree that could trigger that.
> > > >
> > > > I'm working the generic set_memory_core [1] and the bots keep yelling at me
> > > > whenever I touch anything around.
> > > >
> > > > So while is a defense against potential future issues, the change is simple
> > > > and I think it's better to have it.
> > > >
> > > > Might also save us from reviewing several LLM generated reports that would
> > > > find the same thing ;-)
> > >
> > > Yea duplicates and AI false positives are a problem. But changing the code to
> > > prevent the reports seems backwards. Though I don't have any other solution then
> > > just drown in things to check.
> >
> > The change is more to prevent a potential future issue than to stop AI
> > reports.
> >  
> > With more and more use cases using set_memory, adding code that ensures
> > there is no missing flush now is better than hunting it down when some new
> > caller hits it :)
> >
> > > > [1]
> > > > https://lore.kernel.org/all/20260721-generic-set-memory-v0-1-v1-0-2c1fc62306b3@xxxxxxxxxx
> > >
> > > Neat... But I think set_memory() was never the ideal interface for kernel memory
> > > management. Maybe this is step towards that?
> >
> > The very first one, yes.
>
> Cool.
>
> >
> > Right now it's a total mess:
> >
> > https://docs.kernel.org/mm/kernel-page-tables.html
>
> Ha! Yes.
>
> >
> > and the first step I'm working on is at least to make all architectures
> > behave consistently.
>
> It will be tricky. I'd think to stick to just unifying the virtual memory
> permissions. The cache property stuff gets very x86 specific. MTRRs, etc.

Cache properties stuff is not the only very x86 specific thing :)

> What is the intended scope? Depending, it may be better to build a new thing and
> then unify it, rather than unify the old implementations only to rebuild it.

The goal is to have a common page table walk, the same decisions about
splitting and collapsing (whenever supported) and the same locking model
for all architectures.

Than the very first thing that I consider a must is to make permission
updates follow all-or-nothing, in the sense that either all or none of the
permissions are updated.

I considered creating a new common core from scratch and than switching
architectures to it, but then I decided that adopting x86's implementation
is safer and easier to reason about.

--
Sincerely yours,
Mike.