mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* the creation of boot_cpu_init() is wrong and accessing uninitialised data
@ 2006-06-27  2:45 James Bottomley
  2006-06-27  3:04 ` Andrew Morton
  0 siblings, 1 reply; 15+ messages in thread
From: James Bottomley @ 2006-06-27  2:45 UTC (permalink / raw)
  To: Stas Sergeev, linux-kernel, Andrew Morton

The basic problem with this function is that on most architectures
smp_processor_id() is an alias for current_thread_info()->cpu which
isn't given its correct value until setup_arch(), so adding a
boot_cpu_init() that uses it *before* setup_arch() is called is plain
wrong.  You manage to get away with it 99% of the time because its
uninitialised value is zero and mostly the id of the booting CPU is
zero ... but guess who's got a box currently booting on CPU 1 with no
CPU 0?

Unfortunately, I can't think of a good solution for what you want to do.
The thing that looks most plausible is hard_smp_processor_id() which
reads the actual register value of the processor id.  However, on x86
(and any other architectures that renumber their CPUs in setup_arch())
this will ultimately turn out wrong again.

James



^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2006-07-02 15:38 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-27  2:45 the creation of boot_cpu_init() is wrong and accessing uninitialised data James Bottomley
2006-06-27  3:04 ` Andrew Morton
2006-06-27  3:36   ` James Bottomley
2006-06-27  5:03     ` Andrew Morton
2006-06-27 13:00       ` Keith Owens
2006-06-27 14:01         ` James Bottomley
2006-06-27 14:49       ` James Bottomley
2006-06-28  0:04         ` Andrew Morton
2006-06-28  2:45           ` James Bottomley
2006-06-28  2:57             ` Andrew Morton
2006-06-28 23:10               ` James Bottomley
2006-06-29 16:58                 ` James Bottomley
2006-07-02 14:52                   ` Eric W. Biederman
2006-07-02 15:06                     ` James Bottomley
2006-07-02 15:37                       ` Eric W. Biederman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®