From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: Wanpeng Li <kernellwp@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kvm <kvm@vger.kernel.org>,
Paolo Bonzini <pbonzini@redhat.com>,
Sean Christopherson <sean.j.christopherson@intel.com>,
Wanpeng Li <wanpengli@tencent.com>,
Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Subject: Re: [PATCH] KVM: Pre-allocate 1 cpumask variable per cpu for both pv tlb and pv ipis
Date: Tue, 04 Feb 2020 15:36:53 +0100 [thread overview]
Message-ID: <874kw6o1ve.fsf@vitty.brq.redhat.com> (raw)
In-Reply-To: <CANRm+CzkN9oYf4UqWYp2SHFii02=pvVLbW4oNkLmPan7ZroDZA@mail.gmail.com>
Wanpeng Li <kernellwp@gmail.com> writes:
>>
>> Honestly, I'd simplify the check in kvm_alloc_cpumask() as
>>
>> if (!kvm_para_available())
>> return;
>>
>> and allocated masks for all other cases.
>
> This will waste the memory if pv tlb and pv ipis are not exposed which
> are the only users currently.
>
My assumption is that the number of cases where we a) expose KVM b)
don't expose IPIs and PV-TLB and c) care about 1 cpumask per cpu is
relatively low. Ok, let's at least have a function for
if (kvm_para_has_feature(KVM_FEATURE_PV_TLB_FLUSH) &&
!kvm_para_has_hint(KVM_HINTS_REALTIME) &&
kvm_para_has_feature(KVM_FEATURE_STEAL_TIME))
as we now check it twice: in kvm_alloc_cpumask() and kvm_guest_init(),
something like pv_tlb_flush_supported(). We can also do
pv_ipi_supported() and probably others for consistency.
Also, probably not for this patch but it all makes me wonder why there's
no per-cpu 'scratch' cpumask for the whole kernel to use. We definitely
need it for hypervisor support but I also see
arch/x86/kernel/apic/x2apic_cluster.c has similar needs.
--
Vitaly
next prev parent reply other threads:[~2020-02-04 14:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-04 2:34 [PATCH] KVM: Pre-allocate 1 cpumask variable per cpu for both pv tlb and pv ipis Wanpeng Li
2020-02-04 12:57 ` Vitaly Kuznetsov
2020-02-04 13:09 ` Wanpeng Li
2020-02-04 14:27 ` Thadeu Lima de Souza Cascardo
2020-02-04 14:42 ` Vitaly Kuznetsov
2020-02-04 14:51 ` Thadeu Lima de Souza Cascardo
2020-02-04 14:36 ` Vitaly Kuznetsov [this message]
2020-02-05 13:26 ` Wanpeng Li
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=874kw6o1ve.fsf@vitty.brq.redhat.com \
--to=vkuznets@redhat.com \
--cc=cascardo@canonical.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kernellwp@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=sean.j.christopherson@intel.com \
--cc=wanpengli@tencent.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox