From: "Jan Beulich" <JBeulich@suse.com>
To: "Christoph Lameter" <cl@linux.com>
Cc: <a.p.zijlstra@chello.nl>, "Ingo Molnar" <mingo@elte.hu>,
"Thomas Gleixner" <tglx@linutronix.de>,
<akpm@linux-foundation.org>, <torvalds@linux-foundation.org>,
<dhowells@redhat.com>, <mingo@redhat.com>,
<linux-kernel@vger.kernel.org>,
<linux-tip-commits@vger.kernel.org>, <hpa@zytor.com>
Subject: Re: [tip:x86/asm] x86: Fix and improve percpu_cmpxchg{8,16}b_double()
Date: Fri, 16 Dec 2011 08:48:38 +0000 [thread overview]
Message-ID: <4EEB13F602000078000686D7@nat28.tlf.novell.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1112151627060.11871@router.home>
>>> On 15.12.11 at 23:52, Christoph Lameter <cl@linux.com> wrote:
> On Thu, 15 Dec 2011, tip-bot for Jan Beulich wrote:
>> The __dummy variable was pointless (and needlessly initialized
>> in the 2x32-bit case), given that local copies of the inputs
>> already exist.
>
> Hmm... I had some failures if I did not specify that dummy in the
> inline asm. Does this work for all gcc versions?
You need to have the output go somewhere, but using the already
existing __o2 for this purpose is possible and sufficient.
>> The 2x64-bit variant forced the address of the first object into
>> %rsi, even though this is needed only for the call to the
>> emulation function. The real cmpxchg16b can operate on an
>> memory.
>
> Yup. Good idea to code the load into the alternative code path to avoid
> the cmpxchg of the primary code path to be restricted to %si register.
>
> You dropped the padding with NOPs. Are the instructions on both paths
> always the same length?
leaq and cmpxchg16b use the same operand, so their modrm
encoding (including eventual SIB and immediate) are the same.
leaq is REX+opcode+modrm...
cmpxchg16b (SEG+)REX+0x0f+opcode+modrm
so the latter is two bytes longer than the former (one byte in UP).
call being five bytes vs setz %al being 3 bytes makes it that
lea+call are one byte longer than cmpxchg16b+setz in the UP case,
but I think this is tolerable. If not, the operand of lea could be
made %rip-relative for the case where the operand is a direct
access (i.e. become %1 instead of %P1).
Jan
next prev parent reply other threads:[~2011-12-16 8:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-14 8:33 [PATCH] x86: fix " Jan Beulich
2011-12-15 9:55 ` [tip:x86/asm] x86: Fix " tip-bot for Jan Beulich
2011-12-15 22:52 ` Christoph Lameter
2011-12-16 8:48 ` Jan Beulich [this message]
2011-12-16 15:39 ` [PATCH] x86: fix " H. Peter Anvin
2011-12-18 8:43 ` Ingo Molnar
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=4EEB13F602000078000686D7@nat28.tlf.novell.com \
--to=jbeulich@suse.com \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=cl@linux.com \
--cc=dhowells@redhat.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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
all inboxes | Powered by JetHome®