* [PATCH v6 1/3] compiler-gcc.h: add gnu_inline to all inline declarations
2018-06-21 16:23 [PATCH v6 0/3] extern inline native_save_fl for paravirt Nick Desaulniers
@ 2018-06-21 16:23 ` Nick Desaulniers
2018-07-03 15:59 ` [tip:x86/urgent] compiler-gcc.h: Add __attribute__((gnu_inline)) " tip-bot for Nick Desaulniers
2018-06-21 16:23 ` [PATCH v6 2/3] x86/asm: add _ASM_ARG* constants for argument registers to <asm/asm.h> Nick Desaulniers
2018-06-21 16:23 ` [PATCH v6 3/3] x86: paravirt: make native_save_fl extern inline Nick Desaulniers
2 siblings, 1 reply; 13+ messages in thread
From: Nick Desaulniers @ 2018-06-21 16:23 UTC (permalink / raw)
To: mingo, tglx
Cc: akpm, hpa, linux-efi, linux-kernel, x86, virtualization,
astrachan, manojgupta, ghackmann, sedat.dilek, tstellar,
keescook, yamada.masahiro, michal.lkml, linux-kbuild, geert,
will.deacon, mawilcox, arnd, rientjes, acme, pombredanne,
aryabinin, kstewart, boris.ostrovsky, jan.kiszka, rostedt,
kirill.shutemov, ard.biesheuvel, akataria, brijesh.singh,
caoj.fnst, gregkh, jarkko.sakkinen, jgross, jpoimboe, mka,
ndesaulniers, thomas.lendacky, tweek, mjg59, joe, andrea.parri
Functions marked extern inline do not emit an externally visible
function when the gnu89 C standard is used. Some KBUILD Makefiles
overwrite KBUILD_CFLAGS. This is an issue for GCC 5.1+ users as without
an explicit C standard specified, the default is gnu11. Since c99, the
semantics of extern inline have changed such that an externally visible
function is always emitted. This can lead to multiple definition errors
of extern inline functions at link time of compilation units whose build
files have removed an explicit C standard compiler flag for users of GCC
5.1+ or Clang.
Acked-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Suggested-by: H. Peter Anvin <hpa@zytor.com>
Suggested-by: Joe Perches <joe@perches.com>
---
include/linux/compiler-gcc.h | 29 ++++++++++++++++++++++-------
1 file changed, 22 insertions(+), 7 deletions(-)
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index b4bf73f5e38f..c7cfca4ba02b 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -65,6 +65,18 @@
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
#endif
+/*
+ * Feature detection for gnu_inline (gnu89 extern inline semantics). Either
+ * __GNUC_STDC_INLINE__ is defined (not using gnu89 extern inline semantics,
+ * and we opt in to the gnu89 semantics), or __GNUC_STDC_INLINE__ is not
+ * defined so the gnu89 semantics are the default.
+ */
+#ifdef __GNUC_STDC_INLINE__
+#define __gnu_inline __attribute__((gnu_inline))
+#else
+#define __gnu_inline
+#endif
+
/*
* Force always-inline if the user requests it so via the .config,
* or if gcc is too old.
@@ -72,19 +84,22 @@
* -Wunused-function. This turns out to avoid the need for complex #ifdef
* directives. Suppress the warning in clang as well by using "unused"
* function attribute, which is redundant but not harmful for gcc.
+ * Prefer gnu_inline, so that extern inline functions do not emit an
+ * externally visible function. This makes extern inline behave as per gnu89
+ * semantics rather than c99. This prevents multiple symbol definition errors
+ * of extern inline functions at link time.
+ * A lot of inline functions can cause havoc with function tracing.
*/
#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \
!defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4)
-#define inline inline __attribute__((always_inline,unused)) notrace
-#define __inline__ __inline__ __attribute__((always_inline,unused)) notrace
-#define __inline __inline __attribute__((always_inline,unused)) notrace
+#define inline \
+ inline __attribute__((always_inline, unused)) notrace __gnu_inline
#else
-/* A lot of inline functions can cause havoc with function tracing */
-#define inline inline __attribute__((unused)) notrace
-#define __inline__ __inline__ __attribute__((unused)) notrace
-#define __inline __inline __attribute__((unused)) notrace
+#define inline inline __attribute__((unused)) notrace __gnu_inline
#endif
+#define __inline__ inline
+#define __inline inline
#define __always_inline inline __attribute__((always_inline))
#define noinline __attribute__((noinline))
--
2.18.0.rc2.346.g013aa6912e-goog
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [tip:x86/urgent] compiler-gcc.h: Add __attribute__((gnu_inline)) to all inline declarations
2018-06-21 16:23 ` [PATCH v6 1/3] compiler-gcc.h: add gnu_inline to all inline declarations Nick Desaulniers
@ 2018-07-03 15:59 ` tip-bot for Nick Desaulniers
0 siblings, 0 replies; 13+ messages in thread
From: tip-bot for Nick Desaulniers @ 2018-07-03 15:59 UTC (permalink / raw)
To: linux-tip-commits
Cc: ndesaulniers, torvalds, tglx, joe, linux-kernel, hpa, jgross,
mingo, peterz, arnd
Commit-ID: d03db2bc26f0e4a6849ad649a09c9c73fccdc656
Gitweb: https://git.kernel.org/tip/d03db2bc26f0e4a6849ad649a09c9c73fccdc656
Author: Nick Desaulniers <ndesaulniers@google.com>
AuthorDate: Thu, 21 Jun 2018 09:23:22 -0700
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 3 Jul 2018 10:56:27 +0200
compiler-gcc.h: Add __attribute__((gnu_inline)) to all inline declarations
Functions marked extern inline do not emit an externally visible
function when the gnu89 C standard is used. Some KBUILD Makefiles
overwrite KBUILD_CFLAGS. This is an issue for GCC 5.1+ users as without
an explicit C standard specified, the default is gnu11. Since c99, the
semantics of extern inline have changed such that an externally visible
function is always emitted. This can lead to multiple definition errors
of extern inline functions at link time of compilation units whose build
files have removed an explicit C standard compiler flag for users of GCC
5.1+ or Clang.
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Suggested-by: H. Peter Anvin <hpa@zytor.com>
Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Acked-by: Juergen Gross <jgross@suse.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: acme@redhat.com
Cc: akataria@vmware.com
Cc: akpm@linux-foundation.org
Cc: andrea.parri@amarulasolutions.com
Cc: ard.biesheuvel@linaro.org
Cc: aryabinin@virtuozzo.com
Cc: astrachan@google.com
Cc: boris.ostrovsky@oracle.com
Cc: brijesh.singh@amd.com
Cc: caoj.fnst@cn.fujitsu.com
Cc: geert@linux-m68k.org
Cc: ghackmann@google.com
Cc: gregkh@linuxfoundation.org
Cc: jan.kiszka@siemens.com
Cc: jarkko.sakkinen@linux.intel.com
Cc: jpoimboe@redhat.com
Cc: keescook@google.com
Cc: kirill.shutemov@linux.intel.com
Cc: kstewart@linuxfoundation.org
Cc: linux-efi@vger.kernel.org
Cc: linux-kbuild@vger.kernel.org
Cc: manojgupta@google.com
Cc: mawilcox@microsoft.com
Cc: michal.lkml@markovi.net
Cc: mjg59@google.com
Cc: mka@chromium.org
Cc: pombredanne@nexb.com
Cc: rientjes@google.com
Cc: rostedt@goodmis.org
Cc: sedat.dilek@gmail.com
Cc: thomas.lendacky@amd.com
Cc: tstellar@redhat.com
Cc: tweek@google.com
Cc: virtualization@lists.linux-foundation.org
Cc: will.deacon@arm.com
Cc: yamada.masahiro@socionext.com
Link: http://lkml.kernel.org/r/20180621162324.36656-2-ndesaulniers@google.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
include/linux/compiler-gcc.h | 29 ++++++++++++++++++++++-------
1 file changed, 22 insertions(+), 7 deletions(-)
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index fd282c7d3e5e..573f5a7d42d4 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -65,6 +65,18 @@
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
#endif
+/*
+ * Feature detection for gnu_inline (gnu89 extern inline semantics). Either
+ * __GNUC_STDC_INLINE__ is defined (not using gnu89 extern inline semantics,
+ * and we opt in to the gnu89 semantics), or __GNUC_STDC_INLINE__ is not
+ * defined so the gnu89 semantics are the default.
+ */
+#ifdef __GNUC_STDC_INLINE__
+# define __gnu_inline __attribute__((gnu_inline))
+#else
+# define __gnu_inline
+#endif
+
/*
* Force always-inline if the user requests it so via the .config,
* or if gcc is too old.
@@ -72,19 +84,22 @@
* -Wunused-function. This turns out to avoid the need for complex #ifdef
* directives. Suppress the warning in clang as well by using "unused"
* function attribute, which is redundant but not harmful for gcc.
+ * Prefer gnu_inline, so that extern inline functions do not emit an
+ * externally visible function. This makes extern inline behave as per gnu89
+ * semantics rather than c99. This prevents multiple symbol definition errors
+ * of extern inline functions at link time.
+ * A lot of inline functions can cause havoc with function tracing.
*/
#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \
!defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4)
-#define inline inline __attribute__((always_inline,unused)) notrace
-#define __inline__ __inline__ __attribute__((always_inline,unused)) notrace
-#define __inline __inline __attribute__((always_inline,unused)) notrace
+#define inline \
+ inline __attribute__((always_inline, unused)) notrace __gnu_inline
#else
-/* A lot of inline functions can cause havoc with function tracing */
-#define inline inline __attribute__((unused)) notrace
-#define __inline__ __inline__ __attribute__((unused)) notrace
-#define __inline __inline __attribute__((unused)) notrace
+#define inline inline __attribute__((unused)) notrace __gnu_inline
#endif
+#define __inline__ inline
+#define __inline inline
#define __always_inline inline __attribute__((always_inline))
#define noinline __attribute__((noinline))
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v6 2/3] x86/asm: add _ASM_ARG* constants for argument registers to <asm/asm.h>
2018-06-21 16:23 [PATCH v6 0/3] extern inline native_save_fl for paravirt Nick Desaulniers
2018-06-21 16:23 ` [PATCH v6 1/3] compiler-gcc.h: add gnu_inline to all inline declarations Nick Desaulniers
@ 2018-06-21 16:23 ` Nick Desaulniers
2018-07-03 15:59 ` [tip:x86/urgent] x86/asm: Add " tip-bot for H. Peter Anvin
2018-06-21 16:23 ` [PATCH v6 3/3] x86: paravirt: make native_save_fl extern inline Nick Desaulniers
2 siblings, 1 reply; 13+ messages in thread
From: Nick Desaulniers @ 2018-06-21 16:23 UTC (permalink / raw)
To: mingo, tglx
Cc: akpm, hpa, linux-efi, linux-kernel, x86, virtualization,
astrachan, manojgupta, ghackmann, sedat.dilek, tstellar,
keescook, yamada.masahiro, michal.lkml, linux-kbuild, geert,
will.deacon, mawilcox, arnd, rientjes, acme, pombredanne,
aryabinin, kstewart, boris.ostrovsky, jan.kiszka, rostedt,
kirill.shutemov, ard.biesheuvel, akataria, brijesh.singh,
caoj.fnst, gregkh, jarkko.sakkinen, jgross, jpoimboe, mka,
ndesaulniers, thomas.lendacky, tweek, mjg59, joe, andrea.parri,
H. Peter Anvin
From: "H. Peter Anvin" <hpa@linux.intel.com>
i386 and x86-64 uses different registers for arguments; make them
available so we don't have to #ifdef in the actual code.
Native size and specified size (q, l, w, b) versions are provided.
Acked-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
arch/x86/include/asm/asm.h | 59 ++++++++++++++++++++++++++++++++++++++
1 file changed, 59 insertions(+)
diff --git a/arch/x86/include/asm/asm.h b/arch/x86/include/asm/asm.h
index 219faaec51df..990770f9e76b 100644
--- a/arch/x86/include/asm/asm.h
+++ b/arch/x86/include/asm/asm.h
@@ -46,6 +46,65 @@
#define _ASM_SI __ASM_REG(si)
#define _ASM_DI __ASM_REG(di)
+#ifndef __x86_64__
+/* 32 bit */
+
+#define _ASM_ARG1 _ASM_AX
+#define _ASM_ARG2 _ASM_DX
+#define _ASM_ARG3 _ASM_CX
+
+#define _ASM_ARG1L eax
+#define _ASM_ARG2L edx
+#define _ASM_ARG3L ecx
+
+#define _ASM_ARG1W ax
+#define _ASM_ARG2W dx
+#define _ASM_ARG3W cx
+
+#define _ASM_ARG1B al
+#define _ASM_ARG2B dl
+#define _ASM_ARG3B cl
+
+#else
+/* 64 bit */
+
+#define _ASM_ARG1 _ASM_DI
+#define _ASM_ARG2 _ASM_SI
+#define _ASM_ARG3 _ASM_DX
+#define _ASM_ARG4 _ASM_CX
+#define _ASM_ARG5 r8
+#define _ASM_ARG6 r9
+
+#define _ASM_ARG1Q rdi
+#define _ASM_ARG2Q rsi
+#define _ASM_ARG3Q rdx
+#define _ASM_ARG4Q rcx
+#define _ASM_ARG5Q r8
+#define _ASM_ARG6Q r9
+
+#define _ASM_ARG1L edi
+#define _ASM_ARG2L esi
+#define _ASM_ARG3L edx
+#define _ASM_ARG4L ecx
+#define _ASM_ARG5L r8d
+#define _ASM_ARG6L r9d
+
+#define _ASM_ARG1W di
+#define _ASM_ARG2W si
+#define _ASM_ARG3W dx
+#define _ASM_ARG4W cx
+#define _ASM_ARG5W r8w
+#define _ASM_ARG6W r9w
+
+#define _ASM_ARG1B dil
+#define _ASM_ARG2B sil
+#define _ASM_ARG3B dl
+#define _ASM_ARG4B cl
+#define _ASM_ARG5B r8b
+#define _ASM_ARG6B r9b
+
+#endif
+
/*
* Macros to generate condition code outputs from inline assembly,
* The output operand must be type "bool".
--
2.18.0.rc2.346.g013aa6912e-goog
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [tip:x86/urgent] x86/asm: Add _ASM_ARG* constants for argument registers to <asm/asm.h>
2018-06-21 16:23 ` [PATCH v6 2/3] x86/asm: add _ASM_ARG* constants for argument registers to <asm/asm.h> Nick Desaulniers
@ 2018-07-03 15:59 ` tip-bot for H. Peter Anvin
0 siblings, 0 replies; 13+ messages in thread
From: tip-bot for H. Peter Anvin @ 2018-07-03 15:59 UTC (permalink / raw)
To: linux-tip-commits
Cc: sedat.dilek, linux-kernel, jgross, tglx, hpa, mingo, peterz,
torvalds, hpa, ndesaulniers
Commit-ID: 0e2e160033283e20f688d8bad5b89460cc5bfcc4
Gitweb: https://git.kernel.org/tip/0e2e160033283e20f688d8bad5b89460cc5bfcc4
Author: H. Peter Anvin <hpa@linux.intel.com>
AuthorDate: Thu, 21 Jun 2018 09:23:23 -0700
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 3 Jul 2018 10:56:27 +0200
x86/asm: Add _ASM_ARG* constants for argument registers to <asm/asm.h>
i386 and x86-64 uses different registers for arguments; make them
available so we don't have to #ifdef in the actual code.
Native size and specified size (q, l, w, b) versions are provided.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Sedat Dilek <sedat.dilek@gmail.com>
Acked-by: Juergen Gross <jgross@suse.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: acme@redhat.com
Cc: akataria@vmware.com
Cc: akpm@linux-foundation.org
Cc: andrea.parri@amarulasolutions.com
Cc: ard.biesheuvel@linaro.org
Cc: arnd@arndb.de
Cc: aryabinin@virtuozzo.com
Cc: astrachan@google.com
Cc: boris.ostrovsky@oracle.com
Cc: brijesh.singh@amd.com
Cc: caoj.fnst@cn.fujitsu.com
Cc: geert@linux-m68k.org
Cc: ghackmann@google.com
Cc: gregkh@linuxfoundation.org
Cc: jan.kiszka@siemens.com
Cc: jarkko.sakkinen@linux.intel.com
Cc: joe@perches.com
Cc: jpoimboe@redhat.com
Cc: keescook@google.com
Cc: kirill.shutemov@linux.intel.com
Cc: kstewart@linuxfoundation.org
Cc: linux-efi@vger.kernel.org
Cc: linux-kbuild@vger.kernel.org
Cc: manojgupta@google.com
Cc: mawilcox@microsoft.com
Cc: michal.lkml@markovi.net
Cc: mjg59@google.com
Cc: mka@chromium.org
Cc: pombredanne@nexb.com
Cc: rientjes@google.com
Cc: rostedt@goodmis.org
Cc: thomas.lendacky@amd.com
Cc: tstellar@redhat.com
Cc: tweek@google.com
Cc: virtualization@lists.linux-foundation.org
Cc: will.deacon@arm.com
Cc: yamada.masahiro@socionext.com
Link: http://lkml.kernel.org/r/20180621162324.36656-3-ndesaulniers@google.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/include/asm/asm.h | 59 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 59 insertions(+)
diff --git a/arch/x86/include/asm/asm.h b/arch/x86/include/asm/asm.h
index 219faaec51df..990770f9e76b 100644
--- a/arch/x86/include/asm/asm.h
+++ b/arch/x86/include/asm/asm.h
@@ -46,6 +46,65 @@
#define _ASM_SI __ASM_REG(si)
#define _ASM_DI __ASM_REG(di)
+#ifndef __x86_64__
+/* 32 bit */
+
+#define _ASM_ARG1 _ASM_AX
+#define _ASM_ARG2 _ASM_DX
+#define _ASM_ARG3 _ASM_CX
+
+#define _ASM_ARG1L eax
+#define _ASM_ARG2L edx
+#define _ASM_ARG3L ecx
+
+#define _ASM_ARG1W ax
+#define _ASM_ARG2W dx
+#define _ASM_ARG3W cx
+
+#define _ASM_ARG1B al
+#define _ASM_ARG2B dl
+#define _ASM_ARG3B cl
+
+#else
+/* 64 bit */
+
+#define _ASM_ARG1 _ASM_DI
+#define _ASM_ARG2 _ASM_SI
+#define _ASM_ARG3 _ASM_DX
+#define _ASM_ARG4 _ASM_CX
+#define _ASM_ARG5 r8
+#define _ASM_ARG6 r9
+
+#define _ASM_ARG1Q rdi
+#define _ASM_ARG2Q rsi
+#define _ASM_ARG3Q rdx
+#define _ASM_ARG4Q rcx
+#define _ASM_ARG5Q r8
+#define _ASM_ARG6Q r9
+
+#define _ASM_ARG1L edi
+#define _ASM_ARG2L esi
+#define _ASM_ARG3L edx
+#define _ASM_ARG4L ecx
+#define _ASM_ARG5L r8d
+#define _ASM_ARG6L r9d
+
+#define _ASM_ARG1W di
+#define _ASM_ARG2W si
+#define _ASM_ARG3W dx
+#define _ASM_ARG4W cx
+#define _ASM_ARG5W r8w
+#define _ASM_ARG6W r9w
+
+#define _ASM_ARG1B dil
+#define _ASM_ARG2B sil
+#define _ASM_ARG3B dl
+#define _ASM_ARG4B cl
+#define _ASM_ARG5B r8b
+#define _ASM_ARG6B r9b
+
+#endif
+
/*
* Macros to generate condition code outputs from inline assembly,
* The output operand must be type "bool".
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v6 3/3] x86: paravirt: make native_save_fl extern inline
2018-06-21 16:23 [PATCH v6 0/3] extern inline native_save_fl for paravirt Nick Desaulniers
2018-06-21 16:23 ` [PATCH v6 1/3] compiler-gcc.h: add gnu_inline to all inline declarations Nick Desaulniers
2018-06-21 16:23 ` [PATCH v6 2/3] x86/asm: add _ASM_ARG* constants for argument registers to <asm/asm.h> Nick Desaulniers
@ 2018-06-21 16:23 ` Nick Desaulniers
2018-06-22 2:24 ` Ingo Molnar
` (2 more replies)
2 siblings, 3 replies; 13+ messages in thread
From: Nick Desaulniers @ 2018-06-21 16:23 UTC (permalink / raw)
To: mingo, tglx
Cc: akpm, hpa, linux-efi, linux-kernel, x86, virtualization,
astrachan, manojgupta, ghackmann, sedat.dilek, tstellar,
keescook, yamada.masahiro, michal.lkml, linux-kbuild, geert,
will.deacon, mawilcox, arnd, rientjes, acme, pombredanne,
aryabinin, kstewart, boris.ostrovsky, jan.kiszka, rostedt,
kirill.shutemov, ard.biesheuvel, akataria, brijesh.singh,
caoj.fnst, gregkh, jarkko.sakkinen, jgross, jpoimboe, mka,
ndesaulniers, thomas.lendacky, tweek, mjg59, joe, andrea.parri
native_save_fl() is marked static inline, but by using it as
a function pointer in arch/x86/kernel/paravirt.c, it MUST be outlined.
paravirt's use of native_save_fl() also requires that no GPRs other than
%rax are clobbered.
Compilers have different heuristics which they use to emit stack guard
code, the emittance of which can break paravirt's callee saved assumption
by clobbering %rcx.
Marking a function definition extern inline means that if this version
cannot be inlined, then the out-of-line version will be preferred. By
having the out-of-line version be implemented in assembly, it cannot be
instrumented with a stack protector, which might violate custom calling
conventions that code like paravirt rely on.
The semantics of extern inline has changed since gnu89. This means that
folks using GCC versions >= 5.1 may see symbol redefinition errors at
link time for subdirs that override KBUILD_CFLAGS (making the C standard
used implicit) regardless of this patch. This has been cleaned up
earlier in the patch set, but is left as a note in the commit message
for future travelers.
Reports:
https://lkml.org/lkml/2018/5/7/534
https://github.com/ClangBuiltLinux/linux/issues/16
Discussion:
https://bugs.llvm.org/show_bug.cgi?id=37512
https://lkml.org/lkml/2018/5/24/1371
Thanks to the many folks that participated in the discussion.
Acked-by: Juergen Gross <jgross@suse.com>
Debugged-by: Alistair Strachan <astrachan@google.com>
Debugged-by: Matthias Kaehlcke <mka@chromium.org>
Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Suggested-by: H. Peter Anvin <hpa@zytor.com>
Suggested-by: Tom Stellar <tstellar@redhat.com>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
---
arch/x86/include/asm/irqflags.h | 2 +-
arch/x86/kernel/Makefile | 1 +
arch/x86/kernel/irqflags.S | 26 ++++++++++++++++++++++++++
3 files changed, 28 insertions(+), 1 deletion(-)
create mode 100644 arch/x86/kernel/irqflags.S
diff --git a/arch/x86/include/asm/irqflags.h b/arch/x86/include/asm/irqflags.h
index 89f08955fff7..c4fc17220df9 100644
--- a/arch/x86/include/asm/irqflags.h
+++ b/arch/x86/include/asm/irqflags.h
@@ -13,7 +13,7 @@
* Interrupt control:
*/
-static inline unsigned long native_save_fl(void)
+extern inline unsigned long native_save_fl(void)
{
unsigned long flags;
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 02d6f5cf4e70..8824d01c0c35 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -61,6 +61,7 @@ obj-y += alternative.o i8253.o hw_breakpoint.o
obj-y += tsc.o tsc_msr.o io_delay.o rtc.o
obj-y += pci-iommu_table.o
obj-y += resource.o
+obj-y += irqflags.o
obj-y += process.o
obj-y += fpu/
diff --git a/arch/x86/kernel/irqflags.S b/arch/x86/kernel/irqflags.S
new file mode 100644
index 000000000000..ddeeaac8adda
--- /dev/null
+++ b/arch/x86/kernel/irqflags.S
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#include <asm/asm.h>
+#include <asm/export.h>
+#include <linux/linkage.h>
+
+/*
+ * unsigned long native_save_fl(void)
+ */
+ENTRY(native_save_fl)
+ pushf
+ pop %_ASM_AX
+ ret
+ENDPROC(native_save_fl)
+EXPORT_SYMBOL(native_save_fl)
+
+/*
+ * void native_restore_fl(unsigned long flags)
+ * %eax/%rdi: flags
+ */
+ENTRY(native_restore_fl)
+ push %_ASM_ARG1
+ popf
+ ret
+ENDPROC(native_restore_fl)
+EXPORT_SYMBOL(native_restore_fl)
--
2.18.0.rc2.346.g013aa6912e-goog
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v6 3/3] x86: paravirt: make native_save_fl extern inline
2018-06-21 16:23 ` [PATCH v6 3/3] x86: paravirt: make native_save_fl extern inline Nick Desaulniers
@ 2018-06-22 2:24 ` Ingo Molnar
2018-06-22 17:10 ` Nick Desaulniers
2018-07-03 16:00 ` [tip:x86/urgent] x86/paravirt: Make native_save_fl() " tip-bot for Nick Desaulniers
[not found] ` <1e19dbef068b45a4a4e9eb4072e097be@AcuMS.aculab.com>
2 siblings, 1 reply; 13+ messages in thread
From: Ingo Molnar @ 2018-06-22 2:24 UTC (permalink / raw)
To: Nick Desaulniers
Cc: mingo, tglx, akpm, hpa, linux-efi, linux-kernel, x86,
virtualization, astrachan, manojgupta, ghackmann, sedat.dilek,
tstellar, keescook, yamada.masahiro, michal.lkml, linux-kbuild,
geert, will.deacon, mawilcox, arnd, rientjes, acme, pombredanne,
aryabinin, kstewart, boris.ostrovsky, jan.kiszka, rostedt,
kirill.shutemov, ard.biesheuvel, akataria, brijesh.singh,
caoj.fnst, gregkh, jarkko.sakkinen, jgross, jpoimboe, mka,
thomas.lendacky, tweek, mjg59, joe, andrea.parri
* Nick Desaulniers <ndesaulniers@google.com> wrote:
> native_save_fl() is marked static inline, but by using it as
> a function pointer in arch/x86/kernel/paravirt.c, it MUST be outlined.
> --- a/arch/x86/include/asm/irqflags.h
> +++ b/arch/x86/include/asm/irqflags.h
> @@ -13,7 +13,7 @@
> * Interrupt control:
> */
>
> -static inline unsigned long native_save_fl(void)
> +extern inline unsigned long native_save_fl(void)
> {
> unsigned long flags;
>
What's the code generation effect of this on say a defconfig kernel vmlinux with
paravirt enabled?
Thanks,
Ingo
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v6 3/3] x86: paravirt: make native_save_fl extern inline
2018-06-22 2:24 ` Ingo Molnar
@ 2018-06-22 17:10 ` Nick Desaulniers
2018-06-26 7:13 ` Ingo Molnar
0 siblings, 1 reply; 13+ messages in thread
From: Nick Desaulniers @ 2018-06-22 17:10 UTC (permalink / raw)
To: Ingo Molnar
Cc: mingo, Thomas Gleixner, Andrew Morton, hpa, linux-efi, LKML, x86,
virtualization, Alistair Strachan, Manoj Gupta, Greg Hackmann,
sedat.dilek, tstellar, Kees Cook, Masahiro Yamada, Michal Marek,
Linux Kbuild mailing list, geert, Will Deacon, mawilcox,
Arnd Bergmann, David Rientjes, acme, Philippe Ombredanne,
Andrey Ryabinin, Kate Stewart, boris.ostrovsky, J. Kiszka,
rostedt, kirill.shutemov, Ard Biesheuvel, akataria,
brijesh.singh, Cao jin, Greg KH, jarkko.sakkinen, jgross,
Josh Poimboeuf, Matthias Kaehlcke, thomas.lendacky,
Thiebaud Weksteen, mjg59, joe, andrea.parri
On Thu, Jun 21, 2018 at 7:24 PM Ingo Molnar <mingo@kernel.org> wrote:
> * Nick Desaulniers <ndesaulniers@google.com> wrote:
>
> > native_save_fl() is marked static inline, but by using it as
> > a function pointer in arch/x86/kernel/paravirt.c, it MUST be outlined.
>
> > --- a/arch/x86/include/asm/irqflags.h
> > +++ b/arch/x86/include/asm/irqflags.h
> > @@ -13,7 +13,7 @@
> > * Interrupt control:
> > */
> >
> > -static inline unsigned long native_save_fl(void)
> > +extern inline unsigned long native_save_fl(void)
> > {
> > unsigned long flags;
> >
>
> What's the code generation effect of this on say a defconfig kernel vmlinux with
> paravirt enabled?
Starting with this patch set applied:
$ make CC=gcc-8 -j46
$ objdump -d vmlinux | grep native_save_fl --context=3
ffffffff81059140 <native_save_fl>:
ffffffff81059140: 9c pushfq
ffffffff81059141: 58 pop %rax
ffffffff81059142: c3 retq
$ git checkout HEAD~3
$ make CC=gcc-8 -j46
$ objdump -d vmlinux | grep native_save_fl --context=3
ffffffff81079410 <native_save_fl>:
ffffffff81079410: 9c pushfq
ffffffff81079411: 58 pop %rax
ffffffff81079412: c3 retq
Mainly, this is to prevent the compiler from adding a stack protector
to the outlined version, as the stack protector clobbers %rcx, but
paravirt expects %rcx to be preserved. More info can be found:
https://lkml.org/lkml/2018/5/24/1242--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v6 3/3] x86: paravirt: make native_save_fl extern inline
2018-06-22 17:10 ` Nick Desaulniers
@ 2018-06-26 7:13 ` Ingo Molnar
2018-06-26 16:22 ` Nick Desaulniers
0 siblings, 1 reply; 13+ messages in thread
From: Ingo Molnar @ 2018-06-26 7:13 UTC (permalink / raw)
To: Nick Desaulniers
Cc: mingo, Thomas Gleixner, Andrew Morton, hpa, linux-efi, LKML, x86,
virtualization, Alistair Strachan, Manoj Gupta, Greg Hackmann,
sedat.dilek, tstellar, Kees Cook, Masahiro Yamada, Michal Marek,
Linux Kbuild mailing list, geert, Will Deacon, mawilcox,
Arnd Bergmann, David Rientjes, acme, Philippe Ombredanne,
Andrey Ryabinin, Kate Stewart, boris.ostrovsky, J. Kiszka,
rostedt, kirill.shutemov, Ard Biesheuvel, akataria,
brijesh.singh, Cao jin, Greg KH, jarkko.sakkinen, jgross,
Josh Poimboeuf, Matthias Kaehlcke, thomas.lendacky,
Thiebaud Weksteen, mjg59, joe, andrea.parri
* Nick Desaulniers <ndesaulniers@google.com> wrote:
> On Thu, Jun 21, 2018 at 7:24 PM Ingo Molnar <mingo@kernel.org> wrote:
> > * Nick Desaulniers <ndesaulniers@google.com> wrote:
> >
> > > native_save_fl() is marked static inline, but by using it as
> > > a function pointer in arch/x86/kernel/paravirt.c, it MUST be outlined.
> >
> > > --- a/arch/x86/include/asm/irqflags.h
> > > +++ b/arch/x86/include/asm/irqflags.h
> > > @@ -13,7 +13,7 @@
> > > * Interrupt control:
> > > */
> > >
> > > -static inline unsigned long native_save_fl(void)
> > > +extern inline unsigned long native_save_fl(void)
> > > {
> > > unsigned long flags;
> > >
> >
> > What's the code generation effect of this on say a defconfig kernel vmlinux with
> > paravirt enabled?
>
> Starting with this patch set applied:
> $ make CC=gcc-8 -j46
> $ objdump -d vmlinux | grep native_save_fl --context=3
> ffffffff81059140 <native_save_fl>:
> ffffffff81059140: 9c pushfq
> ffffffff81059141: 58 pop %rax
> ffffffff81059142: c3 retq
> $ git checkout HEAD~3
> $ make CC=gcc-8 -j46
> $ objdump -d vmlinux | grep native_save_fl --context=3
> ffffffff81079410 <native_save_fl>:
> ffffffff81079410: 9c pushfq
> ffffffff81079411: 58 pop %rax
> ffffffff81079412: c3 retq
>
> Mainly, this is to prevent the compiler from adding a stack protector
> to the outlined version, as the stack protector clobbers %rcx, but
> paravirt expects %rcx to be preserved. More info can be found:
> https://lkml.org/lkml/2018/5/24/1242--
Ok!
Acked-by: Ingo Molnar <mingo@kernel.org>
What's the planned upstreaming route for these patches/fixes?
Thanks,
Ingo
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v6 3/3] x86: paravirt: make native_save_fl extern inline
2018-06-26 7:13 ` Ingo Molnar
@ 2018-06-26 16:22 ` Nick Desaulniers
2018-07-03 7:21 ` Juergen Gross
0 siblings, 1 reply; 13+ messages in thread
From: Nick Desaulniers @ 2018-06-26 16:22 UTC (permalink / raw)
To: Ingo Molnar
Cc: mingo, Thomas Gleixner, Andrew Morton, hpa, linux-efi, LKML, x86,
virtualization, Alistair Strachan, Manoj Gupta, Greg Hackmann,
sedat.dilek, tstellar, Kees Cook, Masahiro Yamada, Michal Marek,
Linux Kbuild mailing list, geert, Will Deacon, mawilcox,
Arnd Bergmann, David Rientjes, acme, Philippe Ombredanne,
Andrey Ryabinin, Kate Stewart, boris.ostrovsky, J. Kiszka,
rostedt, kirill.shutemov, Ard Biesheuvel, akataria,
brijesh.singh, Cao jin, Greg KH, jarkko.sakkinen, jgross,
Josh Poimboeuf, Matthias Kaehlcke, thomas.lendacky,
Thiebaud Weksteen, mjg59, joe, andrea.parri
On Tue, Jun 26, 2018 at 3:13 AM Ingo Molnar <mingo@kernel.org> wrote:
> Ok!
>
> Acked-by: Ingo Molnar <mingo@kernel.org>
>
> What's the planned upstreaming route for these patches/fixes?
While the fix is mainly for paravirt, 2/3 of the patches exclusively
touch arch/x86, so I think they should go up in the x86 tree (as
opposed to paravirt's), if you would be so kind. hpa mentioned not
handling merges in https://lkml.org/lkml/2018/6/14/903, so I reached
out to you and tglx.
(Also, this is the first series I've ever sent (as opposed to one off
commits), so I'm unfamiliar with the protocol for merging series that
may be touch more than one subsystem. I assume we don't split up
series to take parts in one tree vs another?)
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v6 3/3] x86: paravirt: make native_save_fl extern inline
2018-06-26 16:22 ` Nick Desaulniers
@ 2018-07-03 7:21 ` Juergen Gross
0 siblings, 0 replies; 13+ messages in thread
From: Juergen Gross @ 2018-07-03 7:21 UTC (permalink / raw)
To: Nick Desaulniers, Ingo Molnar
Cc: mingo, Thomas Gleixner, Andrew Morton, hpa, linux-efi, LKML, x86,
virtualization, Alistair Strachan, Manoj Gupta, Greg Hackmann,
sedat.dilek, tstellar, Kees Cook, Masahiro Yamada, Michal Marek,
Linux Kbuild mailing list, geert, Will Deacon, mawilcox,
Arnd Bergmann, David Rientjes, acme, Philippe Ombredanne,
Andrey Ryabinin, Kate Stewart, boris.ostrovsky, J. Kiszka,
rostedt, kirill.shutemov, Ard Biesheuvel, akataria,
brijesh.singh, Cao jin, Greg KH, jarkko.sakkinen, Josh Poimboeuf,
Matthias Kaehlcke, thomas.lendacky, Thiebaud Weksteen, mjg59,
joe, andrea.parri
On 26/06/18 18:22, Nick Desaulniers wrote:
> On Tue, Jun 26, 2018 at 3:13 AM Ingo Molnar <mingo@kernel.org> wrote:
>> Ok!
>>
>> Acked-by: Ingo Molnar <mingo@kernel.org>
>>
>> What's the planned upstreaming route for these patches/fixes?
>
> While the fix is mainly for paravirt, 2/3 of the patches exclusively
> touch arch/x86, so I think they should go up in the x86 tree (as
> opposed to paravirt's), if you would be so kind. hpa mentioned not
> handling merges in https://lkml.org/lkml/2018/6/14/903, so I reached
> out to you and tglx.
As there is no paravirt tree the x86 one seems to be appropriate. :-)
Juergen
^ permalink raw reply [flat|nested] 13+ messages in thread
* [tip:x86/urgent] x86/paravirt: Make native_save_fl() extern inline
2018-06-21 16:23 ` [PATCH v6 3/3] x86: paravirt: make native_save_fl extern inline Nick Desaulniers
2018-06-22 2:24 ` Ingo Molnar
@ 2018-07-03 16:00 ` tip-bot for Nick Desaulniers
[not found] ` <1e19dbef068b45a4a4e9eb4072e097be@AcuMS.aculab.com>
2 siblings, 0 replies; 13+ messages in thread
From: tip-bot for Nick Desaulniers @ 2018-07-03 16:00 UTC (permalink / raw)
To: linux-tip-commits
Cc: peterz, tstellar, ndesaulniers, jgross, torvalds, mka, arnd,
mingo, linux-kernel, astrachan, sedat.dilek, tglx, hpa
Commit-ID: d0a8d9378d16eb3c69bd8e6d23779fbdbee3a8c7
Gitweb: https://git.kernel.org/tip/d0a8d9378d16eb3c69bd8e6d23779fbdbee3a8c7
Author: Nick Desaulniers <ndesaulniers@google.com>
AuthorDate: Thu, 21 Jun 2018 09:23:24 -0700
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 3 Jul 2018 10:56:27 +0200
x86/paravirt: Make native_save_fl() extern inline
native_save_fl() is marked static inline, but by using it as
a function pointer in arch/x86/kernel/paravirt.c, it MUST be outlined.
paravirt's use of native_save_fl() also requires that no GPRs other than
%rax are clobbered.
Compilers have different heuristics which they use to emit stack guard
code, the emittance of which can break paravirt's callee saved assumption
by clobbering %rcx.
Marking a function definition extern inline means that if this version
cannot be inlined, then the out-of-line version will be preferred. By
having the out-of-line version be implemented in assembly, it cannot be
instrumented with a stack protector, which might violate custom calling
conventions that code like paravirt rely on.
The semantics of extern inline has changed since gnu89. This means that
folks using GCC versions >= 5.1 may see symbol redefinition errors at
link time for subdirs that override KBUILD_CFLAGS (making the C standard
used implicit) regardless of this patch. This has been cleaned up
earlier in the patch set, but is left as a note in the commit message
for future travelers.
Reports:
https://lkml.org/lkml/2018/5/7/534
https://github.com/ClangBuiltLinux/linux/issues/16
Discussion:
https://bugs.llvm.org/show_bug.cgi?id=37512
https://lkml.org/lkml/2018/5/24/1371
Thanks to the many folks that participated in the discussion.
Debugged-by: Alistair Strachan <astrachan@google.com>
Debugged-by: Matthias Kaehlcke <mka@chromium.org>
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Suggested-by: H. Peter Anvin <hpa@zytor.com>
Suggested-by: Tom Stellar <tstellar@redhat.com>
Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Acked-by: Juergen Gross <jgross@suse.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: acme@redhat.com
Cc: akataria@vmware.com
Cc: akpm@linux-foundation.org
Cc: andrea.parri@amarulasolutions.com
Cc: ard.biesheuvel@linaro.org
Cc: aryabinin@virtuozzo.com
Cc: astrachan@google.com
Cc: boris.ostrovsky@oracle.com
Cc: brijesh.singh@amd.com
Cc: caoj.fnst@cn.fujitsu.com
Cc: geert@linux-m68k.org
Cc: ghackmann@google.com
Cc: gregkh@linuxfoundation.org
Cc: jan.kiszka@siemens.com
Cc: jarkko.sakkinen@linux.intel.com
Cc: joe@perches.com
Cc: jpoimboe@redhat.com
Cc: keescook@google.com
Cc: kirill.shutemov@linux.intel.com
Cc: kstewart@linuxfoundation.org
Cc: linux-efi@vger.kernel.org
Cc: linux-kbuild@vger.kernel.org
Cc: manojgupta@google.com
Cc: mawilcox@microsoft.com
Cc: michal.lkml@markovi.net
Cc: mjg59@google.com
Cc: mka@chromium.org
Cc: pombredanne@nexb.com
Cc: rientjes@google.com
Cc: rostedt@goodmis.org
Cc: thomas.lendacky@amd.com
Cc: tweek@google.com
Cc: virtualization@lists.linux-foundation.org
Cc: will.deacon@arm.com
Cc: yamada.masahiro@socionext.com
Link: http://lkml.kernel.org/r/20180621162324.36656-4-ndesaulniers@google.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/include/asm/irqflags.h | 2 +-
arch/x86/kernel/Makefile | 1 +
arch/x86/kernel/irqflags.S | 26 ++++++++++++++++++++++++++
3 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/arch/x86/include/asm/irqflags.h b/arch/x86/include/asm/irqflags.h
index 89f08955fff7..c4fc17220df9 100644
--- a/arch/x86/include/asm/irqflags.h
+++ b/arch/x86/include/asm/irqflags.h
@@ -13,7 +13,7 @@
* Interrupt control:
*/
-static inline unsigned long native_save_fl(void)
+extern inline unsigned long native_save_fl(void)
{
unsigned long flags;
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 02d6f5cf4e70..8824d01c0c35 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -61,6 +61,7 @@ obj-y += alternative.o i8253.o hw_breakpoint.o
obj-y += tsc.o tsc_msr.o io_delay.o rtc.o
obj-y += pci-iommu_table.o
obj-y += resource.o
+obj-y += irqflags.o
obj-y += process.o
obj-y += fpu/
diff --git a/arch/x86/kernel/irqflags.S b/arch/x86/kernel/irqflags.S
new file mode 100644
index 000000000000..ddeeaac8adda
--- /dev/null
+++ b/arch/x86/kernel/irqflags.S
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#include <asm/asm.h>
+#include <asm/export.h>
+#include <linux/linkage.h>
+
+/*
+ * unsigned long native_save_fl(void)
+ */
+ENTRY(native_save_fl)
+ pushf
+ pop %_ASM_AX
+ ret
+ENDPROC(native_save_fl)
+EXPORT_SYMBOL(native_save_fl)
+
+/*
+ * void native_restore_fl(unsigned long flags)
+ * %eax/%rdi: flags
+ */
+ENTRY(native_restore_fl)
+ push %_ASM_ARG1
+ popf
+ ret
+ENDPROC(native_restore_fl)
+EXPORT_SYMBOL(native_restore_fl)
^ permalink raw reply related [flat|nested] 13+ messages in thread
[parent not found: <1e19dbef068b45a4a4e9eb4072e097be@AcuMS.aculab.com>]
* Re: [PATCH v6 3/3] x86: paravirt: make native_save_fl extern inline
[not found] ` <1e19dbef068b45a4a4e9eb4072e097be@AcuMS.aculab.com>
@ 2018-07-16 17:27 ` Nick Desaulniers
0 siblings, 0 replies; 13+ messages in thread
From: Nick Desaulniers @ 2018-07-16 17:27 UTC (permalink / raw)
To: David.Laight
Cc: mingo, Thomas Gleixner, Andrew Morton, hpa, linux-efi, LKML, x86,
virtualization, Alistair Strachan, Manoj Gupta, Greg Hackmann,
sedat.dilek, tstellar, Kees Cook, Masahiro Yamada, Michal Marek,
Linux Kbuild mailing list, Geert Uytterhoeven, Will Deacon,
mawilcox, Arnd Bergmann, David Rientjes, acme,
Philippe Ombredanne, Andrey Ryabinin, Kate Stewart,
boris.ostrovsky, J. Kiszka, rostedt, Kirill A . Shutemov,
Ard Biesheuvel, akataria, brijesh.singh, Cao jin, Greg KH,
jarkko.sakkinen, jgross, Josh Poimboeuf, Matthias Kaehlcke,
thomas.lendacky, Thiebaud Weksteen, mjg59, joe, andrea.parri
On Fri, Jul 13, 2018 at 3:15 AM David Laight <David.Laight@aculab.com> wrote:
>
> From: Nick Desaulniers
> > Sent: 21 June 2018 17:23
> >
> > native_save_fl() is marked static inline, but by using it as
> > a function pointer in arch/x86/kernel/paravirt.c, it MUST be outlined.
> >
> > paravirt's use of native_save_fl() also requires that no GPRs other than
> > %rax are clobbered.
> ...
> > diff --git a/arch/x86/include/asm/irqflags.h b/arch/x86/include/asm/irqflags.h
> > index 89f08955fff7..c4fc17220df9 100644
> > --- a/arch/x86/include/asm/irqflags.h
> > +++ b/arch/x86/include/asm/irqflags.h
> > @@ -13,7 +13,7 @@
> > * Interrupt control:
> > */
> >
> > -static inline unsigned long native_save_fl(void)
> > +extern inline unsigned long native_save_fl(void)
>
> This is generating a the compilation warning (that we treat as an error):
> "no previous prototype for 'native_save_fl".
> Fixable by replicating the line with an appended ;
Thanks for the report and sorry for breaking things for you. Just
curious about more information to try to reproduce the issue to make
sure I fix the issue correctly:
* What compiler and compiler version are you using?
* Are you setting any configs or enabling any warning CFLAGS to see this?
* Do you see this warning for other `extern inline` functions? (It
seems like the few other ones in the kernel are for non-x86 archs)
I would have guessed that extern inline functions with gnu_inline
semantics (gnu89 behavior) should not have a previous declaration, but
it probably doesn't hurt to add it.
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 13+ messages in thread