From: "Jike Song" <albcamus@gmail.com>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: "Ingo Molnar" <mingo@elte.hu>,
tglx@linutronix.de, mingo@redhat.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86: fix inline assembly constraints
Date: Thu, 30 Oct 2008 14:40:37 +0800 [thread overview]
Message-ID: <df9815e70810292340g52d38e83t47dffd02125b4fe3@mail.gmail.com> (raw)
In-Reply-To: <49093012.7010301@zytor.com>
On Thu, Oct 30, 2008 at 11:54 AM, H. Peter Anvin <hpa@zytor.com> wrote:
> Jike Song wrote:
>>
>> Besides, by looking at the inline assembly in kernel, I found lots of
>> codes like this:
>>
>> static inline void atomic_add(int i, atomic_t *v)
>> {
>> asm volatile(LOCK_PREFIX "addl %1,%0"
>> : "=m" (v->counter)
>> : "ir" (i), "m" (v->counter));
>> }
>>
>>
>> Yes, it works. But a little ugly.. Should this be cleaned-up with the
>> following?
>>
>> : "+m" (v->counter)
>> : "ir" (i)
>>
>> If you agrees, I'll send out the patch; otherwise I won't wasting your time ;-)
>>
>
> Please don't change them just to change them, if there is no actual
> error. You never know when you're going to trigger a new bug in some
> weird version of gcc.
>
> -hpa
Yes, sometimes gcc did have bugs with its obscure inline asm
conventions. But I think the change of x86-64 atomic operations should
be OK. Anyway, the "+" constraint is more clear than a "=m" output and
a "m" input.
The 32-bit atomic ops were already changed to "+m".(commit
b862f3b099f3ea672c7438c0b282ce8201d39dfc)
--
Thanks,
Jike
next prev parent reply other threads:[~2008-10-30 6:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-29 16:32 Jike Song
2008-10-29 16:32 ` Jike Song
2008-10-29 16:34 ` Ingo Molnar
2008-10-30 2:31 ` Jike Song
2008-10-30 3:54 ` H. Peter Anvin
2008-10-30 6:40 ` Jike Song [this message]
2008-10-30 14:51 ` H. Peter Anvin
2008-10-30 19:29 ` Ingo Molnar
2008-10-31 2:12 ` Jike Song
[not found] <fa.IZJ3RdF6xWbbMqWVWyYRstzZBsk@ifi.uio.no>
[not found] ` <fa.L4yER0Vo1brqQzpHIySgWqUN5UM@ifi.uio.no>
[not found] ` <fa.rs0w7okAn1If1ilwD81OTzT4rKg@ifi.uio.no>
2008-10-30 3:52 ` Robert Hancock
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=df9815e70810292340g52d38e83t47dffd02125b4fe3@mail.gmail.com \
--to=albcamus@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--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®