From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47905) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V5CAo-00031D-Gg for qemu-devel@nongnu.org; Fri, 02 Aug 2013 06:01:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V5CAi-0000oT-G4 for qemu-devel@nongnu.org; Fri, 02 Aug 2013 06:01:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:64378) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V5CAi-0000oC-7W for qemu-devel@nongnu.org; Fri, 02 Aug 2013 06:01:20 -0400 Date: Fri, 2 Aug 2013 12:01:02 +0200 From: Paolo Bonzini Message-ID: <20130802100101.GD5103@mail.corp.redhat.com> References: <51F78491.708@redhat.com> <391717867.8023244.1375347472193.JavaMail.root@redhat.com> <753B6C66578E71C12F9DFD2A@Ximines.local> <1277844563.8104892.1375359574399.JavaMail.root@redhat.com> <97E9EFDF2EC4B9CE77638619@Ximines.local> <20130801135111.GL5245@mail.corp.redhat.com> <20130801142844.GB5761@mail.corp.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [RFC v2 3/5] timer: make qemu_clock_enable sync between disable and timer's cb List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: liu ping fan Cc: Kevin Wolf , Stefan Hajnoczi , Alex Bligh , Jan Kiszka , qemu-devel@nongnu.org, Anthony Liguori On Aug 02 2013, liu ping fan wrote: > On Thu, Aug 1, 2013 at 10:28 PM, Paolo Bonzini wrote: > > > > > > So actually there is another problem with this patch (both the > > > > > > condvar and the event approach are equally buggy). If a timer > > > > > > on clock X disables clock X, qemu_clock_enable will deadlock. > > > > Checking the code for callers of qemu_clock_enable() it seems like there > > shouldn't be any deadlocks. So it should work if qemu_clock_enable > > Do you mean the caller of qemu_clock_enable(foo,false) can NOT be > timer cb? Yes. > As for this deadlock issue, making > qemu_clock_enable(foo,false) ASYNC, and forcing the caller to sync > explicitly ? Right now the callers of qemu_clock_enable(foo, false) are safe. So the problem can be "fixed" just by adequate documentation. > > But we should document the expectations since they are different from > > the current code. > > > > Paolo