summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/kern/kern_condvar.c10
-rw-r--r--sys/kern/kern_shutdown.c2
-rw-r--r--sys/kern/kern_switch.c4
-rw-r--r--sys/kern/kern_synch.c8
-rw-r--r--sys/sys/proc.h1
5 files changed, 16 insertions, 9 deletions
diff --git a/sys/kern/kern_condvar.c b/sys/kern/kern_condvar.c
index 9771077..e2bbbb4 100644
--- a/sys/kern/kern_condvar.c
+++ b/sys/kern/kern_condvar.c
@@ -240,12 +240,12 @@ cv_wait(struct cv *cvp, struct mtx *mp)
WITNESS_SLEEP(0, &mp->mtx_object);
WITNESS_SAVE(&mp->mtx_object, mp);
- if (cold || panicstr) {
+ if (cold ) {
/*
- * After a panic, or during autoconfiguration, just give
- * interrupts a chance, then just return; don't run any other
- * thread or panic below, in case this is the idle process and
- * already asleep.
+ * During autoconfiguration, just give interrupts
+ * a chance, then just return. Don't run any other
+ * thread or panic below, in case this is the idle
+ * process and already asleep.
*/
return;
}
diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c
index 209c22e..13a9c7a 100644
--- a/sys/kern/kern_shutdown.c
+++ b/sys/kern/kern_shutdown.c
@@ -433,6 +433,7 @@ static u_int panic_cpu = NOCPU;
void
panic(const char *fmt, ...)
{
+ struct thread *td = curthread;
int bootopt;
va_list ap;
static char buf[256];
@@ -486,6 +487,7 @@ panic(const char *fmt, ...)
}
#endif
#endif
+ td->td_flags |= TDF_INPANIC;
if (!sync_on_panic)
bootopt |= RB_NOSYNC;
boot(bootopt);
diff --git a/sys/kern/kern_switch.c b/sys/kern/kern_switch.c
index 4ae03a9..9629ac2 100644
--- a/sys/kern/kern_switch.c
+++ b/sys/kern/kern_switch.c
@@ -124,6 +124,7 @@ choosethread(void)
struct thread *td;
struct ksegrp *kg;
+retry:
if ((ke = runq_choose(&runq))) {
td = ke->ke_thread;
KASSERT((td->td_kse == ke), ("kse/thread mismatch"));
@@ -157,6 +158,9 @@ choosethread(void)
td = PCPU_GET(idlethread);
CTR1(KTR_RUNQ, "choosethread: td=%p (idle)", td);
}
+ if (panicstr && ((td->td_proc->p_flag & P_SYSTEM) == 0 &&
+ (td->td_flags & TDF_INPANIC) == 0))
+ goto retry;
td->td_state = TDS_RUNNING;
return (td);
}
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index d07f090..f54c2d1 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -477,11 +477,11 @@ msleep(ident, mtx, priority, wmesg, timo)
}
}
mtx_lock_spin(&sched_lock);
- if (cold || panicstr) {
+ if (cold ) {
/*
- * After a panic, or during autoconfiguration,
- * just give interrupts a chance, then just return;
- * don't run any other procs or panic below,
+ * During autoconfiguration, just give interrupts
+ * a chance, then just return.
+ * Don't run any other procs or panic below,
* in case this is the idle process and already asleep.
*/
if (mtx != NULL && priority & PDROP)
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index 9fdfc05..5da33a5 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -316,6 +316,7 @@ struct thread {
};
/* flags kept in td_flags */
#define TDF_UNBOUND 0x000001 /* may give away the kse, uses the kg runq */
+#define TDF_INPANIC 0x000002 /* Caused a panic, let it drive crashdump */
#define TDF_SINTR 0x000008 /* Sleep is interruptible. */
#define TDF_TIMEOUT 0x000010 /* Timing out during sleep. */
#define TDF_SELECT 0x000040 /* Selecting; wakeup/waiting danger. */
OpenPOWER on IntegriCloud