Re: [PART2 PATCH v4 10/11] svm: Introduce AMD IOMMU avic_ga_log_notifier
From: Radim KrÄmÃÅ
Date: Thu Jul 14 2016 - 09:52:57 EST
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.