From: Roman Kagan Subject: Re: [PATCH v4 RESEND 3/5] KVM: x86: hyperv: use get_vcpu_by_vpidx() in kvm_hv_flush_tlb() Date: Tue, 25 Sep 2018 11:57:52 +0300 Message-ID: <20180925085752.GA5391@rkaganb.sw.ru> References: <20180822101832.31763-1-vkuznets@redhat.com> <20180822101832.31763-4-vkuznets@redhat.com> <8da03d2a-5405-f363-f081-e4bc46b106e3@redhat.com> <87r2hs7cco.fsf@vitty.brq.redhat.com> <87zhw62797.fsf@vitty.brq.redhat.com> <74055c3b-be66-4ce6-e727-a155f18a0ba1@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Vitaly Kuznetsov , kvm@vger.kernel.org, Radim =?utf-8?B?S3LEjW3DocWZ?= , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , "Michael Kelley (EOSG)" , Wanpeng Li , linux-kernel@vger.kernel.org To: Paolo Bonzini Return-path: Content-Disposition: inline In-Reply-To: <74055c3b-be66-4ce6-e727-a155f18a0ba1@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On Mon, Sep 24, 2018 at 06:55:28PM +0200, Paolo Bonzini wrote: > On 24/09/2018 18:24, Paolo Bonzini wrote: > > Hi Paolo, > > > > could you please clarify what needs to be done to get this merged? In > > particular, are you OK with my comment above or do we need to do > > something with it (e.g. get back to the 'logarythmic search' from v2)? > > > > In kvm/queue I can see only 'x86/hyper-v: rename ipi_arg_{ex,non_ex} > > structures' patch from this series applied. > > Hi, > > my plan was to apply only 1/2/5 for now. I singled out the rename patch > because that one could be included in 4.19-rc kernels as a cleanup. Is this supposed to mean you're not happy with the approach taken in Vitaly's patch? Can you explain why? I take my part of guilt for it so I'd like to know, too. 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.) 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. Neither of the above is quadratic. Dunno if we need to specifically consider intermediate situations. Anyway using a havier vp_index -> cpu index translation looks like an overkill to me. What do you think? Thanks, Roman.