Re: [PATCH] mm: don't defer freeing kernel page tables while booting
From: Lorenzo Stoakes (ARM)
Date: Thu Sep 24 2026 - 04:58:50 EST
On Thu, Sep 24, 2026 at 09:31:40AM +0200, David Hildenbrand (Arm) wrote:
> On 9/24/26 09:28, Mikhail Gavrilov wrote:
> > On 9/24/26 09:07, David Hildenbrand (Arm) wrote:
> >> Should we instead simply skip the
> >>
> >> schedule_work(&kernel_pgtable_work.work);
> >>
> >> and rely on anybody freeing stuff later to just free that one alongside?
> >>
> >> That avoids throwing in more freeing handling.
> >
> > Yes, that is simpler, and the early table then goes through the same
> > IOMMU flush as every other one, so there is no need to reason about
> > what an IOMMU can see during boot. The only cost is that it waits on
> > the list until the next kernel page table is freed after boot.
>
> If we're worried about that actually causing problems we could drain the list at
> a later part during the boot stage. I'd suspect we free something else later
> already and simply drain the list ...
Yup agreed this is the best fix.
Please go ahead with that Mikhail.
I hate that the Fixes: is a patch that actually makes the CPA code do the right
thing rather than the fact this whole code path is possible this early, but it
is the correct one from the point of view of what exposes the bug.
>
> --
> Cheers,
>
> David
--
Cheers, Lorenzo