From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vitaly Kuznetsov Subject: Re: [PATCH v2 2/5] KVM: x86: hyperv: introduce vp_index_to_vcpu_idx mapping Date: Fri, 29 Jun 2018 15:10:14 +0200 Message-ID: <87h8lld9hl.fsf@vitty.brq.redhat.com> References: <20180628135313.17468-1-vkuznets@redhat.com> <20180628135313.17468-3-vkuznets@redhat.com> <20180629101134.GA15656@rkaganb.sw.ru> <87y3exdh2o.fsf@vitty.brq.redhat.com> <20180629111227.GB15656@rkaganb.sw.ru> <87tvplddrr.fsf@vitty.brq.redhat.com> <20180629125216.GC15656@rkaganb.sw.ru> Mime-Version: 1.0 Content-Type: text/plain Cc: kvm@vger.kernel.org, x86@kernel.org, Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , "Michael Kelley \(EOSG\)" , Mohammed Gamal , Cathy Avery , Wanpeng Li , linux-kernel@vger.kernel.org To: Roman Kagan Return-path: In-Reply-To: <20180629125216.GC15656@rkaganb.sw.ru> (Roman Kagan's message of "Fri, 29 Jun 2018 15:52:16 +0300") Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org Roman Kagan writes: > On Fri, Jun 29, 2018 at 01:37:44PM +0200, Vitaly Kuznetsov wrote: >> The problem we're trying to solve here is: with PV TLB flush and IPI we >> need to walk through the supplied list of VP_INDEXes and get VCPU >> ids. Usually they match. But in case they don't [...] > > Why wouldn't they *in practice*? Only if the userspace wanted to be > funny and assigned VP_INDEXes randomly? I'm not sure we need to > optimize for this case. Can someone please remind me why we allow userspace to change it in the first place? > > Note that the userspace can actually do nasty things with these > VP_INDEXes, like, say, have them non-unique. We need to be resilent to > it, but don't need to optimize for it. > > I think I'd rather have a warning in kvm_hv_set_msr if the VP_INDEX > being assigned is not equal to the vcpu index, and start worrying about > optimization only if this warning starts being triggered by real > hypervisor applications. > > Anyway I don't see an urgent need to bloat this patchset with optimizing > this translation; it can be done separately, if needed. Sure, I can use get_vcpu_by_vpidx() in the patchset pretending that is's always fast and if we find a valid case where it is not - we'll just optimize it later. Sounds sane to me. -- Vitaly