Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3702747imm; Mon, 17 Sep 2018 01:33:30 -0700 (PDT) X-Google-Smtp-Source: ANB0VdY7flAE+hpDEIaXT/Cc6Tu3gxuW3CDRtYEL28aJOiGwUSvym+AJT0GKF9/Ptk60Ujj/PiZd X-Received: by 2002:a17:902:7e09:: with SMTP id b9-v6mr23533577plm.221.1537173210894; Mon, 17 Sep 2018 01:33:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537173210; cv=none; d=google.com; s=arc-20160816; b=SrtkzDOL2hV/flYZJfhOlshuvT6X1tVHCZCpbwpauHN5EniyN2KuRhzw05EQ5BtnmZ xkR6MoJxFpy68S6vvSsW0aw5u0yAwmIt9uh1lFqVd5XDSg3+qxv2quM2/M/y1kBOWDxW /uvSObz+e8XqyS4fjgq60Ae5lYy4fZ2kxX0CKFpfaHm7KC9jKh4MAdE2PodDKkIYoiG/ 8ONrXQLVNBBY0FITVSe/fyaHZ+YY2UEoTqo6bj54HDTd9hfmBCCm0W1kbpchQkvd8Z3F s6bRCSFfa1GgFK8CVzFQwJqJTueYtz2RipVIVXNkrRF1fescB5z08Kon3kuZWZcDTMVq HwYg== 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; bh=yQn/GSM7bJMbLIdCIvMeZJOcg3xZsg0rpxd1aPoPfUs=; b=eHSgyP9W+CBsCzaiWogV8BWgMBiO3qtCQW+Wm8t4mVU3n2O48vTI4yv4xPA3mbx490 8CkSc50XAz/FnSpxi7eF/4nZ0GD14UhvxQjcppM3oHMZL88qHDIEtN2sJn80NBZPWZ4v 9hdLOwe10FmD1OcEkjgsgkD2SSkanJvG7OVyNg8iaNZfRMCuJBQjoUEoaSuHgM4YkT44 VQzy9/lN0eoMecTFL7WCnXy3+bmGjF+9OW+bw8gOhYTCzZv2fEKS/wsTGYdKmrC9tpIY ogemK1HtVRNr38yiFFqrwcXt6tCyGs7tuLDABAlMMRsiNQpnpllSUfYI+n/9Suo2eBLF VTOw== 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 f16-v6si14494276pgd.257.2018.09.17.01.33.14; Mon, 17 Sep 2018 01:33:30 -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 S1728187AbeIQN7V (ORCPT + 99 others); Mon, 17 Sep 2018 09:59:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47082 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727329AbeIQN7V (ORCPT ); Mon, 17 Sep 2018 09:59:21 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 407C8C0587DF; Mon, 17 Sep 2018 08:32:59 +0000 (UTC) Received: from vitty.brq.redhat.com.redhat.com (unknown [10.43.2.155]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 33408308BDA0; Mon, 17 Sep 2018 08:32:57 +0000 (UTC) From: Vitaly Kuznetsov To: Paolo Bonzini Cc: kvm@vger.kernel.org, Radim =?utf-8?B?S3LEjW3DocWZ?= , Roman Kagan , "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() References: <20180822101832.31763-1-vkuznets@redhat.com> <20180822101832.31763-4-vkuznets@redhat.com> <8da03d2a-5405-f363-f081-e4bc46b106e3@redhat.com> Date: Mon, 17 Sep 2018 10:32:55 +0200 In-Reply-To: <8da03d2a-5405-f363-f081-e4bc46b106e3@redhat.com> (Paolo Bonzini's message of "Fri, 14 Sep 2018 19:33:34 +0200") Message-ID: <87r2hs7cco.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.84 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 17 Sep 2018 08:32:59 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Paolo Bonzini writes: > On 22/08/2018 12:18, Vitaly Kuznetsov wrote: >> VP_INDEX almost always matches VCPU id and get_vcpu_by_vpidx() is fast, >> use it instead of traversing full vCPU list every time. > > ... but if it doesn't, the algorithm is now quadratic, isn't i? Yes, I even had an implementation with a logarythmic search back in v2 but we had a discussion with Roman and he convinced me this is an overkill and not currently required. It seems that with Qemu this is true indeed, vp_index always matches vcpu is but in case some other userspace decides to break this unwritten rule users may experience significant slowdown. -- Vitaly