From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [Bug 103321] New: NPT page attribute support causes extreme slowdown Date: Tue, 15 Sep 2015 18:32:51 +0200 Message-ID: <55F84833.90003@redhat.com> References: <55D90002.10703@redhat.com> <55DA16BB.4020004@ewetel.net> <55DA8054.7080900@redhat.com> <55E74785.2060701@ewetel.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE To: =?UTF-8?Q?Sebastian_Sch=c3=bctte?= , KVM list Return-path: Received: from mx1.redhat.com ([209.132.183.28]:49879 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751745AbbIOQcz (ORCPT ); Tue, 15 Sep 2015 12:32:55 -0400 In-Reply-To: <55E74785.2060701@ewetel.net> Sender: kvm-owner@vger.kernel.org List-ID: On 02/09/2015 21:01, Sebastian Sch=C3=BCtte 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: >=20 > 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. >=20 > I'd guess that could explain the slowdown. >=20 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 *s= vm, 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 =3D 0x0606060606060606; - else - *g_pat =3D vcpu->arch.pat; + *g_pat =3D vcpu->arch.pat; } =20 static u64 svm_get_mt_mask(struct kvm_vcpu *vcpu, gfn_t gfn, bool is_m= mio) (obviously not a valid patch for upstream patch, but good enough for testing) do you get normal speed? Paolo