Skip to content

Commit

Permalink
sched/x86_64: Don't save flags on context switch
Browse files Browse the repository at this point in the history
Now that we have objtool validating AC=1 state for all x86_64 code,
we can once again guarantee clean flags on schedule.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Apr 3, 2019
1 parent 2f0f9e9 commit 64604d5
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 10 deletions.
2 changes: 0 additions & 2 deletions arch/x86/entry/entry_64.S
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@ ENTRY(__switch_to_asm)
pushq %r13
pushq %r14
pushq %r15
pushfq

/* switch stack */
movq %rsp, TASK_threadsp(%rdi)
Expand All @@ -314,7 +313,6 @@ ENTRY(__switch_to_asm)
#endif

/* restore callee-saved registers */
popfq
popq %r15
popq %r14
popq %r13
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/include/asm/switch_to.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ asmlinkage void ret_from_fork(void);
* order of the fields must match the code in __switch_to_asm().
*/
struct inactive_task_frame {
unsigned long flags;
#ifdef CONFIG_X86_64
unsigned long r15;
unsigned long r14;
unsigned long r13;
unsigned long r12;
#else
unsigned long flags;
unsigned long si;
unsigned long di;
#endif
Expand Down
7 changes: 0 additions & 7 deletions arch/x86/kernel/process_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,13 +393,6 @@ int copy_thread_tls(unsigned long clone_flags, unsigned long sp,
fork_frame = container_of(childregs, struct fork_frame, regs);
frame = &fork_frame->frame;

/*
* For a new task use the RESET flags value since there is no before.
* All the status flags are zero; DF and all the system flags must also
* be 0, specifically IF must be 0 because we context switch to the new
* task with interrupts disabled.
*/
frame->flags = X86_EFLAGS_FIXED;
frame->bp = 0;
frame->ret_addr = (unsigned long) ret_from_fork;
p->thread.sp = (unsigned long) fork_frame;
Expand Down

0 comments on commit 64604d5

Please sign in to comment.