Magellan Linux

Contents of /trunk/kernel26-xen/patches-2.6.25-r1/1100-2.6.25-xen-64-Handle-fs-and-gs-on-xen_load_tls-properl.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 606 - (show annotations) (download)
Thu May 22 23:13:13 2008 UTC (16 years ago) by niro
File size: 1843 byte(s)
-ver bump to 2.6.25-magellan-r1:
- linux-2.6.25.4
- fbcondecor-0.9.4
- squashfs-3.3
- unionfs-2.3.3
- tuxonice-3.0-rc7
- linux-phc-0.3.0
- acpi-dstd-0.9a
- reiser4
- xen-3.2.0
. ipw3945-1.2.2

1 From 2bc8b209da0ce377a8c9bfef31bcc567e4299aa1 Mon Sep 17 00:00:00 2001
2 From: Eduardo Habkost <ehabkost@redhat.com>
3 Date: Fri, 4 Jan 2008 11:45:33 -0200
4 Subject: [PATCH] xen-64: Handle %fs and %gs on xen_load_tls() properly
5
6 Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
7 ---
8 arch/x86/xen/enlighten.c | 15 ++++++++++++++-
9 1 files changed, 14 insertions(+), 1 deletions(-)
10
11 diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
12 index 7633851..2bec24f 100644
13 --- a/arch/x86/xen/enlighten.c
14 +++ b/arch/x86/xen/enlighten.c
15 @@ -391,6 +391,7 @@ static void xen_load_tls(struct thread_struct *t, unsigned int cpu)
16
17 xen_mc_issue(PARAVIRT_LAZY_CPU);
18
19 +#ifdef CONFIG_X86_32
20 /*
21 * XXX sleazy hack: If we're being called in a lazy-cpu zone,
22 * it means we're in a context switch, and %gs has just been
23 @@ -399,9 +400,21 @@ static void xen_load_tls(struct thread_struct *t, unsigned int cpu)
24 * Either way, it has been saved, and the new value will get
25 * loaded properly. This will go away as soon as Xen has been
26 * modified to not save/restore %gs for normal hypercalls.
27 + *
28 + * This hack is not used on x86_64, because:
29 + * - For %gs: x86_64 gs points to KERNEL_GS_BASE (and uses it for PDA
30 + * references), so we must not zero %gs on x86_64
31 + * - For %fs: x86_64 may have %fs pointing to TLS descriptors, but
32 + * __switch_to() reads %fs after load_TLS(). We can't clear it
33 + *
34 + * FIXME: we need to be sure we don't _need_ the hack on x86_64.
35 + * Can we get a #GP when switch back from the hypervisor if
36 + * TLS descriptor is cleared but %fs still points to it?
37 */
38 - if (paravirt_get_lazy_mode() == PARAVIRT_LAZY_CPU)
39 + if (paravirt_get_lazy_mode() == PARAVIRT_LAZY_CPU) {
40 loadsegment(gs, 0);
41 + }
42 +#endif
43 }
44
45 static void xen_write_ldt_entry(struct desc_struct *dt, int entrynum,
46 --
47 1.5.4.1
48