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

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

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

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

[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 git://github.com/bonzini/q

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

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

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

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

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

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

[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 > Reported-and-tested-by: "Edgar E. Iglesias" > > diff --git a/cpus.c b/cpus.c > in

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

2011-02-15 Thread Marcelo Tosatti
On Tue, Feb 15, 2011 at 09:33:00PM +0100, Jan Kiszka wrote: > On 2011-02-15 21:04, Marcelo Tosatti wrote: > > On Tue, Feb 15, 2011 at 07:58:53PM +0100, Jan Kiszka wrote: > >> On 2011-02-15 18:54, Marcelo Tosatti wrote: > >>> > >>> Note: to be applied to uq/master. > >>> > >>> In icount mode, halt e

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

2011-02-15 Thread Jan Kiszka
On 2011-02-15 21:04, Marcelo Tosatti wrote: > On Tue, Feb 15, 2011 at 07:58:53PM +0100, Jan Kiszka wrote: >> On 2011-02-15 18:54, Marcelo Tosatti wrote: >>> >>> Note: to be applied to uq/master. >>> >>> In icount mode, halt emulation should take into account the nearest event >>> when sleeping. >>

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

2011-02-15 Thread Marcelo Tosatti
On Tue, Feb 15, 2011 at 07:58:53PM +0100, Jan Kiszka wrote: > On 2011-02-15 18:54, 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 > > Re

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

2011-02-15 Thread Jan Kiszka
On 2011-02-15 18:54, 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 > Reported-and-tested-by: "Edgar E. Iglesias" > > diff --git a/cpus.c b/cpus.c >