Re: [PATCH RFC 1/6] KVM: fix guest_mode optimization in kvm_make_all_cpus_request()

From: Paolo Bonzini
Date: Tue Apr 11 2017 - 15:45:48 EST




----- Original Message -----
> From: "Radim KrÄmÃÅ" <rkrcmar@xxxxxxxxxx>
> To: "James Hogan" <james.hogan@xxxxxxxxxx>
> Cc: "Paolo Bonzini" <pbonzini@xxxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx, kvm@xxxxxxxxxxxxxxx, "Christoffer Dall"
> <cdall@xxxxxxxxxx>, "Andrew Jones" <drjones@xxxxxxxxxx>, "Marc Zyngier" <marc.zyngier@xxxxxxx>, "Christian
> Borntraeger" <borntraeger@xxxxxxxxxx>, "Cornelia Huck" <cornelia.huck@xxxxxxxxxx>, "Paul Mackerras"
> <paulus@xxxxxxxxxx>
> Sent: Wednesday, April 12, 2017 3:31:24 AM
> Subject: Re: [PATCH RFC 1/6] KVM: fix guest_mode optimization in kvm_make_all_cpus_request()
>
> 2017-04-11 10:37+0100, James Hogan:
> > Hi Paolo,
> >
> > On Tue, Apr 11, 2017 at 01:25:04PM +0800, Paolo Bonzini wrote:
> >> On 07/04/2017 05:02, James Hogan wrote:
> >> > This presumably changes the behaviour on x86, from != OUTSIDE_GUEST_MODE
> >> > to == IN_GUEST_MODE. so:
> >> > - you'll no longer get IPIs if its in READING_SHADOW_PAGE_TABLES (which
> >> > MIPS also now uses when accessing mappings outside of guest mode and
> >> > depends upon to wait until the old mappings are no longer in use).
> >>
> >> This is wrong, the purpose of READING_SHADOW_PAGE_TABLES is
> >> "kvm_flush_remote_tlbs
> >> should send me an IPI, because I want to stop kvm_flush_remote_tlbs until
> >> I'm done
> >> reading the page tables".
> >
> > That sounds equivalent to what I meant for MIPS, i.e.
> > kvm_flush_remote_tlbs() does the waiting (not the thing accessing guest
> > mappings).

Yeah, I meant "it's wrong in Radim's patches". Not hard to fix though.

Thanks for the review!

Paolo

> I agree, thanks for noticing this. It would be a huge mistake to drop
> the synchronization.
>