Skip to content

Commit 061f49e

Browse files
committed
Merge branch 'x86/urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 fixes from Peter Anvin: "Sorry, meant to push out this batch earlier this weekend" * 'x86/urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86, fpu, amd: Clear exceptions in AMD FXSAVE workaround ftrace/x86: Load ftrace_ops in parameter not the variable holding it
2 parents 7e22e91 + 26bef13 commit 061f49e

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

arch/x86/include/asm/fpu-internal.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -293,12 +293,13 @@ static inline int restore_fpu_checking(struct task_struct *tsk)
293293
/* AMD K7/K8 CPUs don't save/restore FDP/FIP/FOP unless an exception
294294
is pending. Clear the x87 state here by setting it to fixed
295295
values. "m" is a random variable that should be in L1 */
296-
alternative_input(
297-
ASM_NOP8 ASM_NOP2,
298-
"emms\n\t" /* clear stack tags */
299-
"fildl %P[addr]", /* set F?P to defined value */
300-
X86_FEATURE_FXSAVE_LEAK,
301-
[addr] "m" (tsk->thread.fpu.has_fpu));
296+
if (unlikely(static_cpu_has(X86_FEATURE_FXSAVE_LEAK))) {
297+
asm volatile(
298+
"fnclex\n\t"
299+
"emms\n\t"
300+
"fildl %P[addr]" /* set F?P to defined value */
301+
: : [addr] "m" (tsk->thread.fpu.has_fpu));
302+
}
302303

303304
return fpu_restore_checking(&tsk->thread.fpu);
304305
}

arch/x86/kernel/entry_32.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,7 +1082,7 @@ ENTRY(ftrace_caller)
10821082
pushl $0 /* Pass NULL as regs pointer */
10831083
movl 4*4(%esp), %eax
10841084
movl 0x4(%ebp), %edx
1085-
leal function_trace_op, %ecx
1085+
movl function_trace_op, %ecx
10861086
subl $MCOUNT_INSN_SIZE, %eax
10871087

10881088
.globl ftrace_call
@@ -1140,7 +1140,7 @@ ENTRY(ftrace_regs_caller)
11401140
movl 12*4(%esp), %eax /* Load ip (1st parameter) */
11411141
subl $MCOUNT_INSN_SIZE, %eax /* Adjust ip */
11421142
movl 0x4(%ebp), %edx /* Load parent ip (2nd parameter) */
1143-
leal function_trace_op, %ecx /* Save ftrace_pos in 3rd parameter */
1143+
movl function_trace_op, %ecx /* Save ftrace_pos in 3rd parameter */
11441144
pushl %esp /* Save pt_regs as 4th parameter */
11451145

11461146
GLOBAL(ftrace_regs_call)

arch/x86/kernel/entry_64.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ END(function_hook)
8888
MCOUNT_SAVE_FRAME \skip
8989

9090
/* Load the ftrace_ops into the 3rd parameter */
91-
leaq function_trace_op, %rdx
91+
movq function_trace_op(%rip), %rdx
9292

9393
/* Load ip into the first parameter */
9494
movq RIP(%rsp), %rdi

0 commit comments

Comments
 (0)