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

Re: [Xen-devel] [PATCH] gntdev: switch back to rwlocks



>>> On 09.07.10 at 16:55, Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx> 
>>> wrote:
> On Fri, 9 Jul 2010, Jan Beulich wrote:
>> >>> On 09.07.10 at 16:32, Stefano Stabellini 
>> >>> <stefano.stabellini@xxxxxxxxxxxxx> wrote:
>> > Hi Jeremy,
>> > this patch switches back from spinlocks to rwlocks in gntdev, solving
>> > the locking issue that was preventing stubdoms from working.
>> > In particular the problem is that gntdev_mmap calls apply_to_page_range
>> > after acquiring the spinlock. apply_to_page_range causes the mmu
>> > notifiers to be called, so mn_invl_range_start will be called that will
>> > try to acquire again the same spinlock.
>> 
>> Shouldn't this be solved in a way not depending on an implementation
>> detail (rw-locks being unfair in that readers can lock out writers
>> indefinitely)? Is it even certain that all arch-es implement rw-locks
>> in a manner compatible with this?
> 
> any rwlock implementations that allow multiple readers will do: both
> mn_invl_range_start and gntdev_mmap only require a read lock.

No - if an implementation forces further readers to spin once a
writer started its attempt to acquire a lock, the code after your
change still has the potential to deadlock afaict.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.