Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp849765imm; Fri, 29 Jun 2018 07:24:29 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKNzXH5g2SAgSS//TeYWryraxPriGwYrbK2kqe5Hho+LR054lXY7YWGKBHtAfnjbDLNMR7l X-Received: by 2002:a17:902:bf01:: with SMTP id bi1-v6mr15014049plb.43.1530282269396; Fri, 29 Jun 2018 07:24:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530282269; cv=none; d=google.com; s=arc-20160816; b=VYAS8lFtOINRv//SyL7J+0Zxngn2ENsGVRpH7UWsfP6mSY39szdlYRVr2X0iFuWmz3 il/p36Z/PzVxIGOLyAD3SY6CMPq85v58CoBEHtwkjpmhhnNWt8xyVxNBnmKxp31A4Nmk ZI11zEPS8RrrfRwdceoAod3hphMZF0UxOXO3Zew7d6rzSKdSP5o73Gma96RRvify6djE 27WHY5emBWioZs9pu88AhXuQDccVNlIaGXtIGrq11EGr3dP+FFaAudzFgwTCULZP3T5I IQuY0msoQs+Oy27c2UPTyebv162z5wqA7OwhlCAGTpV01AKEKFXyZa9ou03DkhJ69wjj xFPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from :arc-authentication-results; bh=XvAbN/Aw5LcUIMHwOxpOhxV6FzV3qAX+2KtMIe6UJcw=; b=o71mB1ow56Buv2j/nHbVvGnjbrvHdEysoShQ5vrFCOaA4ez/C2FMIhqTnZ+35fTw0F KOeHmCpGk1Qcc4bVVvlsI+PYY+oEuvEHL3Be4ej24pwp+Xlga2eYHEMpaJMvpodpPDoK 1LIm7zsfq7aQCFVlJr00Am1uA+oADKmUQlBO/MuosK1loI9wQjcTJdkZIgLApmKLt288 sDEc5GStdBr6vK0/9iJ4ul7pO/l18S/TKuwxO948GQu87XoUv0SarkhdBr3y3hGqmma7 HR/BpLRttvF/kUCoNF5t5cM51IwXnfSf/HBVUaI4fPMFm4O08YH/Uct7M/3NBOdIK+K+ YPZA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d19-v6si7630380pfm.226.2018.06.29.07.24.15; Fri, 29 Jun 2018 07:24:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936480AbeF2NKT (ORCPT + 99 others); Fri, 29 Jun 2018 09:10:19 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:58310 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933132AbeF2NKR (ORCPT ); Fri, 29 Jun 2018 09:10:17 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 38882818F037; Fri, 29 Jun 2018 13:10:17 +0000 (UTC) Received: from vitty.brq.redhat.com.redhat.com (unknown [10.43.2.155]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 46B2F21565E1; Fri, 29 Jun 2018 13:10:15 +0000 (UTC) From: Vitaly Kuznetsov To: Roman Kagan 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 Subject: Re: [PATCH v2 2/5] KVM: x86: hyperv: introduce vp_index_to_vcpu_idx mapping 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> Date: Fri, 29 Jun 2018 15:10:14 +0200 In-Reply-To: <20180629125216.GC15656@rkaganb.sw.ru> (Roman Kagan's message of "Fri, 29 Jun 2018 15:52:16 +0300") Message-ID: <87h8lld9hl.fsf@vitty.brq.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 29 Jun 2018 13:10:17 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 29 Jun 2018 13:10:17 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'vkuznets@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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