Re: [PATCH 0/8] x86 boot, pda and gdt cleanups

From: Rusty Russell
Date: Wed Mar 14 2007 - 19:56:27 EST


On Tue, 2007-03-13 at 13:48 -0700, Jeremy Fitzhardinge wrote:
> * init_gdt should always use write_gdt_entry when touching the gdt;
> if it doesn't and it ends up touching an already-installed gdt
> under Xen, it will get a write fault. This happens because
> init_gdt ends up getting called twice in SMP (see below).

Hmm, this invalidated my assumption that write_gdt_entry is always a
write to this cpu's active gdt. Better fix is not to call it twice
anyway...

> * init_gdt should always be called before bringing up the cpu,
> rather than by the cpu itself (and therefore, cpu_init() shouldn't
> call it). Obviously the the boot cpu is an exception.

Makes sense.

> * secondary_cpu_init stops being necessary.

Indeed.

> * On SMP, init_gdt can get called twice: first time in
> smp_prepare_boot_cpu, and a second time in trap_init. On UP,
> trap_init is the only caller.

Getting rid of the call in smp_prepare_boot_cpu currently works, but
it's fragile: __get_cpu_var(x) && per_cpu(x, smp_processor_id()) will
differ, and changes made to __get_cpu_var(x) will vanish...

Fortunately, UP doesn't have to call init_gdt at all, so I think it's
better to place it in smp_prepare_boot_cpu only and then clean up the UP
code. I'll try now...

Rusty.

-
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/