All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: Roman Kagan <rkagan@virtuozzo.com>
Cc: kvm@vger.kernel.org, x86@kernel.org,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	"K. Y. Srinivasan" <kys@microsoft.com>,
	"Haiyang Zhang" <haiyangz@microsoft.com>,
	"Stephen Hemminger" <sthemmin@microsoft.com>,
	"Michael Kelley (EOSG)" <Michael.H.Kelley@microsoft.com>,
	"Mohammed Gamal" <mmorsy@redhat.com>,
	"Cathy Avery" <cavery@redhat.com>,
	"Wanpeng Li" <wanpeng.li@hotmail.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 3/5] KVM: x86: hyperv: use get_vcpu_by_vpidx() in kvm_hv_flush_tlb()
Date: Fri, 29 Jun 2018 17:21:47 +0200	[thread overview]
Message-ID: <87a7rdd3ec.fsf@vitty.brq.redhat.com> (raw)
In-Reply-To: <20180629150104.GE15656@rkaganb.sw.ru> (Roman Kagan's message of "Fri, 29 Jun 2018 18:01:05 +0300")

Roman Kagan <rkagan@virtuozzo.com> 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

  reply	other threads:[~2018-06-29 15:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-29 14:14 [PATCH v3 0/5] KVM: x86: hyperv: PV IPI support for Windows guests Vitaly Kuznetsov
2018-06-29 14:14 ` [PATCH v3 1/5] KVM: x86: hyperv: enforce vp_index < KVM_MAX_VCPUS Vitaly Kuznetsov
2018-06-29 14:14 ` [PATCH v3 2/5] KVM: x86: hyperv: optimize 'all cpus' case in kvm_hv_flush_tlb() Vitaly Kuznetsov
2018-06-29 14:14 ` [PATCH v3 3/5] KVM: x86: hyperv: use get_vcpu_by_vpidx() " Vitaly Kuznetsov
2018-06-29 15:01   ` Roman Kagan
2018-06-29 15:21     ` Vitaly Kuznetsov [this message]
2018-06-29 16:26       ` Roman Kagan
2018-06-29 16:47         ` Vitaly Kuznetsov
2018-06-29 16:53         ` Roman Kagan
2018-06-29 14:14 ` [PATCH v3 4/5] x86/hyper-v: rename ipi_arg_{ex,non_ex} structures Vitaly Kuznetsov
2018-06-29 14:14 ` [PATCH v3 5/5] KVM: x86: hyperv: implement PV IPI send hypercalls Vitaly Kuznetsov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a7rdd3ec.fsf@vitty.brq.redhat.com \
    --to=vkuznets@redhat.com \
    --cc=Michael.H.Kelley@microsoft.com \
    --cc=cavery@redhat.com \
    --cc=haiyangz@microsoft.com \
    --cc=kvm@vger.kernel.org \
    --cc=kys@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmorsy@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=rkagan@virtuozzo.com \
    --cc=rkrcmar@redhat.com \
    --cc=sthemmin@microsoft.com \
    --cc=wanpeng.li@hotmail.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.