Received: by 2002:a4a:301c:0:0:0:0:0 with SMTP id q28-v6csp782306oof; Tue, 25 Sep 2018 04:42:43 -0700 (PDT) X-Google-Smtp-Source: ACcGV62aIfkW1ETtpC9F1ZD7wMUA3PSURuwObluway76BPlxLa21MaDuUVaow3Xi80LIocXgl2Nm X-Received: by 2002:a17:902:6843:: with SMTP id f3-v6mr782300pln.27.1537875763623; Tue, 25 Sep 2018 04:42:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537875763; cv=none; d=google.com; s=arc-20160816; b=bs3z52rH44W/dqq03rU9aUgoGxrPTxbpg+JkXTL/GWIbWTz+5dfOAxfkrNOmiM3m+I awZJCzojc3PyqgZKEGE6l/Ob7KttmAPe0cS1Sp1xTDXdYLan6s6Rz1AABsouHMC2TSrm DKV2yhYfLkgnbWtpPOf2BRtIUzjoW8NflWoMQYfW8MaMNGHl8bn/96pvW/qZRXC7MsOO 381LRyrRjQi6HB0lAxxtAg2yUekTO/iZfA8mGIM5CbIpz3TSObYM0eCT2lTaFkCpzVg6 Irls6RVqOhugcA/WW13/oekdd0IFYzoWDN8CgA1Ee2wYuCX+aN4T4Ga33W61s2M69M0p otIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=2fKfLjPYOVxeEPWXwPHXHHSb9RXobm7XezZmCMB7ydw=; b=jdnYYGgkvKSHLrSsWMOAw1W9byzo5SzaO+451hSsSx5Voa9KcTXSwObwTHbOKYpnes MNY9Z8J9SHdSOmO7nlM3LAwClTf95AZuLmkUNZlqWfn3d+2kH4x5R5Wdcp4CF00+LfNd 6Qc48mgi24/iN14jvOkCUWSSp3OtUYc+opGhS6OH3sx1kMsqyd1DeKKhMTwGoaVQJ/O0 NX2kd8mEGNKLfTMJx0qOltqGJrcnX+XCgzLLoyMKf9jEB9uEXhO1SQCXtdKAuVZurvd6 0kk7jJp+qh9aglwEf0WeMFEwbZaiQjFlyjLIp5nL8hy07oFqkwjf0A+WIGPVuNb4nVXE 36vw== 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 s18-v6si2062878pgv.85.2018.09.25.04.42.27; Tue, 25 Sep 2018 04:42:43 -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 S1728115AbeIYRta (ORCPT + 99 others); Tue, 25 Sep 2018 13:49:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36898 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727159AbeIYRta (ORCPT ); Tue, 25 Sep 2018 13:49:30 -0400 Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A5B2A83F46; Tue, 25 Sep 2018 11:42:21 +0000 (UTC) Received: from vitty.brq.redhat.com.redhat.com (unknown [10.43.2.217]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A036B3001930; Tue, 25 Sep 2018 11:42:19 +0000 (UTC) From: Vitaly Kuznetsov To: Roman Kagan , Paolo Bonzini Cc: 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 Subject: Re: [PATCH v4 RESEND 3/5] KVM: x86: hyperv: use get_vcpu_by_vpidx() in kvm_hv_flush_tlb() In-Reply-To: <20180925101040.GA2336@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> <20180925085752.GA5391@rkaganb.sw.ru> <20180925101040.GA2336@rkaganb.sw.ru> Date: Tue, 25 Sep 2018 13:42:18 +0200 Message-ID: <871s9hreg5.fsf@vitty.brq.redhat.com> MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 25 Sep 2018 11:42:21 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Roman Kagan writes: > On Tue, Sep 25, 2018 at 11:29:57AM +0200, Paolo Bonzini wrote: >> On 25/09/2018 10:57, Roman Kagan wrote: >> > 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. > > Makes sense to me. Thanks guys, I'll try to draft something up for v6. -- Vitaly