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