[PATCH 4.4 05/31] x86/asm: Add _ASM_ARG* constants for argument registers to
4.4-stable review patch. If anyone has any objections, please let me know. -- From: H. Peter Anvin commit 0e2e160033283e20f688d8bad5b89460cc5bfcc4 upstream. 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 Signed-off-by: Nick Desaulniers Reviewed-by: Sedat Dilek Acked-by: Juergen Gross Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: a...@redhat.com Cc: akata...@vmware.com Cc: a...@linux-foundation.org Cc: andrea.pa...@amarulasolutions.com Cc: ard.biesheu...@linaro.org Cc: a...@arndb.de Cc: aryabi...@virtuozzo.com Cc: astrac...@google.com Cc: boris.ostrov...@oracle.com Cc: brijesh.si...@amd.com Cc: caoj.f...@cn.fujitsu.com Cc: ge...@linux-m68k.org Cc: ghackm...@google.com Cc: gre...@linuxfoundation.org Cc: jan.kis...@siemens.com Cc: jarkko.sakki...@linux.intel.com Cc: j...@perches.com Cc: jpoim...@redhat.com Cc: keesc...@google.com Cc: kirill.shute...@linux.intel.com Cc: kstew...@linuxfoundation.org Cc: linux-efi@vger.kernel.org Cc: linux-kbu...@vger.kernel.org Cc: manojgu...@google.com Cc: mawil...@microsoft.com Cc: michal.l...@markovi.net Cc: mj...@google.com Cc: m...@chromium.org Cc: pombreda...@nexb.com Cc: rient...@google.com Cc: rost...@goodmis.org Cc: thomas.lenda...@amd.com Cc: tstel...@redhat.com Cc: tw...@google.com Cc: virtualizat...@lists.linux-foundation.org Cc: will.dea...@arm.com Cc: yamada.masah...@socionext.com Link: http://lkml.kernel.org/r/20180621162324.36656-3-ndesaulni...@google.com Signed-off-by: Ingo Molnar Signed-off-by: Greg Kroah-Hartman --- arch/x86/include/asm/asm.h | 59 + 1 file changed, 59 insertions(+) --- a/arch/x86/include/asm/asm.h +++ b/arch/x86/include/asm/asm.h @@ -44,6 +44,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 + /* Exception table entry */ #ifdef __ASSEMBLY__ # define _ASM_EXTABLE(from,to) \ -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4.9 05/66] compiler-gcc.h: Add __attribute__((gnu_inline)) to all inline declarations
4.9-stable review patch. If anyone has any objections, please let me know. -- From: Nick Desaulniers commit d03db2bc26f0e4a6849ad649a09c9c73fccdc656 upstream. 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 Suggested-by: H. Peter Anvin Suggested-by: Joe Perches Signed-off-by: Nick Desaulniers Acked-by: Juergen Gross Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: a...@redhat.com Cc: akata...@vmware.com Cc: a...@linux-foundation.org Cc: andrea.pa...@amarulasolutions.com Cc: ard.biesheu...@linaro.org Cc: aryabi...@virtuozzo.com Cc: astrac...@google.com Cc: boris.ostrov...@oracle.com Cc: brijesh.si...@amd.com Cc: caoj.f...@cn.fujitsu.com Cc: ge...@linux-m68k.org Cc: ghackm...@google.com Cc: gre...@linuxfoundation.org Cc: jan.kis...@siemens.com Cc: jarkko.sakki...@linux.intel.com Cc: jpoim...@redhat.com Cc: keesc...@google.com Cc: kirill.shute...@linux.intel.com Cc: kstew...@linuxfoundation.org Cc: linux-efi@vger.kernel.org Cc: linux-kbu...@vger.kernel.org Cc: manojgu...@google.com Cc: mawil...@microsoft.com Cc: michal.l...@markovi.net Cc: mj...@google.com Cc: m...@chromium.org Cc: pombreda...@nexb.com Cc: rient...@google.com Cc: rost...@goodmis.org Cc: sedat.di...@gmail.com Cc: thomas.lenda...@amd.com Cc: tstel...@redhat.com Cc: tw...@google.com Cc: virtualizat...@lists.linux-foundation.org Cc: will.dea...@arm.com Cc: yamada.masah...@socionext.com Link: http://lkml.kernel.org/r/20180621162324.36656-2-ndesaulni...@google.com Signed-off-by: Ingo Molnar Signed-off-by: Greg Kroah-Hartman --- include/linux/compiler-gcc.h | 29 ++--- 1 file changed, 22 insertions(+), 7 deletions(-) --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h @@ -65,25 +65,40 @@ #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. * GCC does not warn about unused static inline functions for * -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_inlineinline __attribute__((always_inline)) #define noinline __attribute__((noinline)) -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4.9 06/66] x86/asm: Add _ASM_ARG* constants for argument registers to
4.9-stable review patch. If anyone has any objections, please let me know. -- From: H. Peter Anvin commit 0e2e160033283e20f688d8bad5b89460cc5bfcc4 upstream. 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 Signed-off-by: Nick Desaulniers Reviewed-by: Sedat Dilek Acked-by: Juergen Gross Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: a...@redhat.com Cc: akata...@vmware.com Cc: a...@linux-foundation.org Cc: andrea.pa...@amarulasolutions.com Cc: ard.biesheu...@linaro.org Cc: a...@arndb.de Cc: aryabi...@virtuozzo.com Cc: astrac...@google.com Cc: boris.ostrov...@oracle.com Cc: brijesh.si...@amd.com Cc: caoj.f...@cn.fujitsu.com Cc: ge...@linux-m68k.org Cc: ghackm...@google.com Cc: gre...@linuxfoundation.org Cc: jan.kis...@siemens.com Cc: jarkko.sakki...@linux.intel.com Cc: j...@perches.com Cc: jpoim...@redhat.com Cc: keesc...@google.com Cc: kirill.shute...@linux.intel.com Cc: kstew...@linuxfoundation.org Cc: linux-efi@vger.kernel.org Cc: linux-kbu...@vger.kernel.org Cc: manojgu...@google.com Cc: mawil...@microsoft.com Cc: michal.l...@markovi.net Cc: mj...@google.com Cc: m...@chromium.org Cc: pombreda...@nexb.com Cc: rient...@google.com Cc: rost...@goodmis.org Cc: thomas.lenda...@amd.com Cc: tstel...@redhat.com Cc: tw...@google.com Cc: virtualizat...@lists.linux-foundation.org Cc: will.dea...@arm.com Cc: yamada.masah...@socionext.com Link: http://lkml.kernel.org/r/20180621162324.36656-3-ndesaulni...@google.com Signed-off-by: Ingo Molnar Signed-off-by: Greg Kroah-Hartman --- arch/x86/include/asm/asm.h | 59 + 1 file changed, 59 insertions(+) --- a/arch/x86/include/asm/asm.h +++ b/arch/x86/include/asm/asm.h @@ -45,6 +45,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". -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4.14 01/92] compiler-gcc.h: Add __attribute__((gnu_inline)) to all inline declarations
4.14-stable review patch. If anyone has any objections, please let me know. -- From: Nick Desaulniers commit d03db2bc26f0e4a6849ad649a09c9c73fccdc656 upstream. 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 Suggested-by: H. Peter Anvin Suggested-by: Joe Perches Signed-off-by: Nick Desaulniers Acked-by: Juergen Gross Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: a...@redhat.com Cc: akata...@vmware.com Cc: a...@linux-foundation.org Cc: andrea.pa...@amarulasolutions.com Cc: ard.biesheu...@linaro.org Cc: aryabi...@virtuozzo.com Cc: astrac...@google.com Cc: boris.ostrov...@oracle.com Cc: brijesh.si...@amd.com Cc: caoj.f...@cn.fujitsu.com Cc: ge...@linux-m68k.org Cc: ghackm...@google.com Cc: gre...@linuxfoundation.org Cc: jan.kis...@siemens.com Cc: jarkko.sakki...@linux.intel.com Cc: jpoim...@redhat.com Cc: keesc...@google.com Cc: kirill.shute...@linux.intel.com Cc: kstew...@linuxfoundation.org Cc: linux-efi@vger.kernel.org Cc: linux-kbu...@vger.kernel.org Cc: manojgu...@google.com Cc: mawil...@microsoft.com Cc: michal.l...@markovi.net Cc: mj...@google.com Cc: m...@chromium.org Cc: pombreda...@nexb.com Cc: rient...@google.com Cc: rost...@goodmis.org Cc: sedat.di...@gmail.com Cc: thomas.lenda...@amd.com Cc: tstel...@redhat.com Cc: tw...@google.com Cc: virtualizat...@lists.linux-foundation.org Cc: will.dea...@arm.com Cc: yamada.masah...@socionext.com Link: http://lkml.kernel.org/r/20180621162324.36656-2-ndesaulni...@google.com Signed-off-by: Ingo Molnar Signed-off-by: Greg Kroah-Hartman --- include/linux/compiler-gcc.h | 29 ++--- 1 file changed, 22 insertions(+), 7 deletions(-) --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h @@ -66,25 +66,40 @@ #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. * GCC does not warn about unused static inline functions for * -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_inlineinline __attribute__((always_inline)) #define noinline __attribute__((noinline)) -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4.14 03/92] x86/paravirt: Make native_save_fl() extern inline
4.14-stable review patch. If anyone has any objections, please let me know. -- From: Nick Desaulniers commit d0a8d9378d16eb3c69bd8e6d23779fbdbee3a8c7 upstream. 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 Debugged-by: Matthias Kaehlcke Suggested-by: Arnd Bergmann Suggested-by: H. Peter Anvin Suggested-by: Tom Stellar Reported-by: Sedat Dilek Tested-by: Sedat Dilek Signed-off-by: Nick Desaulniers Acked-by: Juergen Gross Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: a...@redhat.com Cc: akata...@vmware.com Cc: a...@linux-foundation.org Cc: andrea.pa...@amarulasolutions.com Cc: ard.biesheu...@linaro.org Cc: aryabi...@virtuozzo.com Cc: astrac...@google.com Cc: boris.ostrov...@oracle.com Cc: brijesh.si...@amd.com Cc: caoj.f...@cn.fujitsu.com Cc: ge...@linux-m68k.org Cc: ghackm...@google.com Cc: gre...@linuxfoundation.org Cc: jan.kis...@siemens.com Cc: jarkko.sakki...@linux.intel.com Cc: j...@perches.com Cc: jpoim...@redhat.com Cc: keesc...@google.com Cc: kirill.shute...@linux.intel.com Cc: kstew...@linuxfoundation.org Cc: linux-efi@vger.kernel.org Cc: linux-kbu...@vger.kernel.org Cc: manojgu...@google.com Cc: mawil...@microsoft.com Cc: michal.l...@markovi.net Cc: mj...@google.com Cc: m...@chromium.org Cc: pombreda...@nexb.com Cc: rient...@google.com Cc: rost...@goodmis.org Cc: thomas.lenda...@amd.com Cc: tw...@google.com Cc: virtualizat...@lists.linux-foundation.org Cc: will.dea...@arm.com Cc: yamada.masah...@socionext.com Link: http://lkml.kernel.org/r/20180621162324.36656-4-ndesaulni...@google.com Signed-off-by: Ingo Molnar Signed-off-by: Greg Kroah-Hartman --- 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(-) --- 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; --- a/arch/x86/kernel/Makefile +++ b/arch/x86/kernel/Makefile @@ -58,6 +58,7 @@ obj-y += alternative.o i8253.o pci-nom 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/ --- /dev/null +++ b/arch/x86/kernel/irqflags.S @@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#include +#include +#include + +/* + * 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) -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4.17 002/101] x86/asm: Add _ASM_ARG* constants for argument registers to
4.17-stable review patch. If anyone has any objections, please let me know. -- From: H. Peter Anvin commit 0e2e160033283e20f688d8bad5b89460cc5bfcc4 upstream. 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 Signed-off-by: Nick Desaulniers Reviewed-by: Sedat Dilek Acked-by: Juergen Gross Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: a...@redhat.com Cc: akata...@vmware.com Cc: a...@linux-foundation.org Cc: andrea.pa...@amarulasolutions.com Cc: ard.biesheu...@linaro.org Cc: a...@arndb.de Cc: aryabi...@virtuozzo.com Cc: astrac...@google.com Cc: boris.ostrov...@oracle.com Cc: brijesh.si...@amd.com Cc: caoj.f...@cn.fujitsu.com Cc: ge...@linux-m68k.org Cc: ghackm...@google.com Cc: gre...@linuxfoundation.org Cc: jan.kis...@siemens.com Cc: jarkko.sakki...@linux.intel.com Cc: j...@perches.com Cc: jpoim...@redhat.com Cc: keesc...@google.com Cc: kirill.shute...@linux.intel.com Cc: kstew...@linuxfoundation.org Cc: linux-efi@vger.kernel.org Cc: linux-kbu...@vger.kernel.org Cc: manojgu...@google.com Cc: mawil...@microsoft.com Cc: michal.l...@markovi.net Cc: mj...@google.com Cc: m...@chromium.org Cc: pombreda...@nexb.com Cc: rient...@google.com Cc: rost...@goodmis.org Cc: thomas.lenda...@amd.com Cc: tstel...@redhat.com Cc: tw...@google.com Cc: virtualizat...@lists.linux-foundation.org Cc: will.dea...@arm.com Cc: yamada.masah...@socionext.com Link: http://lkml.kernel.org/r/20180621162324.36656-3-ndesaulni...@google.com Signed-off-by: Ingo Molnar Signed-off-by: Greg Kroah-Hartman --- arch/x86/include/asm/asm.h | 59 + 1 file changed, 59 insertions(+) --- 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". -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4.17 003/101] x86/paravirt: Make native_save_fl() extern inline
4.17-stable review patch. If anyone has any objections, please let me know. -- From: Nick Desaulniers commit d0a8d9378d16eb3c69bd8e6d23779fbdbee3a8c7 upstream. 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 Debugged-by: Matthias Kaehlcke Suggested-by: Arnd Bergmann Suggested-by: H. Peter Anvin Suggested-by: Tom Stellar Reported-by: Sedat Dilek Tested-by: Sedat Dilek Signed-off-by: Nick Desaulniers Acked-by: Juergen Gross Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: a...@redhat.com Cc: akata...@vmware.com Cc: a...@linux-foundation.org Cc: andrea.pa...@amarulasolutions.com Cc: ard.biesheu...@linaro.org Cc: aryabi...@virtuozzo.com Cc: astrac...@google.com Cc: boris.ostrov...@oracle.com Cc: brijesh.si...@amd.com Cc: caoj.f...@cn.fujitsu.com Cc: ge...@linux-m68k.org Cc: ghackm...@google.com Cc: gre...@linuxfoundation.org Cc: jan.kis...@siemens.com Cc: jarkko.sakki...@linux.intel.com Cc: j...@perches.com Cc: jpoim...@redhat.com Cc: keesc...@google.com Cc: kirill.shute...@linux.intel.com Cc: kstew...@linuxfoundation.org Cc: linux-efi@vger.kernel.org Cc: linux-kbu...@vger.kernel.org Cc: manojgu...@google.com Cc: mawil...@microsoft.com Cc: michal.l...@markovi.net Cc: mj...@google.com Cc: m...@chromium.org Cc: pombreda...@nexb.com Cc: rient...@google.com Cc: rost...@goodmis.org Cc: thomas.lenda...@amd.com Cc: tw...@google.com Cc: virtualizat...@lists.linux-foundation.org Cc: will.dea...@arm.com Cc: yamada.masah...@socionext.com Link: http://lkml.kernel.org/r/20180621162324.36656-4-ndesaulni...@google.com Signed-off-by: Ingo Molnar Signed-off-by: Greg Kroah-Hartman --- 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(-) --- 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; --- a/arch/x86/kernel/Makefile +++ b/arch/x86/kernel/Makefile @@ -61,6 +61,7 @@ obj-y += alternative.o i8253.o hw_brea 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/ --- /dev/null +++ b/arch/x86/kernel/irqflags.S @@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#include +#include +#include + +/* + * 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) -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4.17 001/101] compiler-gcc.h: Add __attribute__((gnu_inline)) to all inline declarations
4.17-stable review patch. If anyone has any objections, please let me know. -- From: Nick Desaulniers commit d03db2bc26f0e4a6849ad649a09c9c73fccdc656 upstream. 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 Suggested-by: H. Peter Anvin Suggested-by: Joe Perches Signed-off-by: Nick Desaulniers Acked-by: Juergen Gross Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: a...@redhat.com Cc: akata...@vmware.com Cc: a...@linux-foundation.org Cc: andrea.pa...@amarulasolutions.com Cc: ard.biesheu...@linaro.org Cc: aryabi...@virtuozzo.com Cc: astrac...@google.com Cc: boris.ostrov...@oracle.com Cc: brijesh.si...@amd.com Cc: caoj.f...@cn.fujitsu.com Cc: ge...@linux-m68k.org Cc: ghackm...@google.com Cc: gre...@linuxfoundation.org Cc: jan.kis...@siemens.com Cc: jarkko.sakki...@linux.intel.com Cc: jpoim...@redhat.com Cc: keesc...@google.com Cc: kirill.shute...@linux.intel.com Cc: kstew...@linuxfoundation.org Cc: linux-efi@vger.kernel.org Cc: linux-kbu...@vger.kernel.org Cc: manojgu...@google.com Cc: mawil...@microsoft.com Cc: michal.l...@markovi.net Cc: mj...@google.com Cc: m...@chromium.org Cc: pombreda...@nexb.com Cc: rient...@google.com Cc: rost...@goodmis.org Cc: sedat.di...@gmail.com Cc: thomas.lenda...@amd.com Cc: tstel...@redhat.com Cc: tw...@google.com Cc: virtualizat...@lists.linux-foundation.org Cc: will.dea...@arm.com Cc: yamada.masah...@socionext.com Link: http://lkml.kernel.org/r/20180621162324.36656-2-ndesaulni...@google.com Signed-off-by: Ingo Molnar Signed-off-by: Greg Kroah-Hartman --- include/linux/compiler-gcc.h | 29 ++--- 1 file changed, 22 insertions(+), 7 deletions(-) --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h @@ -66,25 +66,40 @@ #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. * GCC does not warn about unused static inline functions for * -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_inlineinline __attribute__((always_inline)) #define noinline __attribute__((noinline)) -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4.14 02/92] x86/asm: Add _ASM_ARG* constants for argument registers to
4.14-stable review patch. If anyone has any objections, please let me know. -- From: H. Peter Anvin commit 0e2e160033283e20f688d8bad5b89460cc5bfcc4 upstream. 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 Signed-off-by: Nick Desaulniers Reviewed-by: Sedat Dilek Acked-by: Juergen Gross Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: a...@redhat.com Cc: akata...@vmware.com Cc: a...@linux-foundation.org Cc: andrea.pa...@amarulasolutions.com Cc: ard.biesheu...@linaro.org Cc: a...@arndb.de Cc: aryabi...@virtuozzo.com Cc: astrac...@google.com Cc: boris.ostrov...@oracle.com Cc: brijesh.si...@amd.com Cc: caoj.f...@cn.fujitsu.com Cc: ge...@linux-m68k.org Cc: ghackm...@google.com Cc: gre...@linuxfoundation.org Cc: jan.kis...@siemens.com Cc: jarkko.sakki...@linux.intel.com Cc: j...@perches.com Cc: jpoim...@redhat.com Cc: keesc...@google.com Cc: kirill.shute...@linux.intel.com Cc: kstew...@linuxfoundation.org Cc: linux-efi@vger.kernel.org Cc: linux-kbu...@vger.kernel.org Cc: manojgu...@google.com Cc: mawil...@microsoft.com Cc: michal.l...@markovi.net Cc: mj...@google.com Cc: m...@chromium.org Cc: pombreda...@nexb.com Cc: rient...@google.com Cc: rost...@goodmis.org Cc: thomas.lenda...@amd.com Cc: tstel...@redhat.com Cc: tw...@google.com Cc: virtualizat...@lists.linux-foundation.org Cc: will.dea...@arm.com Cc: yamada.masah...@socionext.com Link: http://lkml.kernel.org/r/20180621162324.36656-3-ndesaulni...@google.com Signed-off-by: Ingo Molnar Signed-off-by: Greg Kroah-Hartman --- arch/x86/include/asm/asm.h | 59 + 1 file changed, 59 insertions(+) --- 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". -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4.9 07/66] x86/paravirt: Make native_save_fl() extern inline
4.9-stable review patch. If anyone has any objections, please let me know. -- From: Nick Desaulniers commit d0a8d9378d16eb3c69bd8e6d23779fbdbee3a8c7 upstream. 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 Debugged-by: Matthias Kaehlcke Suggested-by: Arnd Bergmann Suggested-by: H. Peter Anvin Suggested-by: Tom Stellar Reported-by: Sedat Dilek Tested-by: Sedat Dilek Signed-off-by: Nick Desaulniers Acked-by: Juergen Gross Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: a...@redhat.com Cc: akata...@vmware.com Cc: a...@linux-foundation.org Cc: andrea.pa...@amarulasolutions.com Cc: ard.biesheu...@linaro.org Cc: aryabi...@virtuozzo.com Cc: astrac...@google.com Cc: boris.ostrov...@oracle.com Cc: brijesh.si...@amd.com Cc: caoj.f...@cn.fujitsu.com Cc: ge...@linux-m68k.org Cc: ghackm...@google.com Cc: gre...@linuxfoundation.org Cc: jan.kis...@siemens.com Cc: jarkko.sakki...@linux.intel.com Cc: j...@perches.com Cc: jpoim...@redhat.com Cc: keesc...@google.com Cc: kirill.shute...@linux.intel.com Cc: kstew...@linuxfoundation.org Cc: linux-efi@vger.kernel.org Cc: linux-kbu...@vger.kernel.org Cc: manojgu...@google.com Cc: mawil...@microsoft.com Cc: michal.l...@markovi.net Cc: mj...@google.com Cc: m...@chromium.org Cc: pombreda...@nexb.com Cc: rient...@google.com Cc: rost...@goodmis.org Cc: thomas.lenda...@amd.com Cc: tw...@google.com Cc: virtualizat...@lists.linux-foundation.org Cc: will.dea...@arm.com Cc: yamada.masah...@socionext.com Link: http://lkml.kernel.org/r/20180621162324.36656-4-ndesaulni...@google.com Signed-off-by: Ingo Molnar Signed-off-by: Greg Kroah-Hartman --- 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(-) --- a/arch/x86/include/asm/irqflags.h +++ b/arch/x86/include/asm/irqflags.h @@ -12,7 +12,7 @@ * Interrupt control: */ -static inline unsigned long native_save_fl(void) +extern inline unsigned long native_save_fl(void) { unsigned long flags; --- a/arch/x86/kernel/Makefile +++ b/arch/x86/kernel/Makefile @@ -56,6 +56,7 @@ obj-y += alternative.o i8253.o pci-nom 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/ --- /dev/null +++ b/arch/x86/kernel/irqflags.S @@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#include +#include +#include + +/* + * 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) -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4.4 04/31] compiler-gcc.h: Add __attribute__((gnu_inline)) to all inline declarations
4.4-stable review patch. If anyone has any objections, please let me know. -- From: Nick Desaulniers commit d03db2bc26f0e4a6849ad649a09c9c73fccdc656 upstream. 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 Suggested-by: H. Peter Anvin Suggested-by: Joe Perches Signed-off-by: Nick Desaulniers Acked-by: Juergen Gross Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: a...@redhat.com Cc: akata...@vmware.com Cc: a...@linux-foundation.org Cc: andrea.pa...@amarulasolutions.com Cc: ard.biesheu...@linaro.org Cc: aryabi...@virtuozzo.com Cc: astrac...@google.com Cc: boris.ostrov...@oracle.com Cc: brijesh.si...@amd.com Cc: caoj.f...@cn.fujitsu.com Cc: ge...@linux-m68k.org Cc: ghackm...@google.com Cc: gre...@linuxfoundation.org Cc: jan.kis...@siemens.com Cc: jarkko.sakki...@linux.intel.com Cc: jpoim...@redhat.com Cc: keesc...@google.com Cc: kirill.shute...@linux.intel.com Cc: kstew...@linuxfoundation.org Cc: linux-efi@vger.kernel.org Cc: linux-kbu...@vger.kernel.org Cc: manojgu...@google.com Cc: mawil...@microsoft.com Cc: michal.l...@markovi.net Cc: mj...@google.com Cc: m...@chromium.org Cc: pombreda...@nexb.com Cc: rient...@google.com Cc: rost...@goodmis.org Cc: sedat.di...@gmail.com Cc: thomas.lenda...@amd.com Cc: tstel...@redhat.com Cc: tw...@google.com Cc: virtualizat...@lists.linux-foundation.org Cc: will.dea...@arm.com Cc: yamada.masah...@socionext.com Link: http://lkml.kernel.org/r/20180621162324.36656-2-ndesaulni...@google.com Signed-off-by: Ingo Molnar Signed-off-by: Greg Kroah-Hartman --- include/linux/compiler-gcc.h | 29 ++--- 1 file changed, 22 insertions(+), 7 deletions(-) --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h @@ -65,25 +65,40 @@ #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. * GCC does not warn about unused static inline functions for * -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_inlineinline __attribute__((always_inline)) #define noinline __attribute__((noinline)) -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html