On 28/06/2018 17:00, Sean Christopherson wrote: > On Wed, Jun 27, 2018 at 02:59:12PM -0700, Junaid Shahid wrote: >> Remove the implicit flush from the set_cr3 handlers, so that the >> callers are able to decide whether to flush the TLB or not. >> >> Signed-off-by: Junaid Shahid <junaids@xxxxxxxxxx> >> --- >> arch/x86/kvm/mmu.c | 2 ++ >> arch/x86/kvm/mmu.h | 1 - >> arch/x86/kvm/svm.c | 4 ---- >> arch/x86/kvm/vmx.c | 1 - >> 4 files changed, 2 insertions(+), 6 deletions(-) >> >> diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c >> index 9b73cfcef917..d3a04cf6514b 100644 >> --- a/arch/x86/kvm/mmu.c >> +++ b/arch/x86/kvm/mmu.c >> @@ -4070,6 +4070,7 @@ static bool fast_cr3_switch(struct kvm_vcpu *vcpu, gpa_t new_cr3, >> >> kvm_make_request(KVM_REQ_LOAD_CR3, vcpu); >> kvm_make_request(KVM_REQ_MMU_SYNC, vcpu); >> + kvm_x86_ops->tlb_flush(vcpu, true); > Paolo, can you weigh in on whether or not its ok to use > kvm_make_request(KVM_REQ_TLB_FLUSH, vcpu) here instead of directly > calling tlb_flush()? Making a request seems more appropriate but > Junaid was concerned that doing so would inflate vcpu->stat.tlb_flush. > For comparison, vmx_set_cr3 indeed doesn't increment the TLB flush count. I think I agree with Junaid. There are several other direct kvm_x86_ops-> calls in mmu.c, so I'll apply the patch as is. Paolo