Re: [PATCH v5 4/9] mm: Add test_clear_young_fast_only MMU notifier

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 10, 2024, James Houghton wrote:
> On Tue, Jul 9, 2024 at 10:49 AM Sean Christopherson <seanjc@xxxxxxxxxx> wrote:
> >
> > On Mon, Jul 08, 2024, James Houghton wrote:
> > > On Fri, Jun 28, 2024 at 7:38 PM James Houghton <jthoughton@xxxxxxxxxx> wrote:
> > > >
> > > > On Mon, Jun 17, 2024 at 11:37 AM Sean Christopherson <seanjc@xxxxxxxxxx> wrote:
> > > I still don't think we should get rid of the WAS_FAST stuff.
> >
> > I do :-)
> >
> > > The assumption that the L1 VM will almost never share pages between L2
> > > VMs is questionable. The real question becomes: do we care to have
> > > accurate age information for this case? I think so.
> >
> > I think you're conflating two different things.  WAS_FAST isn't about accuracy,
> > it's about supporting lookaround in conditionally fast secondary MMUs.
> >
> > Accuracy only comes into play when we're talking about the last-minute check,
> > which, IIUC, has nothing to do with WAS_FAST because any potential lookaround has
> > already been performed.
> 
> Sorry, I thought you meant: have the MMU notifier only ever be
> lockless (when tdp_mmu_enabled), and just return a potentially wrong
> result in the unlikely case that L1 is sharing pages between L2s.
> 
> I think it's totally fine to just drop WAS_FAST. So then we can either
> do look-around (1) always, or (2) only when there is a secondary MMU
> with has_fast_aging. (2) is pretty simple, I'll just do that.
> 
> We can add some shadow MMU lockless support later to make the
> look-around not as useless for the nested TDP case.

...

> > Adding the locking isn't actually all that difficult, with the *huge* caveat that
> > the below patch is compile-tested only.  The vast majority of the churn is to make
> > it so existing code ignores the new KVM_RMAP_LOCKED bit.
> 
> This is very interesting, thanks for laying out how this could be
> done. I don't want to hold this series up on getting the details of
> the shadow MMU lockless walk exactly right. :)

...

> 1. Drop the WAS_FAST complexity.
> 2. Add a function like mm_has_fast_aging_notifiers(), use that to
> determine if we should be doing look-around.

I would prefer a flag over a function.  Long-term, if my pseudo-lockless rmap
idea pans out, KVM can set the flag during VM creation.  Until then, KVM can set
the flag during creation and then toggle it in (un)account_shadowed().  Races
will be possible, but they should be extremely rare and quite benign, all things
considered.





[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux