On 02/09/2015 21:01, Sebastian Schütte wrote: > I inserted some printk() lines into init_vmcb() around the call of > svm_set_guest_pat() to print out the g_pat value as well as > svm->vcpu.vcpu_id and noticed that something was off: > > Initially, the PATs of all VCPUs are set to 0x0606060606060606. > However, after attaching some devices (vfio-pci enabling device and > vfio_ecap_init lines are being printed) init_vmcb() is only called > again for vcpu_id > 0. Unless g_pat is changed somewhere else, VCPU > #0 remains set to 0x0606060606060606 (according to comments in > svm_set_guest_pat() this is bad for assigned devices) while all other > VCPUs use 0x0007040600070406. > > I'd guess that could explain the slowdown. > Hi, sorry for the delay. If you change KVM like this diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 27f57fc05bc7..3ce878c5fde8 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -1155,10 +1155,7 @@ static void svm_set_guest_pat(struct vcpu_svm *svm, u64 *g_pat) * have assigned devices, however, we cannot force WB for RAM * pages only, so use the guest PAT directly. */ - if (!kvm_arch_has_assigned_device(vcpu->kvm)) - *g_pat = 0x0606060606060606; - else - *g_pat = vcpu->arch.pat; + *g_pat = vcpu->arch.pat; } static u64 svm_get_mt_mask(struct kvm_vcpu *vcpu, gfn_t gfn, bool is_mmio) (obviously not a valid patch for upstream patch, but good enough for testing) do you get normal speed? Paolo -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html