diff mbox

kvm-390: fix wait_queue handling

Message ID 200907161717.38035.borntraeger@de.ibm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Christian Borntraeger July 16, 2009, 3:17 p.m. UTC
From: Christian Borntraeger <borntraeger@de.ibm.com>

There are two waitqueues in kvm for wait handling:
vcpu->wq for virt/kvm/kvm_main.c and
vpcu->arch.local_int.wq for the s390 specific wait code.

the wait handling in kvm_s390_handle_wait was broken by using different
wait_queues for add_wait queue and remove_wait_queue.

There are two options to fix the problem: 
o  move all the s390 specific code to vcpu->wq and remove
   vcpu->arch.local_int.wq
o  move all the s390 specific code to vcpu->arch.local_int.wq

This patch chooses the 2nd variant for two reasons:
o  s390 does not use kvm_vcpu_block but implements its own enabled wait
   handling.
   Having a separate wait_queue make it clear, that our wait mechanism is
   different
o  the patch is much smaller

Report-by:  Julia Lawall <julia@diku.dk>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 arch/s390/kvm/interrupt.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


--
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

Comments

Marcelo Tosatti July 20, 2009, 3:17 p.m. UTC | #1
On Thu, Jul 16, 2009 at 05:17:37PM +0200, Christian Bornträger wrote:
> From: Christian Borntraeger <borntraeger@de.ibm.com>
> 
> There are two waitqueues in kvm for wait handling:
> vcpu->wq for virt/kvm/kvm_main.c and
> vpcu->arch.local_int.wq for the s390 specific wait code.
> 
> the wait handling in kvm_s390_handle_wait was broken by using different
> wait_queues for add_wait queue and remove_wait_queue.
> 
> There are two options to fix the problem: 
> o  move all the s390 specific code to vcpu->wq and remove
>    vcpu->arch.local_int.wq
> o  move all the s390 specific code to vcpu->arch.local_int.wq
> 
> This patch chooses the 2nd variant for two reasons:
> o  s390 does not use kvm_vcpu_block but implements its own enabled wait
>    handling.
>    Having a separate wait_queue make it clear, that our wait mechanism is
>    different
> o  the patch is much smaller
> 
> Report-by:  Julia Lawall <julia@diku.dk>
> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
> ---
>  arch/s390/kvm/interrupt.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Index: kvm/arch/s390/kvm/interrupt.c
> ===================================================================
> --- kvm.orig/arch/s390/kvm/interrupt.c
> +++ kvm/arch/s390/kvm/interrupt.c
> @@ -386,7 +386,7 @@ no_timer:
>  	}
>  	__unset_cpu_idle(vcpu);
>  	__set_current_state(TASK_RUNNING);
> -	remove_wait_queue(&vcpu->wq, &wait);
> +	remove_wait_queue(&vcpu->arch.local_int.wq, &wait);
>  	spin_unlock_bh(&vcpu->arch.local_int.lock);
>  	spin_unlock(&vcpu->arch.local_int.float_int->lock);
>  	hrtimer_try_to_cancel(&vcpu->arch.ckc_timer);

Applied, thanks.

--
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

Index: kvm/arch/s390/kvm/interrupt.c
===================================================================
--- kvm.orig/arch/s390/kvm/interrupt.c
+++ kvm/arch/s390/kvm/interrupt.c
@@ -386,7 +386,7 @@  no_timer:
 	}
 	__unset_cpu_idle(vcpu);
 	__set_current_state(TASK_RUNNING);
-	remove_wait_queue(&vcpu->wq, &wait);
+	remove_wait_queue(&vcpu->arch.local_int.wq, &wait);
 	spin_unlock_bh(&vcpu->arch.local_int.lock);
 	spin_unlock(&vcpu->arch.local_int.float_int->lock);
 	hrtimer_try_to_cancel(&vcpu->arch.ckc_timer);