From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751296AbcGNNwy (ORCPT ); Thu, 14 Jul 2016 09:52:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56288 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751175AbcGNNww (ORCPT ); Thu, 14 Jul 2016 09:52:52 -0400 Date: Thu, 14 Jul 2016 15:52:47 +0200 From: Radim =?utf-8?B?S3LEjW3DocWZ?= To: Suravee Suthikulpanit Cc: joro@8bytes.org, pbonzini@redhat.com, alex.williamson@redhat.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, sherry.hurwitz@amd.com Subject: Re: [PART2 PATCH v4 10/11] svm: Introduce AMD IOMMU avic_ga_log_notifier 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-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <57875ED3.9090307@amd.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 14 Jul 2016 13:52:51 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2016-07-14 16:43+0700, Suravee Suthikulpanit: > On 7/13/16 21:29, Radim Krčmář 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 = container_of(ka, struct kvm, arch); >> > >+ >> > >+ vcpu = kvm_get_vcpu_by_id(kvm, vcpu_id); >> The first result is not neccessarily the correct one. >> >> 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. >> >> Having a 24 bit vm_id and checking that >> kvm->*.avic_id & 0xfffff == vm_id >> would help a bit to avoid useless wakeups, but the collision cannot be >> avoided. > > 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() and we would send only one wakeup here as well, so it sound like the best solution.