Re: why is trampoline.S code copied for each cpu?

From: James Bottomley (James.Bottomley@SteelEye.com)
Date: Wed Jul 12 2000 - 10:05:03 EST


> The arch/i386/kernel/smpboot.c:do_boot_cpu() uses setup_trampoline()
> to copy the trampoline.S code for each cpu. Why not point all of them
> to the same copy?

We do effectively use the same copy (it's the same memory page each time, it's
just that the contents are refreshed). The trampoline code must be at a
physical memory location capable of being accessed by a real mode CPU. The
trampoline page is taken and held very early on in the boot sequence for this
reason.

> So I looked in trampoline.S and discovered the answer to this
> question - because each instance writes some magic number a5a5a5a5 to
> its code. Ok, so then the answer becomes - why does it do that?

If you look lower down in do_boot_cpu(), this is used as a diagnosis of a boot
failure (the check at phys_to_virt(8192)). If we don't find the signature, we
know the CPU failed to start, if we do find it, we know it started but got
stuck somewhere after the switch to protected mode.

In the latter case, the CPU could happily have trashed the trampoline code
before disappearing off into hyperspace, so it makes sense to set it up anew
each time.

James Bottomley

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



This archive was generated by hypermail 2b29 : Sat Jul 15 2000 - 21:00:14 EST