Re: [PATCH 2/4] mm/tlb: Remove tlb_remove_table() non-concurrent condition
From: Nicholas Piggin
Date: Thu Aug 23 2018 - 00:16:54 EST
On Wed, 22 Aug 2018 20:35:16 -0700
Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
> On Wed, Aug 22, 2018 at 8:31 PM Nicholas Piggin <npiggin@xxxxxxxxx> wrote:
> >
> >
> > So that leaves speculative operations. I don't see where the problem is
> > with those either -- this shortcut needs to ensure there are no other
> > *non speculative* operations. mm_users is correct for that.
>
> No. Because mm_users doesn't contain any lazy tlb users.
>
> And yes, those lazy tlbs are all kernel threads, but they can still
> speculatively load user addresses.
So?
If the arch does not shoot those all down after the user page tables
are removed then it's buggy regardless of this short cut.
The only real problem I could see would be if a page walk cache still
points to the freed table, then the table gets re-allocated and used
elsewhere, and meanwhile a speculative access tries to load an entry
from the page that is an invalid form of page table that might cause
a machine check or something. That would be (u)arch specific, but if
that's what we're concerned with here it's a different issue and needs
to be documented as such.
I'll have a look at powerpc and see if we can cope with it. If so, I'll
make it an arch specific opt-in short cut.
Thanks,
Nick