Netdev List
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: "David Laight" <David.Laight@ACULAB.COM>,
	"Eric Dumazet" <eric.dumazet@gmail.com>
Cc: <mingo@elte.hu>, <tglx@linutronix.de>,
	"Christoph Lameter" <cl@linux.com>,
	<linux-kernel@vger.kernel.org>, "netdev" <netdev@vger.kernel.org>,
	<hpa@zytor.com>
Subject: RE: [PATCH] x86: fix and improve cmpxchg_double{,_local}()
Date: Wed, 04 Jan 2012 10:54:22 +0000	[thread overview]
Message-ID: <4F043DEE020000780006A575@nat28.tlf.novell.com> (raw)
In-Reply-To: <AE90C24D6B3A694183C094C60CF0A2F6D8AF2A@saturn3.aculab.com>

 >>> On 04.01.12 at 11:36, "David Laight" <David.Laight@ACULAB.COM> wrote:

>> BTW atomic64_set() asm() contraints are wrong :
>> 
>> static inline void atomic64_set(atomic64_t *v, long long i)
>> {
>>         unsigned high = (unsigned)(i >> 32);
>>         unsigned low = (unsigned)i;
>>         asm volatile(ATOMIC64_ALTERNATIVE(set)
>>                      : "+b" (low), "+c" (high)
>>                      : "S" (v)
>>                      : "eax", "edx", "memory"
>>                      );
>> }
>> 
>> 
>> ebx/ecx registers are not modified by cmpxchg8b (or the 
>> atomic64_set_386 emulation). Only eax/edx can be modified.

Same would be true for atomic64_xchg() and the use of "+c" (v)
in subsequent functions (whether unnecessarily strict or too lax
varies).

> Isn't it also possible to constrain the "memory"
> constraint to only apply to '*v' not all of memory?
> I can't remember the syntax off hand though...

Absolutely - "=m" (v->counter) would be the right way to specify
this.

Jan

      reply	other threads:[~2012-01-04 10:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4F01F12A020000780006A19B@nat28.tlf.novell.com>
2012-01-03 15:00 ` [PATCH] x86: fix and improve cmpxchg_double{,_local}() Eric Dumazet
2012-01-03 15:15   ` Eric Dumazet
2012-01-03 15:41     ` Eric Dumazet
2012-01-03 16:08       ` Jan Beulich
2012-01-03 16:13         ` Eric Dumazet
2012-01-03 16:35           ` [PATCH] x86: fix atomic64_xxx_cx8() functions Eric Dumazet
2012-01-03 15:35   ` [PATCH] x86: fix and improve cmpxchg_double{,_local}() Jan Beulich
2012-01-03 17:31     ` Eric Dumazet
2012-01-04 10:36       ` David Laight
2012-01-04 10:54         ` 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=4F043DEE020000780006A575@nat28.tlf.novell.com \
    --to=jbeulich@suse.com \
    --cc=David.Laight@ACULAB.COM \
    --cc=cl@linux.com \
    --cc=eric.dumazet@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=netdev@vger.kernel.org \
    --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