[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210127163231.12709-6-jiangshanlai@gmail.com>
Date: Thu, 28 Jan 2021 00:32:21 +0800
From: Lai Jiangshan <jiangshanlai@...il.com>
To: linux-kernel@...r.kernel.org
Cc: Lai Jiangshan <laijs@...ux.alibaba.com>,
Andy Lutomirski <luto@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
x86@...nel.org, "H. Peter Anvin" <hpa@...or.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Peter Zijlstra <peterz@...radead.org>,
Al Viro <viro@...iv.linux.org.uk>,
Vincenzo Frascino <vincenzo.frascino@....com>,
Joerg Roedel <jroedel@...e.de>,
Ricardo Neri <ricardo.neri-calderon@...ux.intel.com>,
Reinette Chatre <reinette.chatre@...el.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Gabriel Krisman Bertazi <krisman@...labora.com>,
Kees Cook <keescook@...omium.org>,
Frederic Weisbecker <frederic@...nel.org>,
Jens Axboe <axboe@...nel.dk>,
Arvind Sankar <nivedita@...m.mit.edu>,
Brian Gerst <brgerst@...il.com>,
Ard Biesheuvel <ardb@...nel.org>,
Andi Kleen <ak@...ux.intel.com>,
Mike Rapoport <rppt@...nel.org>, Mike Hommey <mh@...ndium.org>,
Mark Gross <mgross@...ux.intel.com>,
Fenghua Yu <fenghua.yu@...el.com>,
Tony Luck <tony.luck@...el.com>,
Anthony Steinhauser <asteinhauser@...gle.com>,
Jay Lang <jaytlang@....edu>,
"Chang S. Bae" <chang.seok.bae@...el.com>
Subject: [PATCH V3 5/6] x86_32/sysenter: use percpu to get thread.sp0 when sysenter
From: Lai Jiangshan <laijs@...ux.alibaba.com>
TSS_entry2task_stack is used to refer to tss.sp1 which is stored the value
of thread.sp0.
At the code where TSS_entry2task_stack is used in sysenter, the CR3 is
already kernel CR3 and kernel segments is loaded.
So that we can directly use percpu for it instead of offset-calculation.
And we remove the unused TSS_entry2task_stack.
Signed-off-by: Lai Jiangshan <laijs@...ux.alibaba.com>
---
arch/x86/entry/entry_32.S | 2 +-
arch/x86/kernel/asm-offsets_32.c | 10 ----------
2 files changed, 1 insertion(+), 11 deletions(-)
diff --git a/arch/x86/entry/entry_32.S b/arch/x86/entry/entry_32.S
index 01f098c5b017..d5b5b43fd0c0 100644
--- a/arch/x86/entry/entry_32.S
+++ b/arch/x86/entry/entry_32.S
@@ -916,7 +916,7 @@ SYM_FUNC_START(entry_SYSENTER_32)
/* Switch to task stack */
movl %esp, %eax
- movl (3*4+TSS_entry2task_stack)(%esp), %esp
+ movl PER_CPU_VAR(cpu_tss_rw + TSS_sp1), %esp
.Lsysenter_past_esp:
pushl $__USER_DS /* pt_regs->ss */
diff --git a/arch/x86/kernel/asm-offsets_32.c b/arch/x86/kernel/asm-offsets_32.c
index 6e043f295a60..6d4143cfbf03 100644
--- a/arch/x86/kernel/asm-offsets_32.c
+++ b/arch/x86/kernel/asm-offsets_32.c
@@ -43,16 +43,6 @@ void foo(void)
OFFSET(saved_context_gdt_desc, saved_context, gdt_desc);
BLANK();
- /*
- * Offset from the entry stack to task stack stored in TSS. Kernel entry
- * happens on the per-cpu entry-stack, and the asm code switches to the
- * task-stack pointer stored in x86_tss.sp1, which is a copy of
- * task->thread.sp0 where entry code can find it.
- */
- DEFINE(TSS_entry2task_stack,
- offsetof(struct cpu_entry_area, tss.x86_tss.sp1) -
- offsetofend(struct cpu_entry_area, entry_stack_page.stack));
-
#ifdef CONFIG_STACKPROTECTOR
BLANK();
OFFSET(stack_canary_offset, stack_canary, canary);
--
2.19.1.6.gb485710b
Powered by blists - more mailing lists