Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Revert "compiler-gcc: disable -ftracer for __noclone functions"

The -ftracer optimization was disabled in __noclone as a workaround to
GCC duplicating a blob of inline assembly that happened to define a
global variable. It has been pointed out that no amount of workarounds
can guarantee the compiler won't duplicate inline assembly[1], and that
disabling the -ftracer optimization has several unintended and nasty
side effects[2][3].

Now that the offending KVM code which required the workaround has
been properly fixed and no longer uses __noclone, remove the -ftracer
optimization tweak from __noclone.

[1] https://lore.kernel.org/lkml/ri6y38lo23g.fsf@suse.cz/T/#u
[2] https://lore.kernel.org/lkml/20181218140105.ajuiglkpvstt3qxs@treble/T/#u
[3] https://patchwork.kernel.org/patch/8707981/#21817015

This reverts commit 95272c29378ee7dc15f43fa2758cb28a5913a06d.

Suggested-by: Andi Kleen <ak@linux.intel.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Nadav Amit <namit@vmware.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Martin Jambor <mjambor@suse.cz>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Miroslav Benes <mbenes@suse.cz>
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Reviewed-by: Andi Kleen <ak@linux.intel.com>
Reviewed-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

authored by

Sean Christopherson and committed by
Paolo Bonzini
2bcbd406 453eafbe

+1 -8
+1 -8
include/linux/compiler_attributes.h
··· 37 37 # define __GCC4_has_attribute___designated_init__ 0 38 38 # define __GCC4_has_attribute___externally_visible__ 1 39 39 # define __GCC4_has_attribute___noclone__ 1 40 - # define __GCC4_has_attribute___optimize__ 1 41 40 # define __GCC4_has_attribute___nonstring__ 0 42 41 # define __GCC4_has_attribute___no_sanitize_address__ (__GNUC_MINOR__ >= 8) 43 42 #endif ··· 162 163 163 164 /* 164 165 * Optional: not supported by clang 165 - * Note: icc does not recognize gcc's no-tracer 166 166 * 167 167 * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-noclone-function-attribute 168 - * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-optimize-function-attribute 169 168 */ 170 169 #if __has_attribute(__noclone__) 171 - # if __has_attribute(__optimize__) 172 - # define __noclone __attribute__((__noclone__, __optimize__("no-tracer"))) 173 - # else 174 - # define __noclone __attribute__((__noclone__)) 175 - # endif 170 + # define __noclone __attribute__((__noclone__)) 176 171 #else 177 172 # define __noclone 178 173 #endif