lkml.org 
[lkml]   [2006]   [Jun]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Subjectthe creation of boot_cpu_init() is wrong and accessing uninitialised data
From
Date
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


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

\
 
 \ /
  Last update: 2006-06-27 04:47    [W:0.238 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site