Re: [PATCH 2/4] i386 GDT cleanups: Use per-cpu GDT immediately upon boot

From: Eric W. Biederman
Date: Wed Mar 21 2007 - 05:32:11 EST


Rusty Russell <rusty@xxxxxxxxxxxxxxx> writes:

> Now we are no longer dynamically allocating the GDT, we don't need the
> "cpu_gdt_table" at all: we can switch straight from "boot_gdt_table"
> to the per-cpu GDT. This means initializing the cpu_gdt array in C.
>
> The boot CPU uses the per-cpu var directly, then in smp_prepare_cpus()
> it switches to the per-cpu copy just allocated. For secondary CPUs,
> the early_gdt_descr is set to point directly to their per-cpu copy.
>
> For UP the code is very simple: it keeps using the "per-cpu" GDT as
> per SMP, but we never have to move.

> diff -r a8a4e2f9da08 arch/i386/kernel/head.S
> --- a/arch/i386/kernel/head.S Wed Mar 21 15:20:48 2007 +1100
> +++ b/arch/i386/kernel/head.S Wed Mar 21 15:32:38 2007 +1100
> @@ -599,67 +599,10 @@ idt_descr:
> .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.
> - */

It looks like you are killing a useful comment here for no good reason.

> + .long per_cpu__cpu_gdt /* Overwritten for secondary CPUs */
> +
> .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 */


Eric
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/