All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <matthew@wil.cx>
To: Andrew Morton <akpm@osdl.org>
Cc: Hirokazu Takata <takata.hirokazu@renesas.com>,
	Hirokazu Takata <takata@linux-m32r.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] m32r: Revise __raw_read_trylock()
Date: Tue, 26 Sep 2006 16:29:58 -0600	[thread overview]
Message-ID: <20060926222958.GN5017@parisc-linux.org> (raw)
In-Reply-To: <20060926143344.f036aa76.akpm@osdl.org>

On Tue, Sep 26, 2006 at 02:33:44PM -0700, Andrew Morton wrote:
> We don't have a changelog for this patch.  My usual technique when this
> happens is to mutter something unprintable then go on a hunt through the
> mailing list archives.
> 
> But all I have is "Matthew Wilcox pointed out that
> generic__raw_read_trylock() is unfit for use.".
> 
> What's wrong with it?

I pointed it out on linux-arch a couple of weeks ago.  Ever look at the
generic__raw_read_trylock implementation?

$ git-diff linus spinlock.c 
diff --git a/kernel/spinlock.c b/kernel/spinlock.c
index fb524b0..6fc4c92 100644
--- a/kernel/spinlock.c
+++ b/kernel/spinlock.c
@@ -16,17 +16,6 @@ #include <linux/interrupt.h>
 #include <linux/debug_locks.h>
 #include <linux/module.h>
 
-/*
- * Generic declaration of the raw read_trylock() function,
- * architectures are supposed to optimize this:
- */
-int __lockfunc generic__raw_read_trylock(raw_rwlock_t *lock)
-{
-       __raw_read_lock(lock);
-       return 1;
-}
-EXPORT_SYMBOL(generic__raw_read_trylock);
-

If the cpu has the lock held for write, is interrupted, and the interrupt
handler calls read_trylock(), it's an instant deadlock.

Now, Dave Miller has subsequently pointed out that we don't have any
situations where this can occur.  Nevertheless, we should delete
generic__raw_read_lock (and its associated EXPORT to make Arjan happy)
so that nobody thinks they can use it.

      reply	other threads:[~2006-09-26 22:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-22  6:29 [PATCH] m32r: Revise __raw_read_trylock() Hirokazu Takata
2006-09-22  7:48 ` Paul Mundt
2006-09-22 11:27   ` Matthew Wilcox
2006-09-25  6:09     ` Paul Mundt
2006-09-24  6:20 ` Matthew Wilcox
2006-09-25  7:47   ` Hirokazu Takata
2006-09-26 21:33     ` Andrew Morton
2006-09-26 22:29       ` Matthew Wilcox [this message]

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=20060926222958.GN5017@parisc-linux.org \
    --to=matthew@wil.cx \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=takata.hirokazu@renesas.com \
    --cc=takata@linux-m32r.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 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.