[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150317072118.GA26864@gmail.com>
Date: Tue, 17 Mar 2015 08:21:18 +0100
From: Ingo Molnar <mingo@...nel.org>
To: Borislav Petkov <bp@...en8.de>
Cc: Denys Vlasenko <dvlasenk@...hat.com>,
linux-tip-commits@...r.kernel.org, linux-kernel@...r.kernel.org,
keescook@...omium.org, ast@...mgrid.com, fweisbec@...il.com,
oleg@...hat.com, tglx@...utronix.de, torvalds@...ux-foundation.org,
hpa@...or.com, wad@...omium.org, rostedt@...dmis.org
Subject: Re: [tip:x86/asm] x86/asm/entry/64: Remove unused
thread_struct::usersp
* Ingo Molnar <mingo@...nel.org> wrote:
> Could you try just this patch (on top of broken tip:master):
>
> diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
> index 66a1954439ea..997e6a1c288f 100644
> --- a/arch/x86/include/asm/processor.h
> +++ b/arch/x86/include/asm/processor.h
> @@ -496,6 +496,7 @@ struct thread_struct {
> #ifdef CONFIG_X86_32
> unsigned long sysenter_cs;
> #else
> + unsigned long usersp; /* Copy from PDA */
> unsigned short es;
> unsigned short ds;
> unsigned short fsindex;
>
> to see whether it's the changed values of old_rsp, or the change in
> sizeof(thread_struct), that causes the regression?
Assuming this does not fix the regression, could you apply the minimal
patch below - which reverts the old_rsp handling change.
(The rest of the commit are in a third patch, but those are only
comment changes.)
So my theory is that this change is what will revert the regression.
Thanks,
Ingo
======================>
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index 66a1954439ea..997e6a1c288f 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -907,6 +908,11 @@ extern unsigned long thread_saved_pc(struct task_struct *tsk);
#define task_pt_regs(tsk) ((struct pt_regs *)(tsk)->thread.sp0 - 1)
extern unsigned long KSTK_ESP(struct task_struct *task);
+/*
+ * User space RSP while inside the SYSCALL fast path
+ */
+DECLARE_PER_CPU(unsigned long, old_rsp);
+
#endif /* CONFIG_X86_64 */
extern void start_thread(struct pt_regs *regs, unsigned long new_ip,
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index 14df2be4711f..e8c124a1f885 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -161,6 +161,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
p->thread.sp0 = (unsigned long)task_stack_page(p) + THREAD_SIZE;
childregs = task_pt_regs(p);
p->thread.sp = (unsigned long) childregs;
+ p->thread.usersp = me->thread.usersp;
set_tsk_thread_flag(p, TIF_FORK);
p->thread.io_bitmap_ptr = NULL;
@@ -234,8 +235,10 @@ start_thread_common(struct pt_regs *regs, unsigned long new_ip,
loadsegment(es, _ds);
loadsegment(ds, _ds);
load_gs_index(0);
+ current->thread.usersp = new_sp;
regs->ip = new_ip;
regs->sp = new_sp;
+ this_cpu_write(old_rsp, new_sp);
regs->cs = _cs;
regs->ss = _ss;
regs->flags = X86_EFLAGS_IF;
@@ -395,6 +398,8 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
/*
* Switch the PDA and FPU contexts.
*/
+ prev->usersp = this_cpu_read(old_rsp);
+ this_cpu_write(old_rsp, next->usersp);
this_cpu_write(current_task, next_p);
/*
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists