WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

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

To: Jan Beulich <JBeulich@xxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] gntdev: switch back to rwlocks
From: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
Date: Fri, 09 Jul 2010 10:57:17 -0700
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Delivery-date: Fri, 09 Jul 2010 10:58:25 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4C3762C4020000780000A8A1@xxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <alpine.DEB.2.00.1007091527520.21432@kaball-desktop> <4C375376020000780000A827@xxxxxxxxxxxxxxxxxx> <alpine.DEB.2.00.1007091552460.21432@kaball-desktop> <4C3762C4020000780000A8A1@xxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100621 Fedora/3.0.5-1.fc13 Lightning/1.0b2pre Thunderbird/3.0.5
On 07/09/2010 08:56 AM, Jan Beulich wrote:
>>> 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.
>   

Yes, relying on this kind of behaviour from rwlocks doesn't pass the
smell test.  rwlocks are just a performance optimisation for particular
locking patterns; it should always be safe to implement them as plain
spinlocks (or convert them into spinlocks).

I think removing the notifier calls from apply_to_page_range fixes the
root of the problem.

    J

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