On Mon, 2008-06-09 at 12:49 -0300, Glauber Costa wrote:Yes, after a second look, it would be tricky indeed. But only for cpu0.James Bottomley wrote:On Mon, 2008-06-09 at 11:16 -0300, Glauber Costa wrote:You are right, I missed it.since we use switch_to_new_gdt, there is no pointWhat makes you think you can do this? If you don't update the early
in assigning early_gdt_descr except for the first
assignment, which is done manually.
boot gdt, they all end up using the Boot CPU one. The problem with this
is that there's a time from start_secondary to switch_to_new_gdt where
the per cpu selector (%fs) and the pda selector (%gs) are those of the
boot CPU. The former isn't a problem but the CPU number is in the
latter, and it's used in that path before we get to the initialisation.
However, it only seem to be used in cpu_init, and very early. Sure there are some users _before_ we load the new gdt, but nothing prevents them to be moved after it. (Of course, this patch is wrong anyway).
And if we do that, we can even take the %fs loading out of head_32.S
Of course, it's only valid if those are indeed the only early users of it.
Is there any other use I'm missing?
Well, %fs loading there is done for the boot CPU. To eliminate that you
have to not only verify that start_secondary doesn't use anything in
per_cpu areas, but also verify that nothing in start_kernel() up until
boot_cpu_init() does ... That's a lot of smp_processor_id() references
to convert.