diff mbox

KVM: fix polling for guest halt continued even if disable it

Message ID BLU436-SMTP2173FDFA2A6CE0563384020805D0@phx.gbl (mailing list archive)
State New, archived
Headers show

Commit Message

Wanpeng Li Sept. 14, 2015, 9:38 a.m. UTC
If there is already some polling ongoing, it's impossible to disable the 
polling, since as soon as somebody sets halt_poll_ns to 0, polling will 
never stop, as grow and shrink are only handled if halt_poll_ns is != 0.

This patch fix it by reset vcpu->halt_poll_ns in order to stop polling 
when polling is disabled.

Reported-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>
---
 virt/kvm/kvm_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Christian Borntraeger Sept. 15, 2015, 7:16 a.m. UTC | #1
Am 14.09.2015 um 11:38 schrieb Wanpeng Li:
> If there is already some polling ongoing, it's impossible to disable the 
> polling, since as soon as somebody sets halt_poll_ns to 0, polling will 
> never stop, as grow and shrink are only handled if halt_poll_ns is != 0.
> 
> This patch fix it by reset vcpu->halt_poll_ns in order to stop polling 
> when polling is disabled.
> 
> Reported-by: Christian Borntraeger <borntraeger@de.ibm.com>
> Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>
> ---
>  virt/kvm/kvm_main.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index 4662a88..f756cac0 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -2012,7 +2012,8 @@ out:
>  		else if (vcpu->halt_poll_ns < halt_poll_ns &&
>  			block_ns < halt_poll_ns)
>  			grow_halt_poll_ns(vcpu);
> -	}
> +	} else
> +		vcpu->halt_poll_ns = 0;
> 
>  	trace_kvm_vcpu_wakeup(block_ns, waited);
>  }
> 

Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 4662a88..f756cac0 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -2012,7 +2012,8 @@  out:
 		else if (vcpu->halt_poll_ns < halt_poll_ns &&
 			block_ns < halt_poll_ns)
 			grow_halt_poll_ns(vcpu);
-	}
+	} else
+		vcpu->halt_poll_ns = 0;
 
 	trace_kvm_vcpu_wakeup(block_ns, waited);
 }