From: Zoltan Menyhart <Zoltan.Menyhart@bull.net>
To: Christoph Lameter <clameter@sgi.com>
Cc: "'Nick Piggin'" <nickpiggin@yahoo.com.au>,
Zoltan Menyhart <Zoltan.Menyhart@free.fr>,
"Chen, Kenneth W" <kenneth.w.chen@intel.com>,
akpm@osdl.org, linux-kernel@vger.kernel.org,
linux-ia64@vger.kernel.org
Subject: Re: Fix unlock_buffer() to work the same way as bit_unlock()
Date: Wed, 29 Mar 2006 12:57:17 +0200 [thread overview]
Message-ID: <442A680D.5050705@bull.net> (raw)
In-Reply-To: <Pine.LNX.4.64.0603281537500.15037@schroedinger.engr.sgi.com>
Christoph Lameter wrote:
> On Tue, 28 Mar 2006, Zoltan Menyhart wrote:
>
>
>>Why not to use separate bit operations for different purposes?
>>
>>- e.g. "test_and_set_bit_N_acquire()" for lock acquisition
>>- "test_and_set_bit()", "clear_bit()" as they are today
>>- "release_N_clear_bit()"...
>>
>
>
> That would force IA64 specifics onto all other architectures.
>
> Could we simply define these smb_mb__*_clear_bit to be noops
> and then make the atomic bit ops to have full barriers? That would satisfy
> Nick's objections.
I do not want to force IA64 specifics...
I think the lock - unlock are as they are because of some historical reasons.
IA64 only helps me to see what is really necessary for the lock
implementation and what is just a heritage of the PCs.
I try to summarize my thoughts about the locks in an architecture
independent way. If we can agree upon how it should work, then we can
enter into the details later :-)
1. lock():
The lock acquisition semantics guarantees that the lock is acquired by
its new owner and the new ownership is made globally visible prior to all
subsequent orderable instructions (issued by the new owner) becoming
visible to the others.
Example:
|
v
|
store_X ----------+
| |
v |
| |
======== lock ====+=======
| | ^ ^
v v ^ ^
| | |
load_Y ---------------+ |
store_Z ----------------+
|
v
|
Note that "store_X" is not guaranteed to be globally performed before
the lock.
2. unlock():
The lock release semantics guarantees that all previous orderable
instructions (issued by the lock owner) are made globally visible prior
to make visible to the others the lock becoming free.
Example:
|
v
|
store_A ----------+
| |
v v ^
| v |
======= unlock =======+===
| |
v |
| |
load_B ---------------+
|
v
|
Note that "load_B" can be globally performed before the unlock.
The mutual exclusion means:
- "store_A" is before unlocking
- unlocking is before locking by the next owner
- locking is before "load_Y" or "store_Z"
therefore "store_A" is before "load_Y" or "store_Z".
No relation is defined between "store_X" and any other operation,
nor is between "load_B" and any other operation.
Can we agree that locking and unlocking mean no more than what I
described, especially, they do not imply bidirectional fencing?
Should someone need a bidirectional fencing, s/he would have to
use some additional shync. methods.
In order to separate the theory (how is should work) and the practice
(how is should be implemented), I put the bit-op stuff in another
mail.
Thanks.
Zoltan
next prev parent reply other threads:[~2006-03-29 10:57 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-28 3:59 Fix unlock_buffer() to work the same way as bit_unlock() Christoph Lameter
2006-03-28 8:10 ` Nick Piggin
2006-03-28 18:53 ` Chen, Kenneth W
2006-03-28 21:42 ` Zoltan Menyhart
2006-03-28 23:48 ` Christoph Lameter
2006-03-29 0:07 ` Nick Piggin
2006-03-29 2:23 ` Christoph Lameter
2006-03-29 2:35 ` Nick Piggin
2006-03-29 6:46 ` Chen, Kenneth W
2006-03-29 7:11 ` Christoph Lameter
2006-03-30 1:34 ` Nick Piggin
2006-03-29 0:12 ` Chen, Kenneth W
2006-03-29 0:27 ` Chen, Kenneth W
2006-03-29 0:47 ` Christoph Lameter
2006-03-29 1:39 ` Chen, Kenneth W
2006-03-29 12:16 ` Zoltan Menyhart
2006-03-30 1:56 ` Nick Piggin
2006-03-29 10:57 ` Zoltan Menyhart [this message]
2006-03-29 6:50 ` Chen, Kenneth W
2006-03-30 1:36 ` Nick Piggin
[not found] ` <442AA13B.3050104@bull.net>
2006-03-30 1:57 ` Nick Piggin
-- strict thread matches above, loose matches on Subject: below --
2006-03-29 18:33 Boehm, Hans
2006-03-29 19:11 ` Grant Grundler
2006-03-29 19:31 Boehm, Hans
2006-03-29 22:17 ` Christoph Lameter
2006-03-29 22:56 Boehm, Hans
2006-03-29 23:33 ` Christoph Lameter
2006-03-29 23:49 ` Chen, Kenneth W
2006-03-29 23:50 ` Christoph Lameter
2006-03-29 23:50 ` Grant Grundler
2006-03-30 8:43 ` Zoltan Menyhart
2006-03-30 8:55 ` Nick Piggin
2006-03-30 19:11 ` Christoph Lameter
2006-03-30 17:17 ` Christoph Lameter
2006-03-30 17:57 Boehm, Hans
2006-03-30 18:17 ` Christoph Lameter
2006-03-30 22:26 Boehm, Hans
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=442A680D.5050705@bull.net \
--to=zoltan.menyhart@bull.net \
--cc=Zoltan.Menyhart@free.fr \
--cc=akpm@osdl.org \
--cc=clameter@sgi.com \
--cc=kenneth.w.chen@intel.com \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nickpiggin@yahoo.com.au \
/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