From: Arvind Sankar <nivedita@alum.mit.edu>
To: kernel test robot <lkp@intel.com>,
linux-next@vger.kernel.org,
Stephen Rothwell <sfr@canb.auug.org.au>
Cc: kbuild-all@lists.01.org,
Linux Memory Management List <linux-mm@kvack.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Kees Cook <keescook@chromium.org>,
Andrew Morton <akpm@linux-foundation.org>,
stable@vger.kernel.org
Subject: [PATCH] compiler.h: Move barrier() back into compiler-*.h
Date: Sun, 1 Nov 2020 12:31:05 -0500 [thread overview]
Message-ID: <20201101173105.1723648-1-nivedita@alum.mit.edu> (raw)
In-Reply-To: <202010312104.Dk9VQJYb-lkp@intel.com>
Commit
b9de06783f01 ("compiler.h: fix barrier_data() on clang")
moved the definition of barrier() into compiler.h.
This causes build failures at least on alpha, because there are files
that rely on barrier() being defined via the implicit include of
compiler_types.h.
Revert this portion of the commit to fix.
Link: https://lore.kernel.org/linux-mm/202010312104.Dk9VQJYb-lkp@intel.com/
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
Fixes: b9de06783f01 ("compiler.h: fix barrier_data() on clang")
Cc: <stable@vger.kernel.org>
---
include/linux/compiler-clang.h | 6 ++++++
include/linux/compiler-gcc.h | 5 +++++
include/linux/compiler.h | 3 +--
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h
index dd7233c48bf3..230604e7f057 100644
--- a/include/linux/compiler-clang.h
+++ b/include/linux/compiler-clang.h
@@ -60,6 +60,12 @@
#define COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW 1
#endif
+/* The following are for compatibility with GCC, from compiler-gcc.h,
+ * and may be redefined here because they should not be shared with other
+ * compilers, like ICC.
+ */
+#define barrier() __asm__ __volatile__("" : : : "memory")
+
#if __has_feature(shadow_call_stack)
# define __noscs __attribute__((__no_sanitize__("shadow-call-stack")))
#endif
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 50912ed00278..a572965c801a 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -15,6 +15,11 @@
# error Sorry, your version of GCC is too old - please use 4.9 or newer.
#endif
+/* Optimization barrier */
+
+/* The "volatile" is due to gcc bugs */
+#define barrier() __asm__ __volatile__("": : :"memory")
+
/*
* This macro obfuscates arithmetic on a variable address so that gcc
* shouldn't recognize the original var, and make assumptions about it.
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index b8fe0c23cfff..25c803f4222f 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -80,8 +80,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
/* Optimization barrier */
#ifndef barrier
-/* The "volatile" is due to gcc bugs */
-# define barrier() __asm__ __volatile__("": : :"memory")
+# define barrier() __memory_barrier()
#endif
#ifndef barrier_data
--
2.26.2
next prev parent reply other threads:[~2020-11-01 17:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-31 13:07 [linux-next:master 2035/2472] include/asm-generic/barrier.h:78:18: error: implicit declaration of function 'barrier' kernel test robot
2020-11-01 17:31 ` Arvind Sankar [this message]
2020-11-01 17:38 ` [PATCH] compiler.h: Move barrier() back into compiler-*.h Matthew Wilcox
2020-11-01 17:48 ` Randy Dunlap
2020-11-01 17:53 ` Matthew Wilcox
2020-11-01 19:51 ` Arvind Sankar
2020-11-01 19:52 ` Matthew Wilcox
2020-11-01 19:59 ` Arvind Sankar
2020-11-01 20:40 ` Randy Dunlap
2020-11-01 21:59 ` Stephen Rothwell
2020-11-01 21:56 ` Stephen Rothwell
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=20201101173105.1723648-1-nivedita@alum.mit.edu \
--to=nivedita@alum.mit.edu \
--cc=akpm@linux-foundation.org \
--cc=kbuild-all@lists.01.org \
--cc=keescook@chromium.org \
--cc=linux-mm@kvack.org \
--cc=linux-next@vger.kernel.org \
--cc=lkp@intel.com \
--cc=ndesaulniers@google.com \
--cc=sfr@canb.auug.org.au \
--cc=stable@vger.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