From: Tejun Heo <tj@kernel.org>
To: mingo@elte.hu, linux-kernel@vger.kernel.org, brgerst@gmail.com
Cc: Tejun Heo <tj@kernel.org>
Subject: [PATCH 04/10] x86: set %fs to __KERNEL_PERCPU unconditionally for x86_32
Date: Wed, 21 Jan 2009 17:46:12 +0900 [thread overview]
Message-ID: <1232527578-1960-5-git-send-email-tj@kernel.org> (raw)
In-Reply-To: <1232527578-1960-1-git-send-email-tj@kernel.org>
From: Brian Gerst <brgerst@gmail.com>
Impact: cleanup
%fs is currently set to __KERNEL_DS at boot, and conditionally
switched to __KERNEL_PERCPU for secondary cpus. Instead, initialize
GDT_ENTRY_PERCPU to the same attributes as GDT_ENTRY_KERNEL_DS and
set %fs to __KERNEL_PERCPU unconditionally.
Signed-off-by: Brian Gerst <brgerst@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
---
arch/x86/kernel/cpu/common.c | 2 +-
arch/x86/kernel/head_32.S | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index a8f0ded..fbebbce 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -111,7 +111,7 @@ DEFINE_PER_CPU_PAGE_ALIGNED(struct gdt_page, gdt_page) = { .gdt = {
[GDT_ENTRY_APMBIOS_BASE+2] = { { { 0x0000ffff, 0x00409200 } } },
[GDT_ENTRY_ESPFIX_SS] = { { { 0x00000000, 0x00c09200 } } },
- [GDT_ENTRY_PERCPU] = { { { 0x00000000, 0x00000000 } } },
+ [GDT_ENTRY_PERCPU] = { { { 0x0000ffff, 0x00cf9200 } } },
#endif
} };
EXPORT_PER_CPU_SYMBOL_GPL(gdt_page);
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S
index e835b4e..24c0e5c 100644
--- a/arch/x86/kernel/head_32.S
+++ b/arch/x86/kernel/head_32.S
@@ -429,12 +429,14 @@ is386: movl $2,%ecx # set MP
ljmp $(__KERNEL_CS),$1f
1: movl $(__KERNEL_DS),%eax # reload all the segment registers
movl %eax,%ss # after changing gdt.
- movl %eax,%fs # gets reset once there's real percpu
movl $(__USER_DS),%eax # DS/ES contains default USER segment
movl %eax,%ds
movl %eax,%es
+ movl $(__KERNEL_PERCPU), %eax
+ movl %eax,%fs # set this cpu's percpu
+
xorl %eax,%eax # Clear GS and LDT
movl %eax,%gs
lldt %ax
@@ -446,8 +448,6 @@ is386: movl $2,%ecx # set MP
movb $1, ready
cmpb $0,%cl # the first CPU calls start_kernel
je 1f
- movl $(__KERNEL_PERCPU), %eax
- movl %eax,%fs # set this cpu's percpu
movl (stack_start), %esp
1:
#endif /* CONFIG_SMP */
--
1.6.0.2
next prev parent reply other threads:[~2009-01-21 8:48 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-21 8:46 [PATCHSET linux-2.6-x86:core/percpu] x86: misc clean up and unify x86_32/64 code paths Tejun Heo
2009-01-21 8:46 ` [PATCH 01/10] x86: update canary handling during switch Tejun Heo
2009-01-21 8:46 ` [PATCH 02/10] x86: clean up gdt_page definition Tejun Heo
2009-01-21 8:46 ` [PATCH 03/10] x86: fix percpu_write with 64-bit constants Tejun Heo
2009-01-21 8:46 ` Tejun Heo [this message]
2009-01-21 8:46 ` [PATCH 05/10] x86: merge mmu_context.h Tejun Heo
2009-01-21 8:46 ` [PATCH 06/10] x86: merge irq_regs.h Tejun Heo
2009-01-21 8:46 ` [PATCH 07/10] x86: uv cleanup Tejun Heo
2009-01-21 8:46 ` [PATCH 08/10] x86: prepare for tlb merge Tejun Heo
2009-01-21 8:46 ` [PATCH 09/10] x86: make x86_32 use tlb_64.c Tejun Heo
2009-01-21 8:46 ` [PATCH 10/10] x86: rename tlb_64.c to tlb.c Tejun Heo
2009-01-21 9:26 ` [PATCHSET linux-2.6-x86:core/percpu] x86: misc clean up and unify x86_32/64 code paths Ingo Molnar
2009-01-21 9:35 ` Ingo Molnar
2009-01-21 10:43 ` Ingo Molnar
2009-01-21 11:02 ` Ingo Molnar
2009-01-21 11:20 ` Tejun Heo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1232527578-1960-5-git-send-email-tj@kernel.org \
--to=tj@kernel.org \
--cc=brgerst@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox