[Qemu-devel] Re: [PATCH] fix halt emulation with icount and CONFIG_IOTHREAD (v2)

2011-02-18 Thread Paolo Bonzini
On 02/17/2011 09:27 AM, Paolo Bonzini wrote: It is -icount N which is broken and unfortunately your patch does not fix it. The problem is that for use_icount == 1 qemu_icount_delta always returns 0, and this makes no sense in the iothread case. As soon as the delta becomes greater than 10

[Qemu-devel] Re: [PATCH] fix halt emulation with icount and CONFIG_IOTHREAD (v2)

2011-02-17 Thread Paolo Bonzini
On 02/17/2011 04:15 AM, Marcelo Tosatti wrote: Yes, using qemu_icount_delta directly in tcg_wait_io_event timedwait is explicit (partially the reason for confusion with my patch). So the reasoning for the patch is: With icount vm_timer timers expire on virtual CPU time. If a CPU halts, you

[Qemu-devel] Re: [PATCH] fix halt emulation with icount and CONFIG_IOTHREAD (v2)

2011-02-17 Thread Jan Kiszka
On 2011-02-17 04:15, Marcelo Tosatti wrote: On Wed, Feb 16, 2011 at 10:32:25AM +0100, Paolo Bonzini wrote: On 02/15/2011 09:56 PM, Marcelo Tosatti wrote: Note: to be applied to uq/master. In icount mode, halt emulation should take into account the nearest event when sleeping. I agree with

[Qemu-devel] Re: [PATCH] fix halt emulation with icount and CONFIG_IOTHREAD (v2)

2011-02-16 Thread Jan Kiszka
On 2011-02-15 21:56, Marcelo Tosatti wrote: Note: to be applied to uq/master. In icount mode, halt emulation should take into account the nearest event when sleeping. Signed-off-by: Marcelo Tosatti mtosa...@redhat.com Reported-and-tested-by: Edgar E. Iglesias edgar.igles...@gmail.com

[Qemu-devel] Re: [PATCH] fix halt emulation with icount and CONFIG_IOTHREAD (v2)

2011-02-16 Thread Paolo Bonzini
On 02/15/2011 09:56 PM, Marcelo Tosatti wrote: Note: to be applied to uq/master. In icount mode, halt emulation should take into account the nearest event when sleeping. I agree with Jan that this patch is not the best solution, if not incorrect. However, in the iothread, the main loop can

[Qemu-devel] Re: [PATCH] fix halt emulation with icount and CONFIG_IOTHREAD (v2)

2011-02-16 Thread Jan Kiszka
On 2011-02-16 10:32, Paolo Bonzini wrote: On 02/15/2011 09:56 PM, Marcelo Tosatti wrote: Note: to be applied to uq/master. In icount mode, halt emulation should take into account the nearest event when sleeping. I agree with Jan that this patch is not the best solution, if not incorrect.

[Qemu-devel] Re: [PATCH] fix halt emulation with icount and CONFIG_IOTHREAD (v2)

2011-02-16 Thread Paolo Bonzini
On 02/16/2011 10:46 AM, Jan Kiszka wrote: What should this be good for? The iothread already kicks the vcpu if it wants to acquire the contended global mutex. Assuming the VCPU is in the timedwait that Marcelo changed, the global mutex is free and the iothread will not kick the VCPU. And

[Qemu-devel] Re: [PATCH] fix halt emulation with icount and CONFIG_IOTHREAD (v2)

2011-02-16 Thread Jan Kiszka
On 2011-02-16 10:57, Paolo Bonzini wrote: On 02/16/2011 10:46 AM, Jan Kiszka wrote: What should this be good for? The iothread already kicks the vcpu if it wants to acquire the contended global mutex. Assuming the VCPU is in the timedwait that Marcelo changed, the global mutex is free and

[Qemu-devel] Re: [PATCH] fix halt emulation with icount and CONFIG_IOTHREAD (v2)

2011-02-16 Thread Paolo Bonzini
On 02/16/2011 11:04 AM, Jan Kiszka wrote: On 2011-02-16 10:57, Paolo Bonzini wrote: On 02/16/2011 10:46 AM, Jan Kiszka wrote: What should this be good for? The iothread already kicks the vcpu if it wants to acquire the contended global mutex. Assuming the VCPU is in the timedwait that

[Qemu-devel] Re: [PATCH] fix halt emulation with icount and CONFIG_IOTHREAD (v2)

2011-02-16 Thread Jan Kiszka
On 2011-02-16 11:27, Paolo Bonzini wrote: On 02/16/2011 11:04 AM, Jan Kiszka wrote: On 2011-02-16 10:57, Paolo Bonzini wrote: On 02/16/2011 10:46 AM, Jan Kiszka wrote: What should this be good for? The iothread already kicks the vcpu if it wants to acquire the contended global mutex.

[Qemu-devel] Re: [PATCH] fix halt emulation with icount and CONFIG_IOTHREAD (v2)

2011-02-16 Thread Paolo Bonzini
On 02/16/2011 11:34 AM, Jan Kiszka wrote: FWIW, I've rebased most of your patches on top of my outstanding ones and pushed them to git://git.kiszka.org/qemu-kvm.git queues/kvm-upstream Yep, I am waiting for Anthony to actually push it. In the meanwhile I have it at

[Qemu-devel] Re: [PATCH] fix halt emulation with icount and CONFIG_IOTHREAD (v2)

2011-02-16 Thread Marcelo Tosatti
On Wed, Feb 16, 2011 at 10:32:25AM +0100, Paolo Bonzini wrote: On 02/15/2011 09:56 PM, Marcelo Tosatti wrote: Note: to be applied to uq/master. In icount mode, halt emulation should take into account the nearest event when sleeping. I agree with Jan that this patch is not the best