From: "Jan Beulich" <JBeulich@suse.com>
To: "Zhu Yanhai" <zhu.yanhai@gmail.com>
Cc: <x86@kernel.org>, "Thomas Gleixner" <tglx@linutronix.de>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Richard Weinberger" <richard@nod.at>,
"Ingo Molnar" <mingo@redhat.com>, <muming.wq@taobao.com>,
"LKML" <linux-kernel@vger.kernel.org>,
"H. Peter Anvin" <hpa@zytor.com>
Subject: Re: How does spin_unlock() in x86-64 align with the description in Documention/memory-barriers.txt?
Date: Fri, 22 Mar 2013 12:15:09 +0000 [thread overview]
Message-ID: <514C595D02000078000C7BA2@nat28.tlf.novell.com> (raw)
In-Reply-To: <CAC8teKU5H8r+uPqeytWNOsj+g+C0pN8LKdxz3+LzomoWXY6GrA@mail.gmail.com>
>>> On 22.03.13 at 12:58, Zhu Yanhai <zhu.yanhai@gmail.com> wrote:
> Hi all,
> In the documention it reads,
>
> (2) UNLOCK operation implication:
>
> Memory operations issued before the UNLOCK will be completed before the
> UNLOCK operation has completed.
>
> Memory operations issued after the UNLOCK may be completed before the
> UNLOCK operation has completed.
>
> However, on x86-64 __ticket_spin_unlock() merely does,
>
> static __always_inline void __ticket_spin_unlock(raw_spinlock_t *lock)
> {
> asm volatile(
> ALTERNATIVE(UNLOCK_LOCK_PREFIX"incb (%0);"ASM_NOP3,
> UNLOCK_LOCK_ALT_PREFIX"movw $0, (%0)",
> X86_FEATURE_UNFAIR_SPINLOCK)
> :
> : "Q" (&lock->slock)
> : "memory", "cc");
> }
>
> While both UNLOCK_LOCK_PREFIX and UNLOCK_LOCK_ALT_PREFIX are empty
> strings. So how such a function keeps the memory operations issued
> before it completed?
Please read the section "Memory Ordering in P6 and More Recent
Processor Families" in SDM Vol 3.
Jan
prev parent reply other threads:[~2013-03-22 12:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-22 11:58 Zhu Yanhai
2013-03-22 12:15 ` Jan Beulich [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=514C595D02000078000C7BA2@nat28.tlf.novell.com \
--to=jbeulich@suse.com \
--cc=akpm@linux-foundation.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=muming.wq@taobao.com \
--cc=richard@nod.at \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
--cc=zhu.yanhai@gmail.com \
/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®