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]
Message-ID: <CAOLK0pzrzydk9rk-Jijh=rA0oLkSafEqmumY2NSxe44J2=zv2A@mail.gmail.com>
Date:   Mon, 15 Oct 2018 21:08:32 +0800
From:   Tianyu Lan <lantianyu1986@...il.com>
To:     Paolo Bonzini <pbonzini@...hat.com>
Cc:     Tianyu Lan <Tianyu.Lan@...rosoft.com>, kys@...rosoft.com,
        haiyangz@...rosoft.com, sthemmin@...rosoft.com,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>,
        "H. Peter Anvin" <hpa@...or.com>,
        "the arch/x86 maintainers" <x86@...nel.org>,
        Radim Krcmar <rkrcmar@...hat.com>,
        devel@...uxdriverproject.org,
        "linux-kernel@...r kernel org" <linux-kernel@...r.kernel.org>,
        kvm <kvm@...r.kernel.org>, michael.h.kelley@...rosoft.com,
        vkuznets@...hat.com
Subject: Re: [PATCH V4 7/15] KVM/MMU: Flush tlb directly in the kvm_zap_gfn_range()

Hi Paolo:
              Thanks for your review.

On Mon, Oct 15, 2018 at 6:04 PM Paolo Bonzini <pbonzini@...hat.com> wrote:
>
> On 13/10/2018 16:53, lantianyu1986@...il.com wrote:
> > +     bool flush = false;
> >       int i;
> >
> >       spin_lock(&kvm->mmu_lock);
> > @@ -5654,18 +5655,27 @@ void kvm_zap_gfn_range(struct kvm *kvm, gfn_t gfn_start, gfn_t gfn_end)
> >               slots = __kvm_memslots(kvm, i);
> >               kvm_for_each_memslot(memslot, slots) {
> >                       gfn_t start, end;
> > +                     bool flush_tlb = true;
> >
> >                       start = max(gfn_start, memslot->base_gfn);
> >                       end = min(gfn_end, memslot->base_gfn + memslot->npages);
> >                       if (start >= end)
> >                               continue;
> >
> > -                     slot_handle_level_range(kvm, memslot, kvm_zap_rmapp,
> > -                                             PT_PAGE_TABLE_LEVEL, PT_MAX_HUGEPAGE_LEVEL,
> > -                                             start, end - 1, true);
> > +                     if (kvm_available_flush_tlb_with_range())
> > +                             flush_tlb = false;
>
> This should be moved outside the for, because it's invariant.
>
> > +                     flush = slot_handle_level_range(kvm, memslot,
> > +                                     kvm_zap_rmapp, PT_PAGE_TABLE_LEVEL,
> > +                                     PT_MAX_HUGEPAGE_LEVEL, start,
> > +                                     end - 1, flush_tlb);
>
> ... and this should be "flush |= ".
> >               }
> >       }
> >
> > +     if (flush && kvm_available_flush_tlb_with_range())
> > +             kvm_flush_remote_tlbs_with_address(kvm, gfn_start,
> > +                             gfn_end - gfn_start + 1);
> > +
>
> ... and this can be just if (flush), because if flush_tlb is true then
> slot_handle_level_range always returns false.

OK. Will update.

-- 
Best regards
Tianyu Lan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ