public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: torvalds@transmeta.com (Linus Torvalds)
To: linux-kernel@vger.kernel.org
Subject: Re: [CHECKER] a couple potential deadlocks in 2.4.5-ac8
Date: 9 Jun 2001 13:37:35 -0700	[thread overview]
Message-ID: <9fu1ef$psh$1@penguin.transmeta.com> (raw)
In-Reply-To: <Pine.LNX.4.21.0106091148380.26187-100000@penguin.transmeta.com> <19317.992115181@redhat.com>

In article <19317.992115181@redhat.com>,
David Woodhouse  <dwmw2@infradead.org> wrote:
>
>Obtaining a read lock twice can deadlock too, can't it?

If it does (with spinlocks), then that's an implementation bug (which
might well be there).  We depend on the read-lock being recursive in a
lot of places, notably the fact that we don't disable interrupts while
holding read-locks if we know that the interrupt routines only take a
read-lock. 

>	A		B
>	read_lock()
>			write_lock()
>			...sleeps...
>	read_lock()
>	...sleeps...
>
>Or do we not make new readers sleep if there's a writer waiting?

The writer-waiter should not be spinning with the write lock held.

Note that the blocking versions are different, and I explicitly meant
only the read-spinlocks, not read-semaphores. For the semaphores I think
your schenario is indeed correct.

		Linus

  reply	other threads:[~2001-06-09 20:38 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-09  7:59 [CHECKER] a couple potential deadlocks in 2.4.5-ac8 Dawson Engler
2001-06-09  8:11 ` checker suggestion Albert D. Cahalan
2001-06-10  2:04   ` Dawson Engler
2001-06-09 10:45 ` [CHECKER] a couple potential deadlocks in 2.4.5-ac8 Alexander Viro
2001-06-09 17:32 ` Linus Torvalds
2001-06-09 17:45   ` Alexander Viro
2001-06-09 19:01     ` Linus Torvalds
2001-06-09 19:33       ` David Woodhouse
2001-06-09 20:37         ` Linus Torvalds [this message]
2001-06-10 11:53         ` Rusty Russell
2001-06-10 11:59           ` David Woodhouse
2001-06-09 19:36       ` Alexander Viro
2001-06-09 20:42         ` Linus Torvalds
2001-06-09 21:44           ` Alexander Viro
2001-06-10  2:28       ` Dawson Engler
2001-06-10  6:19         ` Linus Torvalds
2001-06-10  7:45           ` Dawson Engler

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='9fu1ef$psh$1@penguin.transmeta.com' \
    --to=torvalds@transmeta.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox