From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32944) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V9aFb-00014a-Vv for qemu-devel@nongnu.org; Wed, 14 Aug 2013 08:32:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V9aFU-0003VL-LP for qemu-devel@nongnu.org; Wed, 14 Aug 2013 08:32:31 -0400 Received: from goliath.siemens.de ([192.35.17.28]:27586) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V9aFU-0003Ut-BX for qemu-devel@nongnu.org; Wed, 14 Aug 2013 08:32:24 -0400 Message-ID: <520B78C9.1010306@siemens.com> Date: Wed, 14 Aug 2013 14:32:09 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <5209E6A1.6060308@siemens.com> <20130813134559.GA29990@stefanha-thinkpad.redhat.com> <520A3EEF.5050509@siemens.com> In-Reply-To: <520A3EEF.5050509@siemens.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] Using aio_poll for timer carrier threads List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Kevin Wolf , Anthony Liguori , Stefan Hajnoczi , qemu-devel , liu ping fan , Alex Bligh , Paolo Bonzini , MORITA Kazutaka , Richard Henderson On 2013-08-13 16:13, Jan Kiszka wrote: > On 2013-08-13 15:45, Stefan Hajnoczi wrote: >> This should make timers usable in another thread for clock device >> emulation if only your iothread uses the AioContext and its timers >> (besides the thread-safe mod/del interfaces). > > As argued in the other thread, I don't think we need (and want) locking > in the timer subsystem, rather push this to its users. But I'll look > again at your patches, if they are also usable. I've checked and applied your two patches adding the active_timers lock. This model apparently works as well for the RTC use case. And it avoids having to patch aio_poll, the RTC device lock is now taken inside the timer handlers. I still need to check more corner cases as timer dequeuing can now race with the handler execution, ie. a dequeued timer can still see one more handler run after timer_del returned. That's a property one can easily take into account when writing device models, but it has to be kept in mind that it's different from current behavior. Updated queue is at git://git.kiszka.org/qemu.git queues/rt.new3 again. Jan -- Siemens AG, Corporate Technology, CT RTC ITP SES-DE Corporate Competence Center Embedded Linux