summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2005-03-17 15:18:01 +0000
committerrwatson <rwatson@FreeBSD.org>2005-03-17 15:18:01 +0000
commit04058cab9fda00807f20a313d9d23873b1ff0628 (patch)
tree8d90e4354f63f84cd08eb9cf43bf35868529b5b5
parent444989f1a68dee1d345bf459347f37ab2c8f9b23 (diff)
downloadFreeBSD-src-04058cab9fda00807f20a313d9d23873b1ff0628.zip
FreeBSD-src-04058cab9fda00807f20a313d9d23873b1ff0628.tar.gz
A further step on the journey of meaking panics and debugging more reliable:
in the window between the beginning of panic() and entering the debugger, it's possible to receive interrupts. If we receive an interrupt, don't preempt if panicstr != NULL, as the system is in the process of failing, and the preempting thread is likely to stumble over the failure. The typical scenario is during the printf() in panic() prior to entering the debugger, but when running with a slower console type such as serial console. It could be that the panic string should be passed to the debugger to print, so that it can run from the debugger's environment rather than a regular kernel printf. Glanced at by: jhb
-rw-r--r--sys/kern/kern_switch.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/kern/kern_switch.c b/sys/kern/kern_switch.c
index b05fd9f..3a7dd82 100644
--- a/sys/kern/kern_switch.c
+++ b/sys/kern/kern_switch.c
@@ -626,6 +626,7 @@ maybe_preempt(struct thread *td)
* The new thread should not preempt the current thread if any of the
* following conditions are true:
*
+ * - The kernel is in the throes of crashing (panicstr).
* - The current thread has a higher (numerically lower) or
* equivalent priority. Note that this prevents curthread from
* trying to preempt to itself.
@@ -651,8 +652,8 @@ maybe_preempt(struct thread *td)
("maybe_preempt: trying to run inhibitted thread"));
pri = td->td_priority;
cpri = ctd->td_priority;
- if (pri >= cpri || cold /* || dumping */ || TD_IS_INHIBITED(ctd) ||
- td->td_kse->ke_state != KES_THREAD)
+ if (panicstr != NULL || pri >= cpri || cold /* || dumping */ ||
+ TD_IS_INHIBITED(ctd) || td->td_kse->ke_state != KES_THREAD)
return (0);
#ifndef FULL_PREEMPTION
if (!(pri >= PRI_MIN_ITHD && pri <= PRI_MAX_ITHD) &&
OpenPOWER on IntegriCloud