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: Paolo Bonzini
Subject: Re: [Qemu-devel] [big lock] Discussion about the convention of device's DMA each other after breaking down biglock
Date: Thu, 20 Sep 2012 10:27:17 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120828 Thunderbird/15.0

Il 20/09/2012 10:09, liu ping fan ha scritto:
> >
> > No, MMIO dispatch has to discard the fine-grained lock before acquiring
> > the big lock.
>
> This will cause the device state broken, and expose device under changing 
> risk.

We do it all the time with asynchronous I/O.

It's just an invariant that fine-grain-locked devices have to obey.  You
cannot keep the same semantics you enjoyed when a single lock covered
everything.

> > If you allow
> >
> >   lock(fine)
> >   lock(coarse)
> >
> > then the (presumably higher-priority) thread that is requesting the
> > fine-grained lock must wait for the lower-priority thread that holds the
> > coarse-grained lock.  Then you get priority inversion.
>
> Which thread has higher-priority? Why does the thread with coarse lock
> have lower-priority?

Because there can be so many things happening under the coarse lock,
that just _assuming_ it has lower priority is a good thing.

On the other hand, if the device didn't need immediate servicing (which
means higher priority), you wouldn't bother taking it out of the big
QEMU lock.

Paolo



reply via email to

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