All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Jan Beulich <JBeulich@novell.com>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: Re: [PATCH] gntdev: switch back to rwlocks
Date: Fri, 09 Jul 2010 10:57:17 -0700	[thread overview]
Message-ID: <4C3762FD.8050108@goop.org> (raw)
In-Reply-To: <4C3762C4020000780000A8A1@vpn.id2.novell.com>

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

  reply	other threads:[~2010-07-09 17:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-09 14:32 [PATCH] gntdev: switch back to rwlocks Stefano Stabellini
2010-07-09 14:51 ` Jan Beulich
2010-07-09 14:55   ` Stefano Stabellini
2010-07-09 15:56     ` Jan Beulich
2010-07-09 17:57       ` Jeremy Fitzhardinge [this message]
2010-07-12 12:55         ` Stefano Stabellini
2010-07-09 15:04 ` Jeremy Fitzhardinge
2010-07-09 15:12   ` Stefano Stabellini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C3762FD.8050108@goop.org \
    --to=jeremy@goop.org \
    --cc=JBeulich@novell.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.