All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: David Woodhouse <dwmw2@infradead.org>
Cc: Linus Torvalds <torvalds@transmeta.com>,
	Alexander Viro <viro@math.psu.edu>,
	linux-kernel@vger.kernel.org,
	Dawson Engler <engler@csl.Stanford.EDU>
Subject: Re: [CHECKER] a couple potential deadlocks in 2.4.5-ac8
Date: Sun, 10 Jun 2001 21:53:24 +1000	[thread overview]
Message-ID: <m1593mW-001RQEC@mozart> (raw)
In-Reply-To: Your message of "Sat, 09 Jun 2001 20:33:01 +0100." <19317.992115181@redhat.com>

In message <19317.992115181@redhat.com> you write:
> 
> torvalds@transmeta.com said:
> >  Good point. Spinlocks (with the exception of read-read locks, of
> > course) and semaphores will deadlock on recursive use, while the BKL
> > has this "process usage counter" recursion protection.
> 
> Obtaining a read lock twice can deadlock too, can't it?
> 
> 	A		B
> 	read_lock()
> 			write_lock()
> 			...sleeps...
> 	read_lock()
> 	...sleeps...
> 
> Or do we not make new readers sleep if there's a writer waiting?

We can never[1] make new readers sleep if there's a writer waiting, as
Linus guaranteed that an IRQ handler which only ever grabs a read lock
means the rest of the code doesn't need to block interrupts on its
read locks (see Documentation/spinlock.txt IIRC).

Also, netfilter will break (brlocks inherit this property from
their spinlocks constituents).

Rusty.
[1] Well, we could, but we'd have to do a special "same CPU?" check,
    which would suck badly.
--
Premature optmztion is rt of all evl. --DK

  parent reply	other threads:[~2001-06-10 11:52 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
2001-06-10 11:53         ` Rusty Russell [this message]
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=m1593mW-001RQEC@mozart \
    --to=rusty@rustcorp.com.au \
    --cc=dwmw2@infradead.org \
    --cc=engler@csl.Stanford.EDU \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    --cc=viro@math.psu.edu \
    /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.