From: "Michael S. Tsirkin" <mst@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: "Wanpeng Li" <kernellwp@gmail.com>,
qemu-devel@nongnu.org, kvm@vger.kernel.org,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Radim Krčmář" <rkrcmar@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] i386/kvm: add support for KVM_CAP_X86_DISABLE_EXITS
Date: Thu, 29 Mar 2018 00:43:03 +0300 [thread overview]
Message-ID: <20180329004100-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20180328183123.GI5046@localhost.localdomain>
On Wed, Mar 28, 2018 at 03:31:23PM -0300, Eduardo Habkost wrote:
> On Wed, Mar 28, 2018 at 03:06:23AM +0300, Michael S. Tsirkin wrote:
> > On Tue, Mar 27, 2018 at 06:36:46PM -0300, Eduardo Habkost wrote:
> > > On Tue, Mar 27, 2018 at 10:42:56PM +0300, Michael S. Tsirkin wrote:
> > > > On Fri, Mar 16, 2018 at 07:36:42AM -0700, Wanpeng Li wrote:
> > > > > From: Wanpeng Li <wanpengli@tencent.com>
> > > > >
> > > > > This patch adds support for KVM_CAP_X86_DISABLE_EXITS. Provides userspace with
> > > > > per-VM capability(KVM_CAP_X86_DISABLE_EXITS) to not intercept MWAIT/HLT/PAUSE
> > > > > in order that to improve latency in some workloads.
> > > > >
> > > [...]
> > > > > diff --git a/target/i386/kvm.c b/target/i386/kvm.c
> > > > > index d23fff1..95ed9eb 100644
> > > > > --- a/target/i386/kvm.c
> > > > > +++ b/target/i386/kvm.c
> > > > > @@ -999,6 +999,18 @@ int kvm_arch_init_vcpu(CPUState *cs)
> > > > > }
> > > > > }
> > > > >
> > > > > + if (env->features[FEAT_KVM_HINTS] & KVM_HINTS_DEDICATED) {
> > > > > + int disable_exits = kvm_check_extension(cs->kvm_state, KVM_CAP_X86_DISABLE_EXITS);
> > > > > + if (disable_exits) {
> > > > > + disable_exits &= (KVM_X86_DISABLE_EXITS_MWAIT |
> > > > > + KVM_X86_DISABLE_EXITS_HLT |
> > > > > + KVM_X86_DISABLE_EXITS_PAUSE);
> > > > > + }
> > > > > + if (kvm_vm_enable_cap(cs->kvm_state, KVM_CAP_X86_DISABLE_EXITS, 0, disable_exits)) {
> > > > > + error_report("kvm: DISABLE EXITS not supported");
> > > > > + }
> > > > > + }
> > > > > +
> > > > > qemu_add_vm_change_state_handler(cpu_update_state, env);
> > > > >
> > > > > c = cpuid_find_entry(&cpuid_data.cpuid, 1, 0);
> > > >
> > > > Why not a bit per capability?
> > > > I can see how someone might want to disable mwait exists
> > > > but not the rest of them.
> > >
> > > kvm-hint-dedicated=on should be used only if the physical CPU is
> > > dedicated to the VCPU task. Are there any advantages of getting
> > > vmexits for HLT and PAUSE if no other task is going to use the
> > > CPU?
> >
> > No but there are advantages to using mwait even without a dedicated host
> > CPU (VCPUs can wake up each other without exiting to hypervisor).
>
> Are there any downsides? What needs to be taken into account
> when deciding if mwait exits can be safely disabled?
Exit might take longer as it might need to wake up CPU
from a deep C state.
So one needs to know which C states are enabled on host
and whether any tasks on the same CPU are latency sensitive.
>
> >
> > Which is my point - there should be a separate flag to disable mwait
> > exiting only.
>
> Adding new command-line option is possible, but not necessary for
> the dedicated-CPU use case. This means this patch is already
> useful without adding new flags.
True.
> --
> Eduardo
prev parent reply other threads:[~2018-03-28 21:43 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-16 14:36 [Qemu-devel] [PATCH] i386/kvm: add support for KVM_CAP_X86_DISABLE_EXITS Wanpeng Li
2018-03-16 14:41 ` no-reply
2018-03-16 14:58 ` Wanpeng Li
2018-03-16 15:22 ` Paolo Bonzini
2018-03-23 20:18 ` Eduardo Habkost
2018-03-25 3:33 ` Wanpeng Li
2018-03-26 19:43 ` Eduardo Habkost
2018-04-10 9:43 ` Wanpeng Li
2018-03-27 19:42 ` Michael S. Tsirkin
2018-03-27 21:36 ` Eduardo Habkost
2018-03-28 0:06 ` Michael S. Tsirkin
2018-03-28 18:31 ` Eduardo Habkost
2018-03-28 21:43 ` Michael S. Tsirkin [this message]
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=20180329004100-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=ehabkost@redhat.com \
--cc=kernellwp@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rkrcmar@redhat.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;
as well as URLs for NNTP newsgroup(s).