From: "Jan Beulich" <JBeulich@suse.com>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: <mingo@elte.hu>,
"eric.dumazet@gmail.com" <eric.dumazet@gmail.com>,
<tglx@linutronix.de>, <luca@luca-barbieri.com>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] ix86: atomic64 assembly improvements
Date: Wed, 18 Jan 2012 16:50:49 +0000 [thread overview]
Message-ID: <4F170679020000780006D85B@nat28.tlf.novell.com> (raw)
In-Reply-To: <4F16F505.8040809@zytor.com>
>>> On 18.01.12 at 17:36, "H. Peter Anvin" <hpa@zytor.com> wrote:
> On 01/18/2012 06:24 AM, Jan Beulich wrote:
>> The cmpxchg8b variants of "set" and "xchg" are really identical, and
>> hence don't need to be repeated: %ebx and %ecx don't need to be copied
>> into %eax and %edx respectively (this is only necessary when desiring
>> to only read the stored value), and the LOCK prefix should also be used
>> in "set" (other than the comment that is now being removed was saying,
>> there is - to my knowledge - no *architectural* guarantee that aligned
>> 64-bit writes would always be carried out atomically).
>
> EWHAT?
>
> It's atomic in the same way a MOV is atomic.
Then please point me to where this is documented.
As I understand it, there is nothing keeping the CPU (or something
down the bus) from executing the unlocked version as two 32-bit
reads followed by two 32-bit writes.
> The CPU could, in fact, execute the locked version at all if the
> unlocked version didn't behave like that.
Assuming you meant "could not", that's not true: As long as the
external world has a way to know that both items are locked (think
of the old bus lock mechanism when there were no caches yet),
it can very well do so.
I do not question that in practice all CPUs behave as described,
but without an architectural guarantee (and with the code in
question not being used in hot paths afaik) I see no reason why
it should depend on undefined behavior.
Jan
> Unless you have a specific instance where you think this might be
> violated, please let me know.
>
> -hpa
>
> --
> H. Peter Anvin, Intel Open Source Technology Center
> I work for Intel. I don't speak on their behalf.
next prev parent reply other threads:[~2012-01-18 16:50 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-18 14:24 Jan Beulich
2012-01-18 16:36 ` H. Peter Anvin
2012-01-18 16:50 ` Jan Beulich [this message]
2012-01-18 17:47 ` H. Peter Anvin
2012-01-19 9:18 ` Jan Beulich
2012-01-19 14:44 ` H. Peter Anvin
2012-01-19 14:50 ` Jan Beulich
2012-01-19 14:55 ` H. Peter Anvin
2012-01-19 14:59 ` H. Peter Anvin
2012-01-19 15:11 ` Jan Beulich
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=4F170679020000780006D85B@nat28.tlf.novell.com \
--to=jbeulich@suse.com \
--cc=eric.dumazet@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luca@luca-barbieri.com \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
/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
all inboxes | Powered by JetHome®