History

Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 fixes from Thomas Gleixner: "The final fixes for 4.11: - prevent a triple fault with function graph tracing triggered via suspend to ram - prevent optimizing for size when function graph tracing is enabled and the compiler does not support -mfentry - prevent mwaitx() being called with a zero timeout as mwaitx() might never return. Observed on the new Ryzen CPUs" * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: Prevent timer value 0 for MWAITX x86/build: convert function graph '-Os' error to warning ftrace/x86: Fix triple fault with graph tracing and suspend-to-ram

Linus Torvalds committed 9 years ago

Commit 97ce89f2 parents 14e07f0 88d879d3 files · +27 −6Browse files

Unified · Split

3 files
  1. arch/x86/Makefile +8 −0
  2. arch/x86/kernel/ftrace.c +12 −6
  3. arch/x86/lib/delay.c +7 −0
arch/x86/Makefile+8−0
@@ -154,6 +154,14 @@ ifdef CONFIG_FUNCTION_GRAPH_TRACER · 153 unmodified lines
154 else154 else
155 ifeq ($(call cc-option-yn, -mfentry), n)155 ifeq ($(call cc-option-yn, -mfentry), n)
156 ACCUMULATE_OUTGOING_ARGS := 1156 ACCUMULATE_OUTGOING_ARGS := 1
157
158 # GCC ignores '-maccumulate-outgoing-args' when used with '-Os'.
159 # If '-Os' is enabled, disable it and print a warning.
160 ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
161 undefine CONFIG_CC_OPTIMIZE_FOR_SIZE
162 $(warning Disabling CONFIG_CC_OPTIMIZE_FOR_SIZE. Your compiler does not have -mfentry so you cannot optimize for size with CONFIG_FUNCTION_GRAPH_TRACER.)
163 endif
164
157 endif165 endif
158 endif166 endif
159endif167endif
arch/x86/kernel/ftrace.c+12−6
@@ -29,12 +29,6 @@ · 28 unmodified lines
29#include <asm/ftrace.h>29#include <asm/ftrace.h>
30#include <asm/nops.h>30#include <asm/nops.h>
31 31
32#if defined(CONFIG_FUNCTION_GRAPH_TRACER) && \
33 !defined(CC_USING_FENTRY) && \
34 !defined(CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE)
35# error The following combination is not supported: ((compiler missing -mfentry) || (CONFIG_X86_32 and !CONFIG_DYNAMIC_FTRACE)) && CONFIG_FUNCTION_GRAPH_TRACER && CONFIG_CC_OPTIMIZE_FOR_SIZE
36#endif
37
38#ifdef CONFIG_DYNAMIC_FTRACE32#ifdef CONFIG_DYNAMIC_FTRACE
39 33
40int ftrace_arch_code_modify_prepare(void)34int ftrace_arch_code_modify_prepare(void)
@@ -989,6 +983,18 @@ void prepare_ftrace_return(unsigned long self_addr, unsigned long *parent, · 948 unmodified lines
989 unsigned long return_hooker = (unsigned long)983 unsigned long return_hooker = (unsigned long)
990 &return_to_handler;984 &return_to_handler;
991 985
986 /*
987 * When resuming from suspend-to-ram, this function can be indirectly
988 * called from early CPU startup code while the CPU is in real mode,
989 * which would fail miserably. Make sure the stack pointer is a
990 * virtual address.
991 *
992 * This check isn't as accurate as virt_addr_valid(), but it should be
993 * good enough for this purpose, and it's fast.
994 */
995 if (unlikely((long)__builtin_frame_address(0) >= 0))
996 return;
997
992 if (unlikely(ftrace_graph_is_dead()))998 if (unlikely(ftrace_graph_is_dead()))
993 return;999 return;
994 1000
arch/x86/lib/delay.c+7−0
@@ -93,6 +93,13 @@ static void delay_mwaitx(unsigned long __loops) · 92 unmodified lines
93{93{
94 u64 start, end, delay, loops = __loops;94 u64 start, end, delay, loops = __loops;
95 95
96 /*
97 * Timer value of 0 causes MWAITX to wait indefinitely, unless there
98 * is a store on the memory monitored by MONITORX.
99 */
100 if (loops == 0)
101 return;
102
96 start = rdtsc_ordered();103 start = rdtsc_ordered();
97 104
98 for (;;) {105 for (;;) {