lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Mon, 6 Jun 2022 16:11:59 -0700
From:   Ben Gardon <bgardon@...gle.com>
To:     Paolo Bonzini <pbonzini@...hat.com>
Cc:     Peter Xu <peterx@...hat.com>, kvm <kvm@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Sean Christopherson <seanjc@...gle.com>,
        David Matlack <dmatlack@...gle.com>,
        Jim Mattson <jmattson@...gle.com>,
        David Dunn <daviddunn@...gle.com>,
        Jing Zhang <jingzhangos@...gle.com>,
        Junaid Shahid <junaids@...gle.com>
Subject: Re: [PATCH] KVM: x86/MMU: Zap non-leaf SPTEs when disabling dirty logging

On Thu, May 26, 2022 at 9:00 AM Ben Gardon <bgardon@...gle.com> wrote:
>
> On Thu, May 26, 2022 at 8:52 AM Paolo Bonzini <pbonzini@...hat.com> wrote:
> >
> > On 5/26/22 16:30, Peter Xu wrote:
> > > On Thu, May 26, 2022 at 02:01:43PM +0200, Paolo Bonzini wrote:
> > >> On 5/26/22 01:09, Ben Gardon wrote:
> > >>> +           WARN_ON(max_mapping_level < iter.level);
> > >>> +
> > >>> +           /*
> > >>> +            * If this page is already mapped at the highest
> > >>> +            * viable level, there's nothing more to do.
> > >>> +            */
> > >>> +           if (max_mapping_level == iter.level)
> > >>> +                   continue;
> > >>> +
> > >>> +           /*
> > >>> +            * The page can be remapped at a higher level, so step
> > >>> +            * up to zap the parent SPTE.
> > >>> +            */
> > >>> +           while (max_mapping_level > iter.level)
> > >>> +                   tdp_iter_step_up(&iter);
> > >>> +
> > >>>             /* Note, a successful atomic zap also does a remote TLB flush. */
> > >>> -           if (tdp_mmu_zap_spte_atomic(kvm, &iter))
> > >>> -                   goto retry;
> > >>> +           tdp_mmu_zap_spte_atomic(kvm, &iter);
> > >>> +
> > >>
> > >> Can you make this a sparate function (for example
> > >> tdp_mmu_zap_collapsible_spte_atomic)?  Otherwise looks great!
> > >
> > > There could be a tiny downside of using a helper in that it'll hide the
> > > step-up of the iterator, which might not be as obvious as keeping it in the
> > > loop?
> >
> > That's true, my reasoning is that zapping at a higher level can only be
> > done by first moving the iterator up.  Maybe
> > tdp_mmu_zap_at_level_atomic() is a better Though, I can very well apply
> > this patch as is.
>
> I'd be inclined to apply the patch as-is for a couple reasons:
> 1. As Peter said, hiding the step up could be confusing.
> 2. If we want to try the in-place promotion, we'll have to dismantle
> that helper again anyway or else have a bunch of duplicate code.

Circling back on this, Paolo would you like me to send another version
of this patch, or do you think it's good to go?

>
> >
> > Paolo
> >

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ