From: Rusty Russell <rusty@rustcorp.com.au>
To: lkml - Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: Zachary Amsden <zach@vmware.com>,
Jeremy Fitzhardinge <jeremy@xensource.com>,
Ingo Molnar <mingo@elte.hu>,
Andrew Morton <akpm@linux-foundation.org>,
Andi Kleen <ak@suse.de>
Subject: [PATCH 1/8] Remove cpu_gdt_table: use boot_gdt_table until migration to per-cpu
Date: Tue, 06 Mar 2007 23:53:12 +1100 [thread overview]
Message-ID: <1173185592.4644.28.camel@localhost.localdomain> (raw)
In-Reply-To: <1173184747.4644.23.camel@localhost.localdomain>
Linux uses three GDTs to boot: the boot_gdt_table, which contains only
the __BOOT_CS and __BOOT_DS entries is used first up, before kernel is
mapped at PAGE_OFFSET. Then we transition to cpu_gdt_table during
boot, and finally we allocate a per-cpu GDT and switch to that.
We can simplify this by using the boot_gdt_table until switching to
the per-cpu GDT table. As a bonus, this gets rid of the
horribly-named "cpu_gdt_table" (it's not per-cpu, and the T in GDT
already stands for table).
Finally, some old bogus comments are deleted.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
diff -r 9cf03cbf8bde arch/i386/kernel/cpu/common.c
--- a/arch/i386/kernel/cpu/common.c Thu Mar 01 16:40:41 2007 +1100
+++ b/arch/i386/kernel/cpu/common.c Thu Mar 01 21:58:16 2007 +1100
@@ -694,7 +694,7 @@ __cpuinit int init_gdt(int cpu, struct t
* Initialize the per-CPU GDT with the boot GDT,
* and set up the GDT descriptor:
*/
- memcpy(gdt, cpu_gdt_table, GDT_SIZE);
+ memcpy(gdt, boot_gdt_table, GDT_SIZE);
cpu_gdt_descr->size = GDT_SIZE - 1;
pack_descriptor((u32 *)&gdt[GDT_ENTRY_PDA].a,
diff -r 9cf03cbf8bde arch/i386/kernel/head.S
--- a/arch/i386/kernel/head.S Thu Mar 01 16:40:41 2007 +1100
+++ b/arch/i386/kernel/head.S Thu Mar 01 22:05:37 2007 +1100
@@ -595,31 +595,19 @@ idt_descr:
.word IDT_ENTRIES*8-1 # idt contains 256 entries
.long idt_table
-# boot GDT descriptor (later on used by CPU#0):
+# The boot GDT descriptor once paging is enabled.
.word 0 # 32 bit align gdt_desc.address
ENTRY(early_gdt_descr)
.word GDT_ENTRIES*8-1
- .long cpu_gdt_table
-
-/*
- * The boot_gdt_table must mirror the equivalent in setup.S and is
- * used only for booting.
- */
+ .long boot_gdt_table
+
+/* The boot Global Descriptor Table: after boot we allocate a per-cpu copy */
.align L1_CACHE_BYTES
ENTRY(boot_gdt_table)
- .fill GDT_ENTRY_BOOT_CS,8,0
- .quad 0x00cf9a000000ffff /* kernel 4GB code at 0x00000000 */
- .quad 0x00cf92000000ffff /* kernel 4GB data at 0x00000000 */
-
-/*
- * The Global Descriptor Table contains 28 quadwords, per-CPU.
- */
- .align L1_CACHE_BYTES
-ENTRY(cpu_gdt_table)
.quad 0x0000000000000000 /* NULL descriptor */
.quad 0x0000000000000000 /* 0x0b reserved */
- .quad 0x0000000000000000 /* 0x13 reserved */
- .quad 0x0000000000000000 /* 0x1b reserved */
+ .quad 0x00cf9a000000ffff /* boot: 4GB code at 0x00000000 */
+ .quad 0x00cf92000000ffff /* boot: 4GB data at 0x00000000 */
.quad 0x0000000000000000 /* 0x20 unused */
.quad 0x0000000000000000 /* 0x28 unused */
.quad 0x0000000000000000 /* 0x33 TLS entry 1 */
diff -r 9cf03cbf8bde include/asm-i386/desc.h
--- a/include/asm-i386/desc.h Thu Mar 01 16:40:41 2007 +1100
+++ b/include/asm-i386/desc.h Thu Mar 01 21:57:37 2007 +1100
@@ -12,7 +12,7 @@
#include <asm/mmu.h>
-extern struct desc_struct cpu_gdt_table[GDT_ENTRIES];
+extern struct desc_struct boot_gdt_table[GDT_ENTRIES];
struct Xgt_desc_struct {
unsigned short size;
next prev parent reply other threads:[~2007-03-06 12:54 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-06 12:39 [PATCH 0/8] x86 boot, pda and gdt cleanups Rusty Russell
2007-03-06 12:53 ` Rusty Russell [this message]
2007-03-06 12:54 ` [PATCH 2/8] Remove NR_CPUS from asm-generic/percpu.h Rusty Russell
2007-03-06 12:55 ` [PATCH 3/8] Use per-cpu variables for GDT, PDA Rusty Russell
2007-03-06 12:57 ` [PATCH 4/8] Cleanup setup_pda Rusty Russell
2007-03-06 12:58 ` [PATCH 5/8] Cleanup GDT access Rusty Russell
2007-03-06 13:00 ` [PATCH 6/8] Allow per-cpu variables to be page-aligned Rusty Russell
2007-03-06 13:01 ` [PATCH 7/8] Page-align the GDT Rusty Russell
2007-03-06 13:03 ` [PATCH 8/8] Convert PDA into the percpu section Rusty Russell
2007-03-06 13:10 ` Ingo Molnar
2007-03-07 0:12 ` Rusty Russell
2007-03-07 0:35 ` Jeremy Fitzhardinge
2007-03-06 18:28 ` Jeremy Fitzhardinge
2007-03-06 19:34 ` Andi Kleen
2007-03-06 18:37 ` Jeremy Fitzhardinge
2007-03-07 0:33 ` Rusty Russell
2007-03-07 11:55 ` Rusty Russell
2007-03-13 17:15 ` Jeremy Fitzhardinge
2007-03-14 2:27 ` Rusty Russell
2007-03-06 13:15 ` [PATCH 6/8] Allow per-cpu variables to be page-aligned Ingo Molnar
2007-03-07 0:16 ` Rusty Russell
2007-03-07 0:44 ` H. Peter Anvin
2007-03-06 18:17 ` Jeremy Fitzhardinge
2007-03-07 0:29 ` Rusty Russell
2007-03-06 18:16 ` [PATCH 5/8] Cleanup GDT access Jeremy Fitzhardinge
2007-03-06 18:14 ` [PATCH 3/8] Use per-cpu variables for GDT, PDA Jeremy Fitzhardinge
2007-03-06 13:21 ` [PATCH 2/8] Remove NR_CPUS from asm-generic/percpu.h Ingo Molnar
2007-03-06 13:20 ` [PATCH 1/8] Remove cpu_gdt_table: use boot_gdt_table until migration to per-cpu Ingo Molnar
2007-03-06 13:26 ` Ingo Molnar
2007-03-07 0:22 ` Rusty Russell
2007-03-13 20:48 ` [PATCH 0/8] x86 boot, pda and gdt cleanups Jeremy Fitzhardinge
2007-03-14 2:25 ` Rusty Russell
2007-03-14 4:39 ` Jeremy Fitzhardinge
2007-03-14 6:54 ` Rusty Russell
2007-03-14 23:55 ` Rusty Russell
2007-03-15 1:57 ` Jeremy Fitzhardinge
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=1173185592.4644.28.camel@localhost.localdomain \
--to=rusty@rustcorp.com.au \
--cc=ak@suse.de \
--cc=akpm@linux-foundation.org \
--cc=jeremy@xensource.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=zach@vmware.com \
/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).