public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Chao Gao <chao.gao@intel.com>
Cc: wangguangju <wangguangju@baidu.com>,
	pbonzini@redhat.com, vkuznets@redhat.com, wanpengli@tencent.com,
	jmattson@google.com, joro@8bytes.org, kvm@vger.kernel.org,
	dave.hansen@linux.intel.co, tglx@linutronix.de, mingo@redhat.com,
	x86@kernel.org, linux-kernel@vger.kernel.orga
Subject: Re: [PATCH] KVM: x86: add a bool variable to distinguish whether to use PVIPI
Date: Tue, 14 Jun 2022 14:41:30 +0000	[thread overview]
Message-ID: <YqieGua0ouUePWol@google.com> (raw)
In-Reply-To: <20220614025434.GA15042@gao-cwp>

On Tue, Jun 14, 2022, Chao Gao wrote:
> On Mon, Jun 13, 2022 at 05:16:48PM +0000, Sean Christopherson wrote:
> >The shortlog is not at all helpful, it doesn't say anything about what actual
> >functional change.
> >
> >  KVM: x86: Don't advertise PV IPI to userspace if IPIs are virtualized
> >
> >On Mon, Jun 13, 2022, wangguangju wrote:
> >> Commit d588bb9be1da ("KVM: VMX: enable IPI virtualization")
> >> enable IPI virtualization in Intel SPR platform.There is no point
> >> in using PVIPI if IPIv is supported, it doesn't work less good
> >> with PVIPI than without it.
> >> 
> >> So add a bool variable to distinguish whether to use PVIPI.
> >
> >Similar complaint with the changelog, it doesn't actually call out why PV IPIs
> >are unwanted.
> >
> >  Don't advertise PV IPI support to userspace if IPI virtualization is
> >  supported by the CPU.  Hardware virtualization of IPIs more performant
> >  as senders do not need to exit.
> 
> PVIPI is mainly [*] for sending multi-cast IPIs. Intel IPI virtualization
> can virtualize only uni-cast IPIs. Their use cases don't overlap. So, I
> don't think it makes sense to disable PVIPI if intel IPI virtualization
> is supported.
> 
> The question actually is how to deal with the exceptional case below.
> Considering the migration case Sean said below, it is hard to let VM
> always work in the ideal way unless KVM notifies VM of migration and VM
> changes its behavior on receiving such notifications. But since x2apic
> has better performance than xapic, if VM cares about performance, it can
> simply switch to x2apic mode. All things considered, I think the
> performance gain isn't worth the complexity added. So, I prefer to leave
> it as is.
> 
> [*]: when linux guest is in *xapic* mode, it uses PVIPI to send uni-case IPI.

Hmm, there are definitely guests that run xAPIC though, even if x2apic is supported.

That said, I tend to agree that trying to handle this in KVM and/or the guest kernel
is going to get messy.  The easiest solution is for VMMs to not advertise PV IPIs
when the VM is going to predominately run on hosts with IPIv.

> >That said, I'm not sure that KVM should actually hide PV_SEND_IPI.  KVM still
> >supports the feature, and unlike sched_info_on(), IPI virtualization is platform
> >dependent and not fully controlled by software.  E.g. hiding PV_SEND_IPI could
> >cause problems when migrating from a platform without IPIv to a platform with IPIv,
> >as a paranoid VMM might complain that an exposed feature isn't supported by KVM.
> >
> >There's also the question of what to do about AVIC.  AVIC has many more inhibits
> >than APICv, e.g. an x2APIC guest running on hardware that doesn't accelerate x2APIC
> >IPIs will probably be better off with PV IPIs.
> >
> >Given that userspace should have read access to the module param, I'm tempted to
> >say KVM should let userspace make the decision of whether or not to advertise PV
> >IPIs to the guest.

  reply	other threads:[~2022-06-14 14:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1655124522-42030-1-git-send-email-wangguangju@baidu.com>
2022-06-13 17:16 ` [PATCH] KVM: x86: add a bool variable to distinguish whether to use PVIPI Sean Christopherson
2022-06-14  2:54   ` Chao Gao
2022-06-14 14:41     ` Sean Christopherson [this message]
2022-06-14 15:03       ` Chao Gao
2022-06-15  4:21         ` 答复: " Wang,Guangju
2022-06-15  5:33           ` Chao Gao

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=YqieGua0ouUePWol@google.com \
    --to=seanjc@google.com \
    --cc=chao.gao@intel.com \
    --cc=dave.hansen@linux.intel.co \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.orga \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=vkuznets@redhat.com \
    --cc=wangguangju@baidu.com \
    --cc=wanpengli@tencent.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox