qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [big lock] Discussion about the convention of device's


From: Avi Kivity
Subject: Re: [Qemu-devel] [big lock] Discussion about the convention of device's DMA each other after breaking down biglock
Date: Wed, 19 Sep 2012 13:27:26 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120828 Thunderbird/15.0

On 09/19/2012 01:19 PM, Paolo Bonzini wrote:
> Il 19/09/2012 12:06, Avi Kivity ha scritto:
>>> > (The hunch is that ts could be deleted exactly at the moment the
>>> > callback is unlocked.  This can be solved with ref/unref on the opaque
>>> > value, as you mention below).
>> Are you saying that this works as is or not?  It does seem broken wrt
>> deletion; after qemu_del_timer() completes the caller expects the
>> callback not to be called.
> 
> Ouch, then I think the only solution is to remove this invariant if you
> add fine-grained locking and re-check the enable conditions in the timer
> callback.

I think so too, I know authors of GUI frameworks suffer from this
problem (the GUI calling into the framework vs. the framework asking the
GUI to repaint).  Don't know what the state of the art solution is.

> 
> If you allow calling del_timer to be called with the device lock held,
> you cannot fixing without deadlocking.  If you don't, the caller of
> del_timer cannot set any expectation because the timer could be run in
> the window between dropping the device lock and calling del_timer
> 

Right.  Callbacks should check qemu_timer_deleted() after taking their
little lock.  The reference held by the timer subsystem protects against
qemu_free_timer().

-- 
error compiling committee.c: too many arguments to function



reply via email to

[Prev in Thread] Current Thread [Next in Thread]