All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wanpeng Li <kernellwp@gmail.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: kvm <kvm@vger.kernel.org>, Jenifer Abrams <jhopper@redhat.com>,
	atheurer@redhat.com, jmario@redhat.com,
	Paolo Bonzini <pbonzini@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Wanpeng Li <wanpengli@tencent.com>,
	Eduardo Habkost <ehabkost@redhat.com>,
	Maxim Levitsky <mlevitsk@redhat.com>,
	Marcelo Tosatti <mtosatti@redhat.com>
Subject: Re: What does KVM_HINTS_REALTIME do?
Date: Wed, 4 Aug 2021 08:38:50 +0800	[thread overview]
Message-ID: <CANRm+Cy6CN2hF=BxZagkm0amUoQ8UcuD0JGvCV_Sj7bJFit0ow@mail.gmail.com> (raw)
In-Reply-To: <YQlOeGxhor3wJM6i@stefanha-x1.localdomain>

On Tue, 3 Aug 2021 at 22:14, Stefan Hajnoczi <stefanha@redhat.com> wrote:
>
> Hi,
> I was just in a discussion where we realized KVM_HINTS_REALTIME is a
> little underdocumented. Here is attempt to address that. Please correct
> me if there are inaccuracies or reply if you have additional questions:
>
> KVM_HINTS_REALTIME (aka QEMU kvm-hint-dedicated) is defined as follows
> in Documentation/virt/kvm/cpuid.rst:
>
>   guest checks this feature bit to determine that vCPUs are never
>   preempted for an unlimited time allowing optimizations
>
> Users or management tools set this flag themselves (it is not set
> automatically). This raises the question of what effects this flag has
> and when it should be set.
>
> When should I set KVM_HINTS_REALTIME?
> -------------------------------------
> When vCPUs are pinned to dedicated pCPUs. Even better if the isolcpus=
> kernel parameter is used on the host so there are no disturbances.
>
> Is the flag guest-wide or per-vCPU?
> -----------------------------------
> This flag is guest-wide so all vCPUs should be dedicated, not just some
> of them.
>
> Which Linux guest features are affected?
> ----------------------------------------
> PV spinlocks, PV TLB flush, and PV sched yield are disabled by
> KVM_HINTS_REALTIME. This is because no other vCPUs or host tasks will be
> running on the pCPUs, so there is no benefit in involving the host.
>
> The cpuidle-haltpoll driver is enabled by KVM_HINTS_REALTIME. This
> driver performs busy waiting inside the guest before halting the CPU in
> order to avoid the vCPU's wakeup latency. This driver also has a boolean
> "force" module parameter if you wish to enable it without setting
> KVM_HINTS_REALTIME.
>
> When KVM_HINTS_REALTIME is set, the KVM_CAP_X86_DISABLE_EXITS capability
> can also be used to disable MWAIT/HLT/PAUSE/CSTATE exits. This improves
> the latency of these operations. The user or management tools need to
> disable these exits themselves, e.g. with QEMU's -overcommit cpu-pm=on.

Looks good to me, too. :)

    Wanpeng

  parent reply	other threads:[~2021-08-04  0:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-03 14:11 What does KVM_HINTS_REALTIME do? Stefan Hajnoczi
2021-08-03 16:47 ` Marcelo Tosatti
2021-08-04  0:38 ` Wanpeng Li [this message]
2021-08-04  9:01 ` Pankaj Gupta
2021-08-04  9:06   ` Pankaj Gupta
2021-08-04  9:54     ` Paolo Bonzini
2021-08-04 10:23       ` Pankaj Gupta

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='CANRm+Cy6CN2hF=BxZagkm0amUoQ8UcuD0JGvCV_Sj7bJFit0ow@mail.gmail.com' \
    --to=kernellwp@gmail.com \
    --cc=atheurer@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=jhopper@redhat.com \
    --cc=jmario@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mlevitsk@redhat.com \
    --cc=mst@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=stefanha@redhat.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 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.