Re: [PATCH v6 2/3] KVM: dynamic halt_poll_ns adjustment

2015-09-03 Thread David Matlack
On Thu, Sep 3, 2015 at 2:23 AM, Wanpeng Li wrote: > > How about something like: > > @@ -1941,10 +1976,14 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu) > */ > if (kvm_vcpu_check_block(vcpu) < 0) { >

Re: [PATCH v6 2/3] KVM: dynamic halt_poll_ns adjustment

2015-09-03 Thread Wanpeng Li
On 9/3/15 2:09 AM, David Matlack wrote: [...] + static int kvm_vcpu_check_block(struct kvm_vcpu *vcpu) { if (kvm_arch_vcpu_runnable(vcpu)) { @@ -1929,6 +1963,7 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu) ktime_t start, cur; DEFINE_WAIT(wait); bool waited

Re: [PATCH v6 2/3] KVM: dynamic halt_poll_ns adjustment

2015-09-03 Thread Wanpeng Li
On 9/3/15 3:31 PM, Paolo Bonzini wrote: On 02/09/2015 21:23, David Matlack wrote: I actually wasn't thinking about vcpu->halt_poll_ns though. If single_task_running() breaks us out of the loop we will "goto out" instead of scheduling. My suspicion is this will cause us to loop calling

Re: [PATCH v6 2/3] KVM: dynamic halt_poll_ns adjustment

2015-09-03 Thread Paolo Bonzini
On 02/09/2015 21:23, David Matlack wrote: > > I actually wasn't thinking about vcpu->halt_poll_ns though. If > single_task_running() breaks us out of the loop we will "goto out" instead > of scheduling. My suspicion is this will cause us to loop calling > kvm_vcpu_block and starve the waiting

Re: [PATCH v6 2/3] KVM: dynamic halt_poll_ns adjustment

2015-09-03 Thread Wanpeng Li
On 9/4/15 12:07 AM, David Matlack wrote: On Thu, Sep 3, 2015 at 2:23 AM, Wanpeng Li wrote: How about something like: @@ -1941,10 +1976,14 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu) */ if (kvm_vcpu_check_block(vcpu)

Re: [PATCH v6 2/3] KVM: dynamic halt_poll_ns adjustment

2015-09-03 Thread Wanpeng Li
On 9/3/15 2:09 AM, David Matlack wrote: On Wed, Sep 2, 2015 at 12:29 AM, Wanpeng Li wrote: There is a downside of always-poll since poll is still happened for idle vCPUs which can waste cpu usage. This patch adds the ability to adjust halt_poll_ns dynamically, to grow

Re: [PATCH v6 2/3] KVM: dynamic halt_poll_ns adjustment

2015-09-03 Thread Wanpeng Li
On 9/4/15 9:16 AM, Wanpeng Li wrote: [...] + static int kvm_vcpu_check_block(struct kvm_vcpu *vcpu) { if (kvm_arch_vcpu_runnable(vcpu)) { @@ -1929,6 +1963,7 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu) ktime_t start, cur; DEFINE_WAIT(wait); bool waited =

[PATCH v6 2/3] KVM: dynamic halt_poll_ns adjustment

2015-09-02 Thread Wanpeng Li
There is a downside of always-poll since poll is still happened for idle vCPUs which can waste cpu usage. This patch adds the ability to adjust halt_poll_ns dynamically, to grow halt_poll_ns when shot halt is detected, and to shrink halt_poll_ns when long halt is detected. There are two new

Re: [PATCH v6 2/3] KVM: dynamic halt_poll_ns adjustment

2015-09-02 Thread David Matlack
On Wed, Sep 2, 2015 at 12:29 AM, Wanpeng Li wrote: > There is a downside of always-poll since poll is still happened for idle > vCPUs which can waste cpu usage. This patch adds the ability to adjust > halt_poll_ns dynamically, to grow halt_poll_ns when shot halt is

Re: [PATCH v6 2/3] KVM: dynamic halt_poll_ns adjustment

2015-09-02 Thread David Matlack
On Wed, Sep 2, 2015 at 12:12 PM, Paolo Bonzini wrote: > > > On 02/09/2015 20:09, David Matlack wrote: >> On Wed, Sep 2, 2015 at 12:29 AM, Wanpeng Li wrote: >>> There is a downside of always-poll since poll is still happened for idle >>> vCPUs which

Re: [PATCH v6 2/3] KVM: dynamic halt_poll_ns adjustment

2015-09-02 Thread Paolo Bonzini
On 02/09/2015 20:09, David Matlack wrote: > On Wed, Sep 2, 2015 at 12:29 AM, Wanpeng Li wrote: >> There is a downside of always-poll since poll is still happened for idle >> vCPUs which can waste cpu usage. This patch adds the ability to adjust >> halt_poll_ns