Re: [PATCH RFC v3 3/6] sched/idle: Add a generic poll before enter real idle path

2017-11-22 Thread Quan Xu
On 2017-11-16 17:45, Daniel Lezcano wrote: On 16/11/2017 10:12, Quan Xu wrote: On 2017-11-16 06:03, Thomas Gleixner wrote: On Wed, 15 Nov 2017, Peter Zijlstra wrote: On Mon, Nov 13, 2017 at 06:06:02PM +0800, Quan Xu wrote: From: Yang Zhang <yang.zhang...@gmail.com> Implement a g

Re: [Xen-devel] [PATCH RFC v3 0/6] x86/idle: add halt poll support

2017-11-22 Thread Quan Xu
On 2017-11-16 05:31, Konrad Rzeszutek Wilk wrote: On Mon, Nov 13, 2017 at 06:05:59PM +0800, Quan Xu wrote: From: Yang Zhang <yang.zhang...@gmail.com> Some latency-intensive workload have seen obviously performance drop when running inside VM. The main reason is that the overhead is amp

Re: [PATCH RFC v3 3/6] sched/idle: Add a generic poll before enter real idle path

2017-11-22 Thread Quan Xu
On 2017-11-16 06:03, Thomas Gleixner wrote: On Wed, 15 Nov 2017, Peter Zijlstra wrote: On Mon, Nov 13, 2017 at 06:06:02PM +0800, Quan Xu wrote: From: Yang Zhang <yang.zhang...@gmail.com> Implement a generic idle poll which resembles the functionality found in arch/. Provid

Re: [PATCH RFC v3 3/6] sched/idle: Add a generic poll before enter real idle path

2017-11-22 Thread Quan Xu
On 2017-11-16 17:53, Thomas Gleixner wrote: On Thu, 16 Nov 2017, Quan Xu wrote: On 2017-11-16 06:03, Thomas Gleixner wrote: --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c @@ -210,6 +210,13 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv

Re: [PATCH RFC v3 3/6] sched/idle: Add a generic poll before enter real idle path

2017-11-22 Thread Quan Xu
On 2017-11-16 16:45, Peter Zijlstra wrote: On Wed, Nov 15, 2017 at 11:03:08PM +0100, Thomas Gleixner wrote: If I understand the problem correctly then he wants to avoid the heavy lifting in tick_nohz_idle_enter() in the first place, but there is already an interesting quirk there which makes

Re: [PATCH RFC v3 3/6] sched/idle: Add a generic poll before enter real idle path

2017-11-22 Thread Quan Xu
On 2017-11-17 19:36, Thomas Gleixner wrote: On Fri, 17 Nov 2017, Quan Xu wrote: On 2017-11-16 17:53, Thomas Gleixner wrote: That's just plain wrong. We don't want to see any of this PARAVIRT crap in anything outside the architecture/hypervisor interfacing code which really needs

Re: [PATCH RFC v3 1/6] x86/paravirt: Add pv_idle_ops to paravirt ops

2017-11-22 Thread Quan Xu
On 2017/11/14 18:27, Juergen Gross wrote: On 14/11/17 10:38, Quan Xu wrote: On 2017/11/14 15:30, Juergen Gross wrote: On 14/11/17 08:02, Quan Xu wrote: On 2017/11/13 18:53, Juergen Gross wrote: On 13/11/17 11:06, Quan Xu wrote: From: Quan Xu <quan@gmail.com> So far, pv_idle_op

[PATCH RFC v3 5/6] tick: get duration of the last idle loop

2017-11-22 Thread Quan Xu
From: Quan Xu <quan@gmail.com> the last idle loop is from tick_nohz_idle_enter to tick_nohz_idle_exit. Signed-off-by: Yang Zhang <yang.zhang...@gmail.com> Signed-off-by: Quan Xu <quan@gmail.com> Cc: Frederic Weisbecker <fweis...@gmail.com> Cc: Thomas Gleixner

[PATCH RFC v3 0/6] x86/idle: add halt poll support

2017-11-22 Thread Quan Xu
From: Quan Xu <quan@gmail.com> Some latency-intensive workload have seen 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 t

[PATCH RFC v3 3/6] sched/idle: Add a generic poll before enter real idle path

2017-11-22 Thread Quan Xu
In KVM guest, this costs several VM-exit/VM-entry cycles, VM-entry for interrupts and VM-exit immediately. Also this becomes more expensive than bare metal. Add a generic idle poll before enter real idle path. When a reschedule event is pending, we can bypass the real idle path. Signed-off-by: Q

Re: [PATCH RFC v3 4/6] Documentation: Add three sysctls for smart idle poll

2017-11-22 Thread Quan Xu
On 2017/11/13 23:08, Ingo Molnar wrote: * Quan Xu <quan.x...@gmail.com> wrote: From: Quan Xu <quan@gmail.com> To reduce the cost of poll, we introduce three sysctl to control the poll time when running as a virtual machine with paravirt. Signed-off-by: Yang Zhang

[PATCH RFC v3 6/6] KVM guest: introduce smart idle poll algorithm

2017-11-22 Thread Quan Xu
From: Yang Zhang <yang.zhang...@gmail.com> using smart idle poll to reduce the useless poll when system is idle. Signed-off-by: Quan Xu <quan@gmail.com> Signed-off-by: Yang Zhang <yang.zhang...@gmail.com> Cc: Paolo Bonzini <pbonz...@redhat.com> Cc: Thomas Gleixner

[PATCH RFC v3 4/6] Documentation: Add three sysctls for smart idle poll

2017-11-22 Thread Quan Xu
From: Quan Xu <quan@gmail.com> To reduce the cost of poll, we introduce three sysctl to control the poll time when running as a virtual machine with paravirt. Signed-off-by: Yang Zhang <yang.zhang...@gmail.com> Signed-off-by: Quan Xu <quan@gmail.com> --- Documentation

[PATCH RFC v3 2/6] KVM guest: register kvm_idle_poll for pv_idle_ops

2017-11-22 Thread Quan Xu
From: Quan Xu <quan@gmail.com> Although smart idle poll has nothing to do with paravirt, it can not bring any benifit to native. So we only enable it when Linux runs as a KVM guest( also it can extend to other hypervisor like Xen, HyperV and VMware). Introduce per-CPU va

[PATCH RFC v3 1/6] x86/paravirt: Add pv_idle_ops to paravirt ops

2017-11-22 Thread Quan Xu
From: Quan Xu <quan@gmail.com> So far, pv_idle_ops.poll is the only ops for pv_idle. .poll is called in idle path which will poll for a while before we enter the real idle state. In virtualization, idle path includes several heavy operations includes timer access(LAPIC timer or TSC de

[PATCH RFC v3 0/6] x86/idle: add halt poll support

2017-11-22 Thread Quan Xu
vcpu is the only task in pcpu, so we don't consider it in this series.(May improve it in future) --- Quan Xu (4): x86/paravirt: Add pv_idle_ops to paravirt ops KVM guest: register kvm_idle_poll for pv_idle_ops Documentation: Add three sysctls for smart idle poll tick: get duration of the last idl

Re: [PATCH RFC v3 1/6] x86/paravirt: Add pv_idle_ops to paravirt ops

2017-11-22 Thread Quan Xu
On 2017/11/13 18:53, Juergen Gross wrote: On 13/11/17 11:06, Quan Xu wrote: From: Quan Xu <quan@gmail.com> So far, pv_idle_ops.poll is the only ops for pv_idle. .poll is called in idle path which will poll for a while before we enter the real idle state. In virtualization, idl

[PATCH RFC v3 0/6] x86/idle: add halt poll support

2017-11-22 Thread Quan Xu
vcpu is the only task in pcpu, so we don't consider it in this series.(May improve it in future) --- Quan Xu (4): x86/paravirt: Add pv_idle_ops to paravirt ops KVM guest: register kvm_idle_poll for pv_idle_ops Documentation: Add three sysctls for smart idle poll tick: get duration of the last idl

Re: [PATCH RFC v3 1/6] x86/paravirt: Add pv_idle_ops to paravirt ops

2017-11-22 Thread Quan Xu
On 2017/11/14 15:12, Wanpeng Li wrote: 2017-11-14 15:02 GMT+08:00 Quan Xu <quan@gmail.com>: On 2017/11/13 18:53, Juergen Gross wrote: On 13/11/17 11:06, Quan Xu wrote: From: Quan Xu <quan@gmail.com> So far, pv_idle_ops.poll is the only ops for pv_idle. .poll is called

Re: [PATCH RFC v3 1/6] x86/paravirt: Add pv_idle_ops to paravirt ops

2017-11-22 Thread Quan Xu
On 2017/11/14 15:30, Juergen Gross wrote: On 14/11/17 08:02, Quan Xu wrote: On 2017/11/13 18:53, Juergen Gross wrote: On 13/11/17 11:06, Quan Xu wrote: From: Quan Xu <quan@gmail.com> So far, pv_idle_ops.poll is the only ops for pv_idle. .poll is called in idle path which wil

Re: [PATCH RFC v3 1/6] x86/paravirt: Add pv_idle_ops to paravirt ops

2017-11-22 Thread Quan Xu
On 2017/11/14 16:22, Wanpeng Li wrote: 2017-11-14 16:15 GMT+08:00 Quan Xu <quan@gmail.com>: On 2017/11/14 15:12, Wanpeng Li wrote: 2017-11-14 15:02 GMT+08:00 Quan Xu <quan@gmail.com>: On 2017/11/13 18:53, Juergen Gross wrote: On 13/11/17 11:06, Quan Xu wrote: From: Q