linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: linux-kernel@vger.kernel.org, x86@kernel.org
Cc: hpa@zytor.com, tglx@linutronix.de, mingo@redhat.com,
	bp@alien8.de, Juergen Gross <jgross@suse.com>
Subject: [PATCH] x86: modify inline asm constraints in __cmpxchg_double()
Date: Mon, 15 Oct 2018 10:48:02 +0200	[thread overview]
Message-ID: <20181015084802.30934-1-jgross@suse.com> (raw)

Some gcc versions seem to have problems with the constraints in
__cmpxchg_double() as they suddenly issue a build error when random
parts of sources calling __cmpxchg_double() are modified, like e.g.
slub.c. This has been observed on Debian systems only so far.

Using "0" instead of "a" in the input constraints has the same
semantics while avoiding that build error.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
I should note that I have observed gcc hangs instead sometimes. Not
taking any patches modifying users of __cmpxchg_double() due to a gcc
bug which seems to be distro-specific is a bad move IMO.

I'd rather make it clear from build behavior that this is a bug in gcc
by letting the build hang instead of throwing error warnings not in any
way related to changes in the code.

The gcc bug is filed under:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=908154
---
 arch/x86/include/asm/cmpxchg.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/cmpxchg.h b/arch/x86/include/asm/cmpxchg.h
index a55d79b233d3..b3b4d61a8969 100644
--- a/arch/x86/include/asm/cmpxchg.h
+++ b/arch/x86/include/asm/cmpxchg.h
@@ -245,7 +245,7 @@ extern void __add_wrong_size(void)
 	asm volatile(pfx "cmpxchg%c4b %2; sete %0"			\
 		     : "=a" (__ret), "+d" (__old2),			\
 		       "+m" (*(p1)), "+m" (*(p2))			\
-		     : "i" (2 * sizeof(long)), "a" (__old1),		\
+		     : "i" (2 * sizeof(long)), "0" (__old1),		\
 		       "b" (__new1), "c" (__new2));			\
 	__ret;								\
 })
-- 
2.16.4


             reply	other threads:[~2018-10-15  8:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-15  8:48 Juergen Gross [this message]
2018-10-16  6:25 ` [PATCH] x86: modify inline asm constraints in __cmpxchg_double() Ingo Molnar
2018-10-16  7:43   ` Juergen Gross
2018-10-16  8:01     ` Ingo Molnar
2018-10-17  9:09       ` Juergen Gross

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=20181015084802.30934-1-jgross@suse.com \
    --to=jgross@suse.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.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;
as well as URLs for NNTP newsgroup(s).