Correct the spinlock nesting of the idle thread of the APs before we
save the MCA state of the AP. Saving the MCA state of the AP requires us to allocate memory, which uses sleep locks. Now that we correct the spinlock nesting of the AP without having schedlock, avoid calling spinlock_exit(). Instead call critical_exit() and manually clear the MD spinlock count. MFC after: 3 days
This commit is contained in:
parent
10b037c1d9
commit
e13946c127
@ -111,6 +111,16 @@ ia64_ap_startup(void)
|
||||
KASSERT(PCPU_GET(idlethread) != NULL, ("no idle thread"));
|
||||
PCPU_SET(curthread, PCPU_GET(idlethread));
|
||||
|
||||
/*
|
||||
* Correct spinlock nesting. The idle thread context that we are
|
||||
* borrowing was created so that it would start out with a single
|
||||
* spin lock (sched_lock) held in fork_trampoline(). Since we
|
||||
* don't have any locks and explicitly acquire locks when we need
|
||||
* to, the nesting count will be off by 1.
|
||||
*/
|
||||
curthread->td_md.md_spinlock_count = 0;
|
||||
critical_exit();
|
||||
|
||||
/*
|
||||
* Get and save the CPU specific MCA records. Should we get the
|
||||
* MCA state for each processor, or just the CMC state?
|
||||
@ -126,18 +136,6 @@ ia64_ap_startup(void)
|
||||
|
||||
mtx_lock_spin(&sched_lock);
|
||||
|
||||
/*
|
||||
* Correct spinlock nesting. The idle thread context that we are
|
||||
* borrowing was created so that it would start out with a single
|
||||
* spin lock (sched_lock) held in fork_trampoline(). Since we've
|
||||
* explicitly acquired locks in this function, the nesting count
|
||||
* is now 2 rather than 1. Since we are nested, calling
|
||||
* spinlock_exit() will simply adjust the counts without allowing
|
||||
* spin lock using code to interrupt us.
|
||||
*/
|
||||
spinlock_exit();
|
||||
KASSERT(curthread->td_md.md_spinlock_count == 1, ("invalid count"));
|
||||
|
||||
PCPU_SET(switchtime, cpu_ticks());
|
||||
PCPU_SET(switchticks, ticks);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user