virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Chris Wright <chrisw@sous-sol.org>
To: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Chris Wright <chrisw@sous-sol.org>,
	Virtualization Mailing List <virtualization@lists.osdl.org>
Subject: Re: paravirt repo rebased to 2.6.21-rc6-mm1
Date: Thu, 12 Apr 2007 01:54:30 -0700	[thread overview]
Message-ID: <20070412085430.GD10574@sequoia.sous-sol.org> (raw)
In-Reply-To: <461C1C7B.5080509@goop.org>

* Jeremy Fitzhardinge (jeremy@goop.org) wrote:
> Seems to work OK for native and Xen.  I had to play a bit with the
> paravirt-sched-clock patch to deal with the VMI changes.  Zach, can you
> check that it still works?

Here's what's working for me on UP.  The boot cpu on UP is never getting
the GDT loaded.  Also __KERNEL_PERCPU is a bad selector on UP (ifdef
was Jeremy's idea, I was just hacking entry.S to get things to boot ;-).

diff -r cde7063e34bd arch/i386/kernel/cpu/common.c
--- a/arch/i386/kernel/cpu/common.c	Wed Apr 11 18:07:02 2007 -0700
+++ b/arch/i386/kernel/cpu/common.c	Thu Apr 12 01:36:00 2007 -0700
@@ -644,6 +644,18 @@ struct pt_regs * __devinit idle_regs(str
 	return regs;
 }
 
+/* Current gdt points %fs at the "master" per-cpu area: after this,
+ * it's on the real one. */
+void switch_to_new_gdt(void)
+{
+	struct Xgt_desc_struct gdt_descr;
+
+	gdt_descr.address = (long)get_cpu_gdt_table(smp_processor_id());
+	gdt_descr.size = GDT_SIZE - 1;
+	load_gdt(&gdt_descr);
+	asm("mov %0, %%fs" : : "r" (__KERNEL_PERCPU) : "memory");
+}
+
 /*
  * cpu_init() initializes state that is per-CPU. Some data is already
  * initialized (naturally) in the bootstrap process, such as the GDT
@@ -674,6 +688,7 @@ void __cpuinit cpu_init(void)
 	}
 
 	load_idt(&idt_descr);
+	switch_to_new_gdt();
 
 	/*
 	 * Set up and load the per-CPU TSS and LDT
diff -r cde7063e34bd arch/i386/kernel/smpboot.c
--- a/arch/i386/kernel/smpboot.c	Wed Apr 11 18:07:02 2007 -0700
+++ b/arch/i386/kernel/smpboot.c	Thu Apr 12 01:35:05 2007 -0700
@@ -1176,18 +1176,6 @@ void __init native_smp_prepare_cpus(unsi
 	smp_boot_cpus(max_cpus);
 }
 
-/* Current gdt points %fs at the "master" per-cpu area: after this,
- * it's on the real one. */
-static inline void switch_to_new_gdt(void)
-{
-	struct Xgt_desc_struct gdt_descr;
-
-	gdt_descr.address = (long)get_cpu_gdt_table(smp_processor_id());
-	gdt_descr.size = GDT_SIZE - 1;
-	load_gdt(&gdt_descr);
-	asm("mov %0, %%fs" : : "r" (__KERNEL_PERCPU) : "memory");
-}
-
 void __init native_smp_prepare_boot_cpu(void)
 {
 	unsigned int cpu = smp_processor_id();
diff -r cde7063e34bd include/asm-i386/processor.h
--- a/include/asm-i386/processor.h	Wed Apr 11 18:07:02 2007 -0700
+++ b/include/asm-i386/processor.h	Thu Apr 12 01:37:44 2007 -0700
@@ -777,6 +777,7 @@ extern int sysenter_setup(void);
 extern int sysenter_setup(void);
 
 extern void cpu_set_gdt(int);
+extern void switch_to_new_gdt(void);
 extern void cpu_init(void);
 
 #endif /* __ASM_I386_PROCESSOR_H */
diff -r cde7063e34bd include/asm-i386/segment.h
--- a/include/asm-i386/segment.h	Wed Apr 11 18:07:02 2007 -0700
+++ b/include/asm-i386/segment.h	Thu Apr 12 01:45:24 2007 -0700
@@ -75,7 +75,11 @@
 #define __ESPFIX_SS (GDT_ENTRY_ESPFIX_SS * 8)
 
 #define GDT_ENTRY_PERCPU			(GDT_ENTRY_KERNEL_BASE + 15)
+#ifdef CONFIG_SMP
 #define __KERNEL_PERCPU (GDT_ENTRY_PERCPU * 8)
+#else
+#define __KERNEL_PERCPU 0
+#endif
 
 #define GDT_ENTRY_DOUBLEFAULT_TSS	31
 

  parent reply	other threads:[~2007-04-12  8:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-10 23:23 paravirt repo rebased to 2.6.21-rc6-mm1 Jeremy Fitzhardinge
2007-04-10 23:29 ` Zachary Amsden
2007-04-11  0:10   ` Chris Wright
2007-04-10 23:29 ` Zachary Amsden
2007-04-10 23:48 ` Chris Wright
2007-04-12  8:54 ` Chris Wright [this message]
2007-04-12 15:40   ` Zachary Amsden

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=20070412085430.GD10574@sequoia.sous-sol.org \
    --to=chrisw@sous-sol.org \
    --cc=jeremy@goop.org \
    --cc=virtualization@lists.osdl.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;
as well as URLs for NNTP newsgroup(s).