From mboxrd@z Thu Jan 1 00:00:00 1970 From: Radim =?utf-8?B?S3LEjW3DocWZ?= Subject: Re: [PART2 PATCH v4 10/11] svm: Introduce AMD IOMMU avic_ga_log_notifier Date: Thu, 14 Jul 2016 15:52:47 +0200 Message-ID: <20160714135247.GB20689@potion> References: <1468416032-7692-1-git-send-email-suravee.suthikulpanit@amd.com> <1468416032-7692-11-git-send-email-suravee.suthikulpanit@amd.com> <20160713142953.GA13201@potion> <57875ED3.9090307@amd.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: joro@8bytes.org, pbonzini@redhat.com, alex.williamson@redhat.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, sherry.hurwitz@amd.com To: Suravee Suthikulpanit Return-path: Content-Disposition: inline In-Reply-To: <57875ED3.9090307@amd.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org 2016-07-14 16:43+0700, Suravee Suthikulpanit: > On 7/13/16 21:29, Radim Kr=C4=8Dm=C3=A1=C5=99 wrote: >> 2016-07-13 08:20-0500, Suravee Suthikulpanit: >> > >diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c >> > >+ hash_for_each_possible(svm_vm_data_hash, ka, hnode, vm_id) { >> > >+ struct kvm *kvm =3D container_of(ka, struct kvm, arch); >> > >+ >> > >+ vcpu =3D kvm_get_vcpu_by_id(kvm, vcpu_id); >> The first result is not neccessarily the correct one. >>=20 >> With more than active 256 VMs, there is a guaranteed collision that >> cannot be disambiguated, so VCPUs in both VMs need to be woken up. >>=20 >> Having a 24 bit vm_id and checking that >> kvm->*.avic_id & 0xfffff =3D=3D vm_id >> would help a bit to avoid useless wakeups, but the collision cannot = be >> avoided. >=20 > True. What if SVM guarantee that the VM_ID won't conflict b/w any two= active > VMs? It is a nice way to avoid the bug you found in amd_iommu_update_ga() an= d we would send only one wakeup here as well, so it sound like the best solution.