diff mbox series

[v2,2/2] KVM:390: Use kvm_vcpu_wake_up in kvm_s390_vcpu_wakeup

Message ID 1563449947-7749-2-git-send-email-wanpengli@tencent.com (mailing list archive)
State New, archived
Headers show
Series [v2,1/2] KVM: Boosting vCPUs that are delivering interrupts | expand

Commit Message

Wanpeng Li July 18, 2019, 11:39 a.m. UTC
From: Wanpeng Li <wanpengli@tencent.com>

Use kvm_vcpu_wake_up() in kvm_s390_vcpu_wakeup().

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Radim Krčmář <rkrcmar@redhat.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Wanpeng Li <wanpengli@tencent.com>
---
 arch/s390/kvm/interrupt.c | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

Comments

Christian Borntraeger July 18, 2019, 12:09 p.m. UTC | #1
On 18.07.19 13:39, Wanpeng Li wrote:
> From: Wanpeng Li <wanpengli@tencent.com>
> 
> Use kvm_vcpu_wake_up() in kvm_s390_vcpu_wakeup().
> 
> Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Radim Krčmář <rkrcmar@redhat.com>
> Cc: Christian Borntraeger <borntraeger@de.ibm.com>
> Signed-off-by: Wanpeng Li <wanpengli@tencent.com>

with patch1 this looks good. 
> ---
>  arch/s390/kvm/interrupt.c | 15 +--------------
>  1 file changed, 1 insertion(+), 14 deletions(-)
> 
> diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
> index 26f8bf4..881cc5a 100644
> --- a/arch/s390/kvm/interrupt.c
> +++ b/arch/s390/kvm/interrupt.c
> @@ -1229,21 +1229,8 @@ void kvm_s390_vcpu_wakeup(struct kvm_vcpu *vcpu)
>  	 * in kvm_vcpu_block without having the waitqueue set (polling)
>  	 */
>  	vcpu->valid_wakeup = true;
> -	/*
> -	 * This is mostly to document, that the read in swait_active could
> -	 * be moved before other stores, leading to subtle races.
> -	 * All current users do not store or use an atomic like update
> -	 */
> -	smp_mb__after_atomic();
> -	if (swait_active(&vcpu->wq)) {
> -		/*
> -		 * The vcpu gave up the cpu voluntarily, mark it as a good
> -		 * yield-candidate.
> -		 */
> +	if (kvm_vcpu_wake_up(vcpu))
>  		vcpu->ready = true;
> -		swake_up_one(&vcpu->wq);
> -		vcpu->stat.halt_wakeup++;
> -	}
>  	/*
>  	 * The VCPU might not be sleeping but is executing the VSIE. Let's
>  	 * kick it, so it leaves the SIE to process the request.
>
diff mbox series

Patch

diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
index 26f8bf4..881cc5a 100644
--- a/arch/s390/kvm/interrupt.c
+++ b/arch/s390/kvm/interrupt.c
@@ -1229,21 +1229,8 @@  void kvm_s390_vcpu_wakeup(struct kvm_vcpu *vcpu)
 	 * in kvm_vcpu_block without having the waitqueue set (polling)
 	 */
 	vcpu->valid_wakeup = true;
-	/*
-	 * This is mostly to document, that the read in swait_active could
-	 * be moved before other stores, leading to subtle races.
-	 * All current users do not store or use an atomic like update
-	 */
-	smp_mb__after_atomic();
-	if (swait_active(&vcpu->wq)) {
-		/*
-		 * The vcpu gave up the cpu voluntarily, mark it as a good
-		 * yield-candidate.
-		 */
+	if (kvm_vcpu_wake_up(vcpu))
 		vcpu->ready = true;
-		swake_up_one(&vcpu->wq);
-		vcpu->stat.halt_wakeup++;
-	}
 	/*
 	 * The VCPU might not be sleeping but is executing the VSIE. Let's
 	 * kick it, so it leaves the SIE to process the request.