From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Brian Gerst <brgerst@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>, Tejun Heo <tj@kernel.org>,
linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] x86: split loading percpu segments from loading gdt
Date: Thu, 29 Jan 2009 13:36:38 -0800 [thread overview]
Message-ID: <49822166.7030401@goop.org> (raw)
In-Reply-To: <1233236625-17928-1-git-send-email-brgerst@gmail.com>
Xen needs to be able to access percpu data from very early on. For
various reasons, it cannot also load the gdt at that time. It does,
however, have a pefectly functional gdt at that point, so there's no
pressing need to reload the gdt.
Split the function to load the segment registers off, so Xen can call
it directly.
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
arch/x86/include/asm/processor.h | 1 +
arch/x86/kernel/cpu/common.c | 18 ++++++++++++------
2 files changed, 13 insertions(+), 6 deletions(-)
===================================================================
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -769,6 +769,7 @@
extern void cpu_set_gdt(int);
extern void switch_to_new_gdt(int);
+extern void load_percpu_segment(int);
extern void cpu_init(void);
static inline unsigned long get_debugctlmsr(void)
===================================================================
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -297,6 +297,16 @@
__u32 cleared_cpu_caps[NCAPINTS] __cpuinitdata;
+void load_percpu_segment(int cpu)
+{
+#ifdef CONFIG_X86_32
+ loadsegment(fs, __KERNEL_PERCPU);
+#else
+ loadsegment(gs, 0);
+ wrmsrl(MSR_GS_BASE, (unsigned long)per_cpu(irq_stack_union.gs_base, cpu));
+#endif
+}
+
/* Current gdt points %fs at the "master" per-cpu area: after this,
* it's on the real one. */
void switch_to_new_gdt(int cpu)
@@ -307,12 +317,8 @@
gdt_descr.size = GDT_SIZE - 1;
load_gdt(&gdt_descr);
/* Reload the per-cpu base */
-#ifdef CONFIG_X86_32
- loadsegment(fs, __KERNEL_PERCPU);
-#else
- loadsegment(gs, 0);
- wrmsrl(MSR_GS_BASE, (unsigned long)per_cpu(irq_stack_union.gs_base, cpu));
-#endif
+
+ load_percpu_segment(cpu);
}
static struct cpu_dev *cpu_devs[X86_VENDOR_NUM] = {};
next prev parent reply other threads:[~2009-01-29 21:37 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-27 1:12 unified percpu stuff Jeremy Fitzhardinge
2009-01-27 4:17 ` Tejun Heo
2009-01-29 10:43 ` Jeremy Fitzhardinge
2009-01-29 11:01 ` Tejun Heo
2009-01-29 13:43 ` [PATCH] x86: pass in cpu number to switch_to_new_gdt() Brian Gerst
2009-01-29 21:36 ` Jeremy Fitzhardinge
2009-01-29 21:36 ` Jeremy Fitzhardinge [this message]
2009-01-29 21:36 ` [PATCH 2/2] xen: setup percpu data pointers Jeremy Fitzhardinge
2009-01-30 8:50 ` Tejun Heo
2009-01-30 8:50 ` [PATCH] x86: pass in cpu number to switch_to_new_gdt() Tejun Heo
2009-01-27 5:57 ` unified percpu stuff Brian Gerst
2009-01-27 7:24 ` Jeremy Fitzhardinge
2009-01-27 12:35 ` Brian Gerst
2009-01-27 17:50 ` Jeremy Fitzhardinge
2009-01-27 19:07 ` Brian Gerst
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=49822166.7030401@goop.org \
--to=jeremy@goop.org \
--cc=brgerst@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tj@kernel.org \
/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