Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1606377

[PATCH] asm-generic: fix compilation failure in cmpxchg_double()

From Dmitry Vyukov <dvyukov@google.com>
Newsgroups linux.kernel
Subject [PATCH] asm-generic: fix compilation failure in cmpxchg_double()
Date 2017-03-22 12:20 +0100
Message-ID <tnMt3-1zh-15@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


Arnd reported that the new code leads to compilation failures
with some versions of gcc. I've filed gcc issue 72873,
but we need a kernel fix as well.

Remove instrumentation from cmpxchg_double() for now.

Signed-off-by: Dmitry Vyukov <dvyukov@google.com>
Reported-by: Arnd Bergmann <arnd@arndb.de>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
---
 include/asm-generic/atomic-instrumented.h | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/include/asm-generic/atomic-instrumented.h b/include/asm-generic/atomic-instrumented.h
index 951bcd083925..de6c2a562a6e 100644
--- a/include/asm-generic/atomic-instrumented.h
+++ b/include/asm-generic/atomic-instrumented.h
@@ -229,18 +229,23 @@ INSTR_RET_BOOL2(add_negative);
 	arch_cmpxchg64_local(____ptr, (old), (new));	\
 })
 
+/*
+ * Originally we had the following code here:
+ *	__typeof__(p1) ____p1 = (p1);
+ *	kasan_check_write(____p1, 2 * sizeof(*____p1));
+ *	arch_cmpxchg_double(____p1, (p2), (o1), (o2), (n1), (n2));
+ * But it leads to compilation failures (see gcc issue 72873).
+ * So for now it's left non-instrumented.
+ * There are few callers of cmpxchg_double(), so it's not critical.
+ */
 #define cmpxchg_double(p1, p2, o1, o2, n1, n2)				\
 ({									\
-	__typeof__(p1) ____p1 = (p1);					\
-	kasan_check_write(____p1, 2 * sizeof(*____p1));			\
-	arch_cmpxchg_double(____p1, (p2), (o1), (o2), (n1), (n2));	\
+	arch_cmpxchg_double((p1), (p2), (o1), (o2), (n1), (n2));	\
 })
 
 #define cmpxchg_double_local(p1, p2, o1, o2, n1, n2)			\
 ({									\
-	__typeof__(p1) ____p1 = (p1);					\
-	kasan_check_write(____p1, 2 * sizeof(*____p1));			\
-	arch_cmpxchg_double_local(____p1, (p2), (o1), (o2), (n1), (n2));\
+	arch_cmpxchg_double_local((p1), (p2), (o1), (o2), (n1), (n2));	\
 })
 
 #endif /* _LINUX_ATOMIC_INSTRUMENTED_H */
-- 
2.12.1.500.gab5fba24ee-goog

Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

[PATCH] asm-generic: fix compilation failure in cmpxchg_double() Dmitry Vyukov <dvyukov@google.com> - 2017-03-22 12:20 +0100
  Re: [PATCH] asm-generic: fix compilation failure in cmpxchg_double() Arnd Bergmann <arnd@arndb.de> - 2017-03-22 12:30 +0100
    Re: [PATCH] asm-generic: fix compilation failure in cmpxchg_double() Arnd Bergmann <arnd@arndb.de> - 2017-03-22 22:30 +0100
      Re: [PATCH] asm-generic: fix compilation failure in cmpxchg_double() Dmitry Vyukov <dvyukov@google.com> - 2017-03-23 10:00 +0100
        Re: [PATCH] asm-generic: fix compilation failure in cmpxchg_double() Arnd Bergmann <arnd@arndb.de> - 2017-03-23 14:40 +0100

csiph-web