aboutsummaryrefslogtreecommitdiff
path: root/sys/ia64/ia64/mp_machdep.c
diff options
context:
space:
mode:
authorMarcel Moolenaar <marcel@FreeBSD.org>2006-02-11 19:55:18 +0000
committerMarcel Moolenaar <marcel@FreeBSD.org>2006-02-11 19:55:18 +0000
commite13946c12775a7c373d4bfc914dde9f7d0a2ad32 (patch)
tree4cd4be77544764f054848475c835a5a2fb4ab35f /sys/ia64/ia64/mp_machdep.c
parent10b037c1d9fbc8d364619cae79bde12d52737308 (diff)
downloadsrc-e13946c12775a7c373d4bfc914dde9f7d0a2ad32.tar.gz
src-e13946c12775a7c373d4bfc914dde9f7d0a2ad32.zip
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
Notes
Notes: svn path=/head/; revision=155553
Diffstat (limited to 'sys/ia64/ia64/mp_machdep.c')
-rw-r--r--sys/ia64/ia64/mp_machdep.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/sys/ia64/ia64/mp_machdep.c b/sys/ia64/ia64/mp_machdep.c
index 0b9e7ddadcd1..a989577101ce 100644
--- a/sys/ia64/ia64/mp_machdep.c
+++ b/sys/ia64/ia64/mp_machdep.c
@@ -112,6 +112,16 @@ ia64_ap_startup(void)
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);