Re: [kvm-devel] KVM: kvm_vcpu_block task state race

2008-05-14 Thread Avi Kivity
Marcelo Tosatti wrote: > On Sun, May 11, 2008 at 05:26:06PM +0300, Avi Kivity wrote: > >>> So do you want to give wait_event_interruptible() a try or wait for that >>> change until userspace never issues vcpu ioctl's to a possibly busy vcpu >>> (and go with the patch above)? >>> >>> >>

Re: [kvm-devel] KVM: kvm_vcpu_block task state race

2008-05-13 Thread Marcelo Tosatti
On Sun, May 11, 2008 at 05:26:06PM +0300, Avi Kivity wrote: > >So do you want to give wait_event_interruptible() a try or wait for that > >change until userspace never issues vcpu ioctl's to a possibly busy vcpu > >(and go with the patch above)? > > > > Do we have anything critical that issues v

Re: [kvm-devel] KVM: kvm_vcpu_block task state race

2008-05-11 Thread Avi Kivity
Marcelo Tosatti wrote: >> The best practice is to issue all vcpu ioctls from the thread that >> created the vcpu; this becomes mandatory if we ever switch to a syscall >> interface and remove the mutex. >> > > For things like register dumps I don't believe its worthwhile. Much > simpler to s

Re: [kvm-devel] KVM: kvm_vcpu_block task state race

2008-05-11 Thread Avi Kivity
Marcelo Tosatti wrote: > On Fri, May 09, 2008 at 04:22:08PM -0300, Marcelo Tosatti wrote: > >> For things like register dumps I don't believe its worthwhile. Much >> simpler to stop the vcpu with SIG_IPI, retrieve registers, and run it >> again (now that you mention the busy-spin, it is broken r

Re: [kvm-devel] KVM: kvm_vcpu_block task state race

2008-05-09 Thread Marcelo Tosatti
On Fri, May 09, 2008 at 04:22:08PM -0300, Marcelo Tosatti wrote: > For things like register dumps I don't believe its worthwhile. Much > simpler to stop the vcpu with SIG_IPI, retrieve registers, and run it > again (now that you mention the busy-spin, it is broken right now, if a > vcpu is spinning

Re: [kvm-devel] KVM: kvm_vcpu_block task state race

2008-05-09 Thread Marcelo Tosatti
On Fri, May 09, 2008 at 06:09:41PM +0300, Avi Kivity wrote: > Marcelo Tosatti wrote: > >On Fri, May 09, 2008 at 10:40:47AM +0300, Avi Kivity wrote: > > > > > >>>Unfortunately it can't use wait_event_interruptible() due to > >>>vcpu_put/vcpu_load. > >>> > >>> > >>> > >>schedule() will call

Re: [kvm-devel] KVM: kvm_vcpu_block task state race

2008-05-09 Thread Avi Kivity
Marcelo Tosatti wrote: > On Fri, May 09, 2008 at 10:40:47AM +0300, Avi Kivity wrote: > > >>> Unfortunately it can't use wait_event_interruptible() due to >>> vcpu_put/vcpu_load. >>> >>> >>> >> schedule() will call vcpu_put()/vcpu_load() for us through preempt >> notifiers. I feel a li

Re: [kvm-devel] KVM: kvm_vcpu_block task state race

2008-05-09 Thread Marcelo Tosatti
On Fri, May 09, 2008 at 10:40:47AM +0300, Avi Kivity wrote: > >Unfortunately it can't use wait_event_interruptible() due to > >vcpu_put/vcpu_load. > > > > > > schedule() will call vcpu_put()/vcpu_load() for us through preempt > notifiers. I feel a little uneasy about it, but no concreate reas

Re: [kvm-devel] KVM: kvm_vcpu_block task state race

2008-05-09 Thread Avi Kivity
Marcelo Tosatti wrote: > There's still a race in kvm_vcpu_block(), if a wake_up_interruptible() > call happens before the task state is set to TASK_INTERRUPTIBLE: > > CPU0CPU1 > > kvm_vcpu_block > > add_wait_queue > > kv

[kvm-devel] KVM: kvm_vcpu_block task state race

2008-05-08 Thread Marcelo Tosatti
There's still a race in kvm_vcpu_block(), if a wake_up_interruptible() call happens before the task state is set to TASK_INTERRUPTIBLE: CPU0CPU1 kvm_vcpu_block add_wait_queue kvm_cpu_has_interrupt = 0