[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f8cd3988-ea7e-0e4a-ee95-927534276f84@redhat.com>
Date: Tue, 25 Sep 2018 11:29:57 +0200
From: Paolo Bonzini <pbonzini@...hat.com>
To: Roman Kagan <rkagan@...tuozzo.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>, kvm@...r.kernel.org,
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>,
Wanpeng Li <wanpeng.li@...mail.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 RESEND 3/5] KVM: x86: hyperv: use get_vcpu_by_vpidx()
in kvm_hv_flush_tlb()
On 25/09/2018 10:57, Roman Kagan wrote:
> Speaking of the options we have, the choice depends on the assumptions
> we take. (And I guess when you spoke of quadratic complexity you
> referred to the algorithm to convert the vp_index mask into the KVM cpu
> mask.)
Right; with Vitaly's patch, if you have a random mapping between
vp_index and cpu index, each loop requires a list walk, and so you have
O(#VMcpus * #IPIcpus) worst case for sending an IPI to #IPIcpus CPUs in
a guest with #VMcpus.
> If we can assume that in all relevant cases vp_index coincides with the
> cpu index (which I think we can) then Vitaly's approach is the most
> efficient.
>
> If, on the opposite, we want to optimize for random mapping between
> vp_index and cpu index, then it's probably better instead to iterate
> over vcpus and test if their vp_index belongs to the requested mask.
Yes, that would work too. Perhaps we can do both? You can have a
kvm->num_mismatched_vp_indexes count to choose between the two.
Paolo
> Neither of the above is quadratic.
> Dunno if we need to specifically consider intermediate situations.
Powered by blists - more mailing lists