[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87a7rdd3ec.fsf@vitty.brq.redhat.com>
Date: Fri, 29 Jun 2018 17:21:47 +0200
From: Vitaly Kuznetsov <vkuznets@...hat.com>
To: Roman Kagan <rkagan@...tuozzo.com>
Cc: kvm@...r.kernel.org, x86@...nel.org,
Paolo Bonzini <pbonzini@...hat.com>,
Radim Krčmář <rkrcmar@...hat.com>,
"K. Y. Srinivasan" <kys@...rosoft.com>,
Haiyang Zhang <haiyangz@...rosoft.com>,
Stephen Hemminger <sthemmin@...rosoft.com>,
"Michael Kelley \(EOSG\)" <Michael.H.Kelley@...rosoft.com>,
Mohammed Gamal <mmorsy@...hat.com>,
Cathy Avery <cavery@...hat.com>,
Wanpeng Li <wanpeng.li@...mail.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 3/5] KVM: x86: hyperv: use get_vcpu_by_vpidx() in kvm_hv_flush_tlb()
Roman Kagan <rkagan@...tuozzo.com> writes:
> On Fri, Jun 29, 2018 at 04:14:53PM +0200, Vitaly Kuznetsov wrote:
>> VP_INDEX almost always matches VCPU id and get_vcpu_by_vpidx() is fast,
>> use it instead of traversing full vCPU list every time.
>>
>> To support the change switch kvm_make_vcpus_request_mask() to checking
>> vcpu_id instead of vcpu index,
>
> I'm afraid you can't do this: vcpu_id (== apic id) can be sparse, i.e.
> it's not very well suited for bitmaps and can exceed the max number of
> vcpus.
True. The bitmap should be of KVM_MAX_VCPU_ID size, not
KVM_MAX_VCPUS.
Unfortunately there's no convenient way to get VCPU idx from VCPU
id, kvm_vcpu_get_idx() just walks the whole list :-( I see two possible
options:
1) Add vcpu_idx fields to struct kvm_vcpu
2) Keep the change expecting masks of KVM_MAX_VCPU_ID in
kvm_make_vcpus_request_mask(). KVM_MAX_VCPU_ID is currently 1023 so our
bitmaps will be 16 longs long. Not sure if it's too much.
--
Vitaly
Powered by blists - more mailing lists