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 <freebsd levsha org ua> Reviewed by: jhb Tested by: ed, battlez
This commit is contained in:
parent
71a9e1e305
commit
ec24e8d42e
@ -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
|
||||
|
@ -1663,6 +1663,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree)
|
||||
|
||||
identify_cpu(); /* Final stage of CPU initialization */
|
||||
initializecpu(); /* Initialize CPU registers */
|
||||
initializecpucache();
|
||||
|
||||
/* make an initial tss so cpu can get interrupt stack on syscall! */
|
||||
common_tss[0].tss_rsp0 = thread0.td_kstack + \
|
||||
|
@ -89,6 +89,7 @@ void gs_load_fault(void) __asm(__STRING(gs_load_fault));
|
||||
void dump_add_page(vm_paddr_t);
|
||||
void dump_drop_page(vm_paddr_t);
|
||||
void initializecpu(void);
|
||||
void initializecpucache(void);
|
||||
void fillw(int /*u_short*/ pat, void *base, size_t cnt);
|
||||
void fpstate_drop(struct thread *td);
|
||||
int is_physical_memory(vm_paddr_t addr);
|
||||
|
Loading…
Reference in New Issue
Block a user