> The VMX APIC flush could be deferred by hoisting KVM_REQ_APIC_PAGE_RELOAD > up. I think that's safe? But it's a very infrequent operation so I'm not > exactly chomping at the bit to get it fixed. Could moving KVM_REQ_TLB_FLUSH and _CURRENT down also work? It seems that none of the check_request() calls below depend on them. > Given that you see 0 on SVM and a low number on VMX, my money is on the > difference being that VMX accounts the TLB flush that occurs on vCPU > migration. vmx_vcpu_load_vmcs() makes a KVM_REQ_TLB_FLUSH request, whereas > svm_vcpu_load() resets asid_generation but doesn't increment the stats. I'll try adding a one-off stat increment here, and check the results. > I think a better option is to keep the current accounting, defer flushes > when possible to naturally fix accounting, and then fix the remaining one > off cases, e.g. kvm_mmu_load() and svm_vcpu_load(). > > I can prep a small series unless you want the honors? I'll try making a small series: kvm: selftests: add get_debugfs_stat to kvm_util kvm: x86: increment tlb_flush stat on svm_vcpu_load(), kvm_mmu_load() # omit kvm_mmu_load() if feasible to move check_request(KVM_REQ_TLB_FLUSH) down kvm: x86: re-order check_request() to prefer use of deferred tlb_flush Thanks for the explanations! Sorry for my late reply, I've updated my email filter accordingly.