summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_synch.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2006-06-03 20:49:44 +0000
committerjhb <jhb@FreeBSD.org>2006-06-03 20:49:44 +0000
commitdc064c4d4890430cb8208a63baeaff2559197afd (patch)
tree4b960fb880dfc946aa5d053ecdc4fd6874c493eb /sys/kern/kern_synch.c
parent9c15984c1bbf14716670b818e9aa27a5fc47ce03 (diff)
downloadFreeBSD-src-dc064c4d4890430cb8208a63baeaff2559197afd.zip
FreeBSD-src-dc064c4d4890430cb8208a63baeaff2559197afd.tar.gz
In the case of reentering the debugger due to an attempt to perform a
context switch while in the debugger, reenter the debugger sooner before performing any statistics updates.
Diffstat (limited to 'sys/kern/kern_synch.c')
-rw-r--r--sys/kern/kern_synch.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index d84c64f..a5e50b1 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -357,6 +357,16 @@ mi_switch(int flags, struct thread *newtd)
("mi_switch: switch must be voluntary or involuntary"));
KASSERT(newtd != curthread, ("mi_switch: preempting back to ourself"));
+ /*
+ * Don't perform context switches from the debugger.
+ */
+ if (kdb_active) {
+ mtx_unlock_spin(&sched_lock);
+ kdb_backtrace();
+ kdb_reenter();
+ panic("%s: did not reenter debugger", __func__);
+ }
+
if (flags & SW_VOL)
p->p_stats->p_ru.ru_nvcsw++;
else
@@ -378,16 +388,6 @@ mi_switch(int flags, struct thread *newtd)
td->td_generation++; /* bump preempt-detect counter */
/*
- * Don't perform context switches from the debugger.
- */
- if (kdb_active) {
- mtx_unlock_spin(&sched_lock);
- kdb_backtrace();
- kdb_reenter();
- panic("%s: did not reenter debugger", __func__);
- }
-
- /*
* Check if the process exceeds its cpu resource allocation. If
* it reaches the max, arrange to kill the process in ast().
*/
OpenPOWER on IntegriCloud