mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-16 10:20:30 +00:00
Always explicitly panic in propogate_priority() if we try to propogate
a lock's priority to a sleeping thread. When we panic, dump a stack trace of the thread that is asleep if DDB is compiled into the kernel just before calling panic(). This is much more informative and useful for debugging than the current behavior of getting a page fault and not having an easy way of determining which thread caused the original problem. MFC after: 1 week
This commit is contained in:
parent
0e2ce5ce47
commit
4b3b0413d2
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=157275
@ -186,15 +186,21 @@ propagate_priority(struct thread *td)
|
||||
MPASS(td->td_proc->p_magic == P_MAGIC);
|
||||
|
||||
/*
|
||||
* XXX: The owner of a turnstile can be stale if it is the
|
||||
* first thread to grab a rlock of a rw lock. In that case
|
||||
* it is possible for us to be at SSLEEP or some other
|
||||
* weird state. We should probably just return if the state
|
||||
* isn't SRUN or SLOCK.
|
||||
* If the thread is asleep, then we are probably about
|
||||
* to deadlock. To make debugging this easier, just
|
||||
* panic and tell the user which thread misbehaved so
|
||||
* they can hopefully get a stack trace from the truly
|
||||
* misbehaving thread.
|
||||
*/
|
||||
KASSERT(!TD_IS_SLEEPING(td),
|
||||
("sleeping thread (tid %d) owns a non-sleepable lock",
|
||||
td->td_tid));
|
||||
if (TD_IS_SLEEPING(td)) {
|
||||
printf(
|
||||
"Sleeping thread (tid %d, pid %d) owns a non-sleepable lock\n",
|
||||
td->td_tid, td->td_proc->p_pid);
|
||||
#ifdef DDB
|
||||
db_trace_thread(td, -1);
|
||||
#endif
|
||||
panic("sleeping thread");
|
||||
}
|
||||
|
||||
/*
|
||||
* If this thread already has higher priority than the
|
||||
|
Loading…
Reference in New Issue
Block a user