public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Radim Krčmář" <rkrcmar@redhat.com>
To: Yang Zhang <yang.zhang.wz@gmail.com>
Cc: Wanpeng Li <kernellwp@gmail.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	the arch/x86 maintainers <x86@kernel.org>,
	Jonathan Corbet <corbet@lwn.net>,
	tony.luck@intel.com, Borislav Petkov <bp@alien8.de>,
	Peter Zijlstra <peterz@infradead.org>,
	mchehab@kernel.org, Andrew Morton <akpm@linux-foundation.org>,
	krzk@kernel.org, jpoimboe@redhat.com,
	Andy Lutomirski <luto@kernel.org>,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	Thomas Garnier <thgarnie@google.com>,
	Robert Gerst <rgerst@gmail.com>,
	Mathias Krause <minipli@googlemail.com>,
	douly.fnst@cn.fujitsu.com, Nicolai Stange <nicstange@gmail.com>,
	Frederic Weisbecker <fweisbec@gmail.com>, dvlasenk@redhat.com,
Subject: Re: [PATCH 0/2] x86/idle: add halt poll support
Date: Tue, 27 Jun 2017 16:00:08 +0200	[thread overview]
Message-ID: <20170627140008.GA1503@potion> (raw)
In-Reply-To: <c49d78eb-6d10-b956-9d62-522631d6c09f@gmail.com>

2017-06-23 14:49+0800, Yang Zhang:
> On 2017/6/23 12:35, Wanpeng Li wrote:
> > 2017-06-23 12:08 GMT+08:00 Yang Zhang <yang.zhang.wz@gmail.com>:
> > > On 2017/6/22 19:50, Wanpeng Li wrote:
> > > > 
> > > > 2017-06-22 19:22 GMT+08:00 root <yang.zhang.wz@gmail.com>:
> > > > > 
> > > > > From: Yang Zhang <yang.zhang.wz@gmail.com>
> > > > > 
> > > > > Some latency-intensive workload will see obviously performance
> > > > > drop when running inside VM. The main reason is that the overhead
> > > > > is amplified when running inside VM. The most cost i have seen is
> > > > > inside idle path.
> > > > > This patch introduces a new mechanism to poll for a while before
> > > > > entering idle state. If schedule is needed during poll, then we
> > > > > don't need to goes through the heavy overhead path.
> > > > > 
> > > > > Here is the data i get when running benchmark contextswitch
> > > > > (https://github.com/tsuna/contextswitch)
> > > > > before patch:
> > > > > 2000000 process context switches in 4822613801ns (2411.3ns/ctxsw)
> > > > > after patch:
> > > > > 2000000 process context switches in 3584098241ns (1792.0ns/ctxsw)
> > > > 
> > > > 
> > > > If you test this after disabling the adaptive halt-polling in kvm?
> > > > What's the performance data of w/ this patchset and w/o the adaptive
> > > > halt-polling in kvm, and w/o this patchset and w/ the adaptive
> > > > halt-polling in kvm? In addition, both linux and windows guests can
> > > > get benefit as we have already done this in kvm.
> > > 
> > > 
> > > I will provide more data in next version. But it doesn't conflict with
> > 
> > Another case I can think of is w/ both this patchset and the adaptive
> > halt-polling in kvm.
> > 
> > > current halt polling inside kvm. This is just another enhancement.
> > 
> > I didn't look close to the patchset, however, maybe there is another
> > poll in the kvm part again sometimes if you fails the poll in the
> > guest. In addition, the adaptive halt-polling in kvm has performance
> > penalty when the pCPU is heavily overcommitted though there is a
> > single_task_running() in my testing, it is hard to accurately aware
> > whether there are other tasks waiting on the pCPU in the guest which
> > will make it worser. Depending on vcpu_is_preempted() or steal time
> > maybe not accurately or directly.
> > 
> > So I'm not sure how much sense it makes by adaptive halt-polling in
> > both guest and kvm. I prefer to just keep adaptive halt-polling in
> > kvm(then both linux/windows or other guests can get benefit) and avoid
> > to churn the core x86 path.
> 
> This mechanism is not specific to KVM. It is a kernel feature which can
> benefit guest when running inside X86 virtualization environment. The guest
> includes KVM,Xen,VMWARE,Hyper-v. Administrator can control KVM to use
> adaptive halt poll but he cannot control the user to use halt polling inside
> guest. Lots of user set idle=poll inside guest to improve performance which
> occupy more CPU cycles. This mechanism is a enhancement to it not to KVM
> halt polling.

Users of idle=poll shouln't overcommit, so the goal seems to be energy
savings without crippling the guest performance too much ...

Wouldn't switching to idle=mwait work as well?

Thanks.

      reply	other threads:[~2017-06-27 14:00 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-22 11:22 [PATCH 0/2] x86/idle: add halt poll support root
2017-06-22 11:22 ` [PATCH 1/2] x86/idle: add halt poll for halt idle root
2017-06-22 14:23   ` Thomas Gleixner
2017-06-23  4:05     ` Yang Zhang
2017-08-16  4:04   ` Michael S. Tsirkin
2017-08-17  7:29     ` Yang Zhang
2017-06-22 11:22 ` [PATCH 2/2] x86/idle: use dynamic halt poll root
2017-06-22 11:51   ` Paolo Bonzini
2017-06-23  3:58     ` Yang Zhang
2017-06-27 11:22       ` Yang Zhang
2017-06-27 12:07         ` Paolo Bonzini
2017-06-27 12:23           ` Wanpeng Li
2017-06-27 12:28             ` Paolo Bonzini
2017-06-27 13:40               ` Radim Krčmář
2017-06-27 13:56                 ` Paolo Bonzini
2017-06-27 14:22                   ` Radim Krčmář
2017-06-27 14:26                     ` Paolo Bonzini
2017-07-03  9:28                     ` Yang Zhang
2017-07-03 10:06                       ` Thomas Gleixner
2017-07-04  2:19                         ` Yang Zhang
2017-07-04 14:13                       ` Radim Krčmář
2017-07-04 14:50                         ` Thomas Gleixner
2017-07-13 11:49                         ` Yang Zhang
2017-07-14  9:37                           ` Alexander Graf
2017-07-17  9:26                             ` Yang Zhang
2017-07-17  9:54                               ` Alexander Graf
2017-07-17 12:50                                 ` Yang Zhang
2017-07-04 22:28                       ` Wanpeng Li
2017-06-22 14:32   ` Thomas Gleixner
2017-06-23  4:04     ` Yang Zhang
2017-06-22 22:46   ` kbuild test robot
2017-06-22 11:32 ` [PATCH 0/2] x86/idle: add halt poll support Yang Zhang
2017-06-22 11:50 ` Wanpeng Li
2017-06-23  4:08   ` Yang Zhang
2017-06-23  4:35     ` Wanpeng Li
2017-06-23  6:49       ` Yang Zhang
2017-06-27 14:00         ` Radim Krčmář [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=20170627140008.GA1503@potion \
    --to=rkrcmar@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=borntraeger@de.ibm.com \
    --cc=bp@alien8.de \
    --cc=corbet@lwn.net \
    --cc=douly.fnst@cn.fujitsu.com \
    --cc=dvlasenk@redhat.com \
    --cc=fweisbec@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jpoimboe@redhat.com \
    --cc=kernellwp@gmail.com \
    --cc=krzk@kernel.org \
    --cc=luto@kernel.org \
    --cc=mchehab@kernel.org \
    --cc=mingo@redhat.com \
    --cc=minipli@googlemail.com \
    --cc=nicstange@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rgerst@gmail.com \
    --cc=tglx@linutronix.de \
    --cc=thgarnie@google.com \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    --cc=yang.zhang.wz@gmail.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