Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1009690imm; Fri, 29 Jun 2018 09:51:11 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdSmxhWTGVZ/r5BE6x9ibJDEKcQjdwK7JZpQqx+ybwVsEUDNXjiY5y5g3ySuU5HV4ByAmNf X-Received: by 2002:a62:9385:: with SMTP id r5-v6mr15232774pfk.59.1530291071303; Fri, 29 Jun 2018 09:51:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530291071; cv=none; d=google.com; s=arc-20160816; b=ondJ3Msi5YxI5RjfIPqMZqLFyUOb8ieHhmd8ufRnvacQ5LYH2aEYzuaCwd1afaa0/W aKfBwtmSvScPdBrdjfMfGp5EiKGXRfspnUq6o4UJ9soYCk/7vcpt1EueGIUgvKGrmeNY hcLNXI+ah6A98HO96uUWc64XDmqgm9MdBrtYYjgrrLc4PybafqHEsTMdYFuPktxKXk+O ifUSSeDhy62UCLGMqI0m1TBB1xeUS0mGs5g70vygZfArKd2seSzZZ0hK8JwkzullnTTa +ItlouGzg90Sg9DCzOwheYA6K3qlyj/DSg7ebvVjKnkn8doFq5Y3mRJSnusUQlBZf22A hNqw== 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=0wdl+MWtw1Bjzr89ZyAl/7B01wZoAcqqktGmTl2rdz0=; b=eiMBqedRDnPclOOllxwECneWrIXHrtK0KwpWeCNf9ObmPIZtuCugaFfqVuS5MYSUCu j7Hua69cVRNMqiqPFo5TKPCFLZr4IXVwFQm9uB/lhF0XNBbwVssuFb/8wfHHZd4x6WFg KOeNFepzhiQ+s7OUYzCZVdjC93whebdgjIwMz9qTJqfYBe6VQgk9bLORopkLQsYqO0i4 LzdK6PzVWrHLHsyyqmRcwrs29Tr45vINvzsWKqhQO8+mGzKv9T2zJsmryp5/AYvgVTbS hsLpy2u7kCCyCYmmsJE2+QlNNGEcNBmJjqolC189gxqtn9ffV0c8i1R07BoSyG4K75BI cqCA== 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 k2-v6si1411644pfh.252.2018.06.29.09.50.55; Fri, 29 Jun 2018 09:51:11 -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 S936568AbeF2PVw (ORCPT + 99 others); Fri, 29 Jun 2018 11:21:52 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:58964 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S936176AbeF2PVv (ORCPT ); Fri, 29 Jun 2018 11:21:51 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9087B40201C7; Fri, 29 Jun 2018 15:21:50 +0000 (UTC) Received: from vitty.brq.redhat.com.redhat.com (unknown [10.43.2.155]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A7DA776EA; Fri, 29 Jun 2018 15:21:48 +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 v3 3/5] KVM: x86: hyperv: use get_vcpu_by_vpidx() in kvm_hv_flush_tlb() References: <20180629141455.19525-1-vkuznets@redhat.com> <20180629141455.19525-4-vkuznets@redhat.com> <20180629150104.GE15656@rkaganb.sw.ru> Date: Fri, 29 Jun 2018 17:21:47 +0200 In-Reply-To: <20180629150104.GE15656@rkaganb.sw.ru> (Roman Kagan's message of "Fri, 29 Jun 2018 18:01:05 +0300") Message-ID: <87a7rdd3ec.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.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 29 Jun 2018 15:21:50 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 29 Jun 2018 15:21:50 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.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 04:14:53PM +0200, 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. >> >> To support the change switch kvm_make_vcpus_request_mask() to checking >> vcpu_id instead of vcpu index, > > I'm afraid you can't do this: vcpu_id (== apic id) can be sparse, i.e. > it's not very well suited for bitmaps and can exceed the max number of > vcpus. True. The bitmap should be of KVM_MAX_VCPU_ID size, not KVM_MAX_VCPUS. Unfortunately there's no convenient way to get VCPU idx from VCPU id, kvm_vcpu_get_idx() just walks the whole list :-( I see two possible options: 1) Add vcpu_idx fields to struct kvm_vcpu 2) Keep the change expecting masks of KVM_MAX_VCPU_ID in kvm_make_vcpus_request_mask(). KVM_MAX_VCPU_ID is currently 1023 so our bitmaps will be 16 longs long. Not sure if it's too much. -- Vitaly