From 4266fed8b75e8b7d04914e377aa667d50b5d056d Mon Sep 17 00:00:00 2001 From: kib Date: Fri, 13 Nov 2009 13:07:01 +0000 Subject: Amd64 init_secondary() calls initializecpu() while curthread is still not properly set up. r199067 added the call to TUNABLE_INT_FETCH() to initializecpu() that results in hang because AP are started when kernel environment is already dynamic and thus needs to acquire mutex, that is too early in AP start sequence to work. Extract the code that should be executed only once, because it sets up global variables, from initializecpu() to initializecpucache(), and call the later only from hammer_time() executed on BSP. Now, TUNABLE_INT_FETCH() is done only once at BSP at the early boot stage. In collaboration with: Mykola Dzham Reviewed by: jhb Tested by: ed, battlez --- sys/amd64/amd64/initcpu.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'sys/amd64/amd64/initcpu.c') diff --git a/sys/amd64/amd64/initcpu.c b/sys/amd64/amd64/initcpu.c index 19b784c..c97ad3d 100644 --- a/sys/amd64/amd64/initcpu.c +++ b/sys/amd64/amd64/initcpu.c @@ -163,6 +163,11 @@ initializecpu(void) CPUID_TO_FAMILY(cpu_id) == 0x6 && CPUID_TO_MODEL(cpu_id) >= 0xf) init_via(); +} + +void +initializecpucache() +{ /* * CPUID with %eax = 1, %ebx returns -- cgit v1.1