Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1621709
| From | Paolo Bonzini <pbonzini@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH RFC 1/6] KVM: fix guest_mode optimization in kvm_make_all_cpus_request() |
| Date | 2017-04-12 02:20 +0200 |
| Message-ID | <tveaR-5IS-7@gated-at.bofh.it> (permalink) |
| References | <ttmcx-5J2-7@gated-at.bofh.it> <ttmcx-5J2-19@gated-at.bofh.it> <ttmPf-6c4-5@gated-at.bofh.it> <tv07U-50R-21@gated-at.bofh.it> <tvaTE-3ut-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
----- Original Message -----
> From: "Radim Krčmář" <rkrcmar@redhat.com>
> To: "Paolo Bonzini" <pbonzini@redhat.com>
> Cc: "James Hogan" <james.hogan@imgtec.com>, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, "Christoffer Dall"
> <cdall@linaro.org>, "Andrew Jones" <drjones@redhat.com>, "Marc Zyngier" <marc.zyngier@arm.com>, "Christian
> Borntraeger" <borntraeger@de.ibm.com>, "Cornelia Huck" <cornelia.huck@de.ibm.com>, "Paul Mackerras"
> <paulus@ozlabs.org>
> Sent: Wednesday, April 12, 2017 4:45:36 AM
> Subject: Re: [PATCH RFC 1/6] KVM: fix guest_mode optimization in kvm_make_all_cpus_request()
>
> > void kvm_reload_remote_mmus(struct kvm *kvm)
> > {
> > - kvm_make_all_cpus_request(kvm, KVM_REQ_MMU_RELOAD);
> > + /* FIXME, is wait=true really needed? */
>
> Probably not. There are two uses,
>
> in kvm_mmu_prepare_zap_page():
> The only change that happens between kvm_reload_remote_mmus() and
> kvm_flush_remote_tlbs() in kvm_mmu_commit_zap_page() is setting of
> sp->role.invalid -- synchronizing it doesn't prevent any race with
> READING_SHADOW_PAGE_TABLES mode and the unconditional TLB flush is the
> important one. I think that kvm_reload_remote_mmus doesn't even need
> to kick in this case.
>
> in kvm_mmu_invalidate_zap_all_pages():
> Same situation: the guest cannot do an entry without increasing the
> generation number, but can enter READING_SHADOW_PAGE_TABLES mode
> between reload and flush.
> I think that we don't need to call
>
> but my knowledge of this area is obviously lacking ...
Yes, you're right - I just was too lazy. :)
> > + kvm_make_all_cpus_request(kvm, KVM_REQ_MMU_RELOAD, true);
> > }
> >
> > int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id)
> >
> >
> > Other users do not need wait=false.
>
> You mean "wait=true"?
>
> (Would be safer to assume they depend on the VM exit wait until proved
> otherwise ...)
Yeah, I audited them.
> > - bit 9 = kick after making request
>
> Maybe add bit mask to denote in which modes the kick/wait is necessary?
>
> bit 9 : IN_GUEST_MODE
> bit 10 : EXITING_GUEST_MODE
> bit 11 : READING_SHADOW_PAGE_TABLES
>
> TLB_FLUSH would set bits 8-11. IIUC, ARM has use for requests that need
> to make sure that the guest is not in guest mode before proceeding and
> those would set bit 8-10.
No, checking vcpu->requests after setting IN_GUEST_MODE is done separately.
EXITING_GUEST_MODE's meaning *is* "no IPI needed".
> The common requests, "notice me as soon as possible", would set bit 9.
> The bits 9-11 could also be used only when bit 8 is set, to make the
> transition easier. (9 and 10 could be squished then as well.)
Maybe, depending on how the code looks like. But considering we have
to do the cmpxchg, I think the should_kick and should_wait logic should
be embedded in kvm_make_all_cpus_request (and later on, kvm_make_request).
Paolo
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: [PATCH RFC 1/6] KVM: fix guest_mode optimization in kvm_make_all_cpus_request() Paolo Bonzini <pbonzini@redhat.com> - 2017-04-11 11:20 +0200
Re: [PATCH RFC 1/6] KVM: fix guest_mode optimization in kvm_make_all_cpus_request() James Hogan <james.hogan@imgtec.com> - 2017-04-11 11:40 +0200
Re: [PATCH RFC 1/6] KVM: fix guest_mode optimization in kvm_make_all_cpus_request() Radim Krčmář <rkrcmar@redhat.com> - 2017-04-11 21:40 +0200
Re: [PATCH RFC 1/6] KVM: fix guest_mode optimization in kvm_make_all_cpus_request() Paolo Bonzini <pbonzini@redhat.com> - 2017-04-11 21:50 +0200
Re: [PATCH RFC 1/6] KVM: fix guest_mode optimization in kvm_make_all_cpus_request() Radim Krčmář <rkrcmar@redhat.com> - 2017-04-11 22:50 +0200
Re: [PATCH RFC 1/6] KVM: fix guest_mode optimization in kvm_make_all_cpus_request() Paolo Bonzini <pbonzini@redhat.com> - 2017-04-12 02:20 +0200
csiph-web