From: Matthew Wilcox <matthew@wil.cx>
To: Paul Mundt <lethal@linux-sh.org>
Cc: Hirokazu Takata <takata@linux-m32r.org>,
Andrew Morton <akpm@osdl.org>,
linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org
Subject: Re: [PATCH] m32r: Revise __raw_read_trylock()
Date: Fri, 22 Sep 2006 05:27:08 -0600 [thread overview]
Message-ID: <20060922112708.GR2585@parisc-linux.org> (raw)
In-Reply-To: <20060922074813.GA20921@localhost.Internal.Linux-SH.ORG>
On Fri, Sep 22, 2006 at 04:48:13PM +0900, Paul Mundt wrote:
> This might be a stupid question, but why exactly are we ripping out
> generic__raw_read_trylock() if architectures are going to implement a
> generic implementation anyways, rather than just changing it to match
> the proper semantics?
Because there is no generic definition of struct spinlock.
> int __lockfunc generic__raw_read_trylock(raw_rwlock_t *lock)
> {
> - __raw_read_lock(lock);
> - return 1;
> + atomic_t *count = (atomic_t *)lock;
> + atomic_dec(count);
> + if (atomic_read(count) >= 0)
> + return 1;
> + atomic_inc(count);
> + return 0;
> }
You're assuming:
- a spinlock is an atomic_t.
- Said atomic_t uses RW_LOCK_BIAS to indicate locked/unlocked.
This is true for m32r, but not for sparc. SuperH looks completely
broken -- I don't see how holding a read lock prevents someone else from
getting a write lock. The SH write_trylock uses RW_LOCK_BIAS, but
write_lock doesn't. Are there any SMP SH machines?
next prev parent reply other threads:[~2006-09-22 11:27 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 [this message]
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
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=20060922112708.GR2585@parisc-linux.org \
--to=matthew@wil.cx \
--cc=akpm@osdl.org \
--cc=lethal@linux-sh.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox