From: Pavel Machek <pavel@ucw.cz>
To: David Howells <dhowells@redhat.com>
Cc: torvalds@osdl.org, akpm@osdl.org, mingo@redhat.com,
linux-arch@vger.kernel.org, linuxppc64-dev@ozlabs.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Document Linux's memory barriers
Date: Wed, 8 Mar 2006 17:18:29 +0100 [thread overview]
Message-ID: <20060308161829.GC3669@elf.ucw.cz> (raw)
In-Reply-To: <31492.1141753245@warthog.cambridge.redhat.com>
Hi!
> +There are some more advanced barriering functions:
> +
> + (*) set_mb(var, value)
> + (*) set_wmb(var, value)
> +
> + These assign the value to the variable and then insert at least a write
> + barrier after it, depending on the function.
> +
I... don't understand what these do. Better explanation would
help.. .what is function?
Does it try to say that set_mb(var, value) is equivalent to var =
value; mb(); but here mb() affects that one variable, only?
> +In all cases there are variants on a LOCK operation and an UNLOCK operation.
> +
> + (*) LOCK operation implication:
> +
> + Memory accesses issued after the LOCK will be completed after the LOCK
> + accesses have completed.
"LOCK access"? Does it try to say that ...will be completed after any
access inside lock region is completed?
("LOCK" looks very much like well-known i386 prefix. Calling it
*_lock() or something would avoid that confusion. Fortunately there's
no UNLOCK instruction :-)
> + (*) UNLOCK operation implication:
> +
> + Memory accesses issued before the UNLOCK will be completed before the
> + UNLOCK accesses have completed.
> +
> + Memory accesses issued after the UNLOCK may be completed before the UNLOCK
> + accesses have completed.
> +
> + (*) LOCK vs UNLOCK implication:
> +
> + The LOCK accesses will be completed before the unlock accesses.
~~~~~~
capital? Or
lower it everywhere?
> +==============================
> +I386 AND X86_64 SPECIFIC NOTES
> +==============================
> +
> +Earlier i386 CPUs (pre-Pentium-III) are fully ordered - the operations on the
> +bus appear in program order - and so there's no requirement for any sort of
> +explicit memory barriers.
> +
> +From the Pentium-III onwards were three new memory barrier instructions:
> +LFENCE, SFENCE and MFENCE which correspond to the kernel memory barrier
> +functions rmb(), wmb() and mb(). However, there are additional implicit memory
> +barriers in the CPU implementation:
> +
> + (*) Normal writes imply a semi-rmb(): reads before a write may not complete
> + after that write, but reads after a write may complete before the write
> + (ie: reads may go _ahead_ of writes).
This makes it sound like pentium-III+ is incompatible with previous
CPUs. Is it really the case?
Pavel
--
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
next prev parent reply other threads:[~2006-03-08 19:43 UTC|newest]
Thread overview: 107+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-07 17:40 [PATCH] Document Linux's memory barriers David Howells
2006-03-07 10:34 ` Andi Kleen
2006-03-07 18:30 ` David Howells
2006-03-07 11:13 ` Andi Kleen
2006-03-07 19:24 ` David Howells
2006-03-07 19:46 ` Stephen Hemminger
2006-03-07 18:46 ` Jesse Barnes
2006-03-07 19:23 ` Bryan O'Sullivan
2006-03-07 11:57 ` Andi Kleen
2006-03-07 20:01 ` Jesse Barnes
2006-03-07 21:14 ` Bryan O'Sullivan
2006-03-07 21:24 ` Andi Kleen
2006-03-08 0:36 ` Alan Cox
2006-03-08 0:35 ` Alan Cox
2006-03-07 17:47 ` Stephen Hemminger
2006-03-07 18:40 ` Alan Cox
2006-03-07 18:54 ` linux-os (Dick Johnson)
2006-03-07 18:54 ` linux-os (Dick Johnson)
2006-03-07 19:06 ` Matthew Wilcox
2006-03-07 19:15 ` linux-os (Dick Johnson)
2006-03-07 19:15 ` linux-os (Dick Johnson)
2006-03-09 11:26 ` Sergei Organov
2006-03-07 19:33 ` Alan Cox
2006-03-07 20:09 ` David Howells
2006-03-08 0:32 ` Alan Cox
2006-03-08 8:25 ` Duncan Sands
2006-03-08 22:06 ` Paul Mackerras
2006-03-08 22:24 ` David S. Miller
2006-03-08 22:31 ` Linus Torvalds
2006-03-08 22:42 ` Alan Cox
2006-03-08 2:07 ` Nick Piggin
2006-03-08 3:10 ` Paul Mackerras
2006-03-08 3:30 ` Linus Torvalds
2006-03-08 12:34 ` David Howells
2006-03-08 16:40 ` Bryan O'Sullivan
2006-03-08 7:41 ` Nick Piggin
2006-03-08 13:19 ` David Howells
2006-03-08 21:49 ` Paul Mackerras
2006-03-08 22:05 ` Alan Cox
2006-03-10 0:49 ` H. Peter Anvin
2006-03-08 14:37 ` [PATCH] Document Linux's memory barriers [try #2] David Howells
2006-03-08 14:55 ` Alan Cox
2006-03-08 15:41 ` Matthew Wilcox
2006-03-08 17:19 ` David Howells
2006-03-08 22:10 ` Paul Mackerras
2006-03-08 23:08 ` Ivan Kokshaysky
2006-03-09 1:01 ` Paul Mackerras
2006-03-09 16:02 ` Ivan Kokshaysky
2006-03-08 17:04 ` David Howells
2006-03-08 17:36 ` Alan Cox
2006-03-08 18:35 ` David Howells
2006-03-08 18:45 ` Alan Cox
2006-03-08 18:59 ` David Howells
2006-03-08 11:38 ` Andi Kleen
2006-03-08 19:08 ` David Howells
2006-03-08 19:26 ` Linus Torvalds
2006-03-08 19:31 ` David Howells
2006-03-09 0:35 ` Paul Mackerras
2006-03-09 0:54 ` Linus Torvalds
2006-03-09 1:08 ` Paul Mackerras
2006-03-09 1:27 ` Linus Torvalds
2006-03-09 2:38 ` Nick Piggin
2006-03-09 3:45 ` Paul Mackerras
2006-03-09 4:36 ` Jesse Barnes
2006-03-09 7:41 ` Paul Mackerras
2006-03-09 5:38 ` Linus Torvalds
2006-03-09 12:27 ` David Howells
2006-03-09 11:44 ` Michael Buesch
2006-03-09 4:34 ` Jesse Barnes
2006-03-09 4:43 ` Paul Mackerras
2006-03-09 10:05 ` Jes Sorensen
2006-03-09 0:55 ` Jesse Barnes
2006-03-09 1:57 ` Paul Mackerras
2006-03-09 4:26 ` Jesse Barnes
2006-03-08 19:40 ` Matthew Wilcox
2006-03-09 0:37 ` Paul Mackerras
2006-03-09 0:59 ` Jesse Barnes
2006-03-09 1:36 ` Paul Mackerras
2006-03-09 4:18 ` Jesse Barnes
2006-03-08 19:54 ` Jesse Barnes
2006-03-08 20:02 ` Alan Cox
2006-03-08 22:01 ` Paul Mackerras
2006-03-08 22:23 ` David S. Miller
2006-03-08 19:37 ` [PATCH] Document Linux's memory barriers [try #3] David Howells
2006-03-09 14:01 ` David Howells
2006-03-09 12:02 ` [PATCH] Document Linux's memory barriers [try #2] Sergei Organov
2006-03-08 16:18 ` Pavel Machek [this message]
2006-03-08 20:16 ` [PATCH] Document Linux's memory barriers David Howells
2006-03-08 22:01 ` Alan Cox
2006-03-09 11:41 ` David Howells
2006-03-09 12:28 ` Alan Cox
2006-03-09 13:02 ` David Howells
2006-03-09 16:32 ` Linus Torvalds
2006-03-09 17:39 ` David Howells
2006-03-09 17:54 ` Linus Torvalds
2006-03-09 17:56 ` Linus Torvalds
2006-03-08 16:26 ` Christoph Lameter
2006-03-08 17:35 ` David Howells
2006-03-08 17:46 ` Christoph Lameter
2006-03-08 17:59 ` Alan Cox
-- strict thread matches above, loose matches on Subject: below --
2006-03-07 23:17 Chuck Ebbert
2006-03-08 0:15 ` David S. Miller
2006-03-08 0:24 ` Roberto Nibali
[not found] <5NONi-2hp-3@gated-at.bofh.it>
[not found] ` <5NOtZ-1FO-27@gated-at.bofh.it>
[not found] ` <5NPgs-2Rw-37@gated-at.bofh.it>
[not found] ` <5NPq4-34a-23@gated-at.bofh.it>
2006-03-08 0:22 ` Robert Hancock
[not found] ` <5NQ2U-462-29@gated-at.bofh.it>
[not found] ` <5NRLg-6LJ-31@gated-at.bofh.it>
[not found] ` <5NRUR-6Yo-11@gated-at.bofh.it>
[not found] ` <5NUSF-30Z-5@gated-at.bofh.it>
2006-03-08 1:10 ` Robert Hancock
2006-03-08 11:35 ` Alan Cox
2006-03-08 14:55 ` Andi Kleen
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=20060308161829.GC3669@elf.ucw.cz \
--to=pavel@ucw.cz \
--cc=akpm@osdl.org \
--cc=dhowells@redhat.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc64-dev@ozlabs.org \
--cc=mingo@redhat.com \
--cc=torvalds@osdl.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.