mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-29 23:24:11 +08:00
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
This commit is contained in:
commit
97ce89f8a4
@ -154,6 +154,14 @@ ifdef CONFIG_FUNCTION_GRAPH_TRACER
|
|||||||
else
|
else
|
||||||
ifeq ($(call cc-option-yn, -mfentry), n)
|
ifeq ($(call cc-option-yn, -mfentry), n)
|
||||||
ACCUMULATE_OUTGOING_ARGS := 1
|
ACCUMULATE_OUTGOING_ARGS := 1
|
||||||
|
|
||||||
|
# GCC ignores '-maccumulate-outgoing-args' when used with '-Os'.
|
||||||
|
# If '-Os' is enabled, disable it and print a warning.
|
||||||
|
ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
|
||||||
|
undefine CONFIG_CC_OPTIMIZE_FOR_SIZE
|
||||||
|
$(warning Disabling CONFIG_CC_OPTIMIZE_FOR_SIZE. Your compiler does not have -mfentry so you cannot optimize for size with CONFIG_FUNCTION_GRAPH_TRACER.)
|
||||||
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
@ -29,12 +29,6 @@
|
|||||||
#include <asm/ftrace.h>
|
#include <asm/ftrace.h>
|
||||||
#include <asm/nops.h>
|
#include <asm/nops.h>
|
||||||
|
|
||||||
#if defined(CONFIG_FUNCTION_GRAPH_TRACER) && \
|
|
||||||
!defined(CC_USING_FENTRY) && \
|
|
||||||
!defined(CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE)
|
|
||||||
# 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
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_DYNAMIC_FTRACE
|
#ifdef CONFIG_DYNAMIC_FTRACE
|
||||||
|
|
||||||
int ftrace_arch_code_modify_prepare(void)
|
int ftrace_arch_code_modify_prepare(void)
|
||||||
@ -989,6 +983,18 @@ void prepare_ftrace_return(unsigned long self_addr, unsigned long *parent,
|
|||||||
unsigned long return_hooker = (unsigned long)
|
unsigned long return_hooker = (unsigned long)
|
||||||
&return_to_handler;
|
&return_to_handler;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* When resuming from suspend-to-ram, this function can be indirectly
|
||||||
|
* called from early CPU startup code while the CPU is in real mode,
|
||||||
|
* which would fail miserably. Make sure the stack pointer is a
|
||||||
|
* virtual address.
|
||||||
|
*
|
||||||
|
* This check isn't as accurate as virt_addr_valid(), but it should be
|
||||||
|
* good enough for this purpose, and it's fast.
|
||||||
|
*/
|
||||||
|
if (unlikely((long)__builtin_frame_address(0) >= 0))
|
||||||
|
return;
|
||||||
|
|
||||||
if (unlikely(ftrace_graph_is_dead()))
|
if (unlikely(ftrace_graph_is_dead()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -93,6 +93,13 @@ static void delay_mwaitx(unsigned long __loops)
|
|||||||
{
|
{
|
||||||
u64 start, end, delay, loops = __loops;
|
u64 start, end, delay, loops = __loops;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Timer value of 0 causes MWAITX to wait indefinitely, unless there
|
||||||
|
* is a store on the memory monitored by MONITORX.
|
||||||
|
*/
|
||||||
|
if (loops == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
start = rdtsc_ordered();
|
start = rdtsc_ordered();
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
Loading…
Reference in New Issue
Block a user