When assertion for a thread not being in an epoch fails also print all
entered epochs. Works with EPOCH_TRACE only. Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D22017
This commit is contained in:
parent
5dab131339
commit
bac060388f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=353596
@ -520,6 +520,10 @@ malloc_dbg(caddr_t *vap, size_t *sizep, struct malloc_type *mtp,
|
||||
if (flags & M_WAITOK) {
|
||||
KASSERT(curthread->td_intr_nesting_level == 0,
|
||||
("malloc(M_WAITOK) in interrupt context"));
|
||||
#ifdef EPOCH_TRACE
|
||||
if (__predict_false(curthread->td_epochnest > 0))
|
||||
epoch_trace_list(curthread);
|
||||
#endif
|
||||
KASSERT(curthread->td_epochnest == 0,
|
||||
("malloc(M_WAITOK) in epoch context"));
|
||||
}
|
||||
|
@ -148,6 +148,10 @@ _sleep(void *ident, struct lock_object *lock, int priority,
|
||||
("sleeping without a lock"));
|
||||
KASSERT(ident != NULL, ("_sleep: NULL ident"));
|
||||
KASSERT(TD_IS_RUNNING(td), ("_sleep: curthread not running"));
|
||||
#ifdef EPOCH_TRACE
|
||||
if (__predict_false(curthread->td_epochnest > 0))
|
||||
epoch_trace_list(curthread);
|
||||
#endif
|
||||
KASSERT(td->td_epochnest == 0, ("sleeping in an epoch section"));
|
||||
if (priority & PDROP)
|
||||
KASSERT(lock != NULL && lock != &Giant.lock_object,
|
||||
|
@ -234,6 +234,17 @@ epoch_trace_exit(struct thread *td, epoch_t epoch, epoch_tracker_t et,
|
||||
} else
|
||||
SLIST_REMOVE_HEAD(&td->td_epochs, et_tlink);
|
||||
}
|
||||
|
||||
/* Used by assertions that check thread state before going to sleep. */
|
||||
void
|
||||
epoch_trace_list(struct thread *td)
|
||||
{
|
||||
epoch_tracker_t iet;
|
||||
|
||||
SLIST_FOREACH(iet, &td->td_epochs, et_tlink)
|
||||
printf("Epoch %s entered at %s:%d\n", iet->et_epoch->e_name,
|
||||
iet->et_file, iet->et_line);
|
||||
}
|
||||
#endif /* EPOCH_TRACE */
|
||||
|
||||
static void
|
||||
|
@ -166,6 +166,10 @@ userret(struct thread *td, struct trapframe *frame)
|
||||
WITNESS_WARN(WARN_PANIC, NULL, "userret: returning");
|
||||
KASSERT(td->td_critnest == 0,
|
||||
("userret: Returning in a critical section"));
|
||||
#ifdef EPOCH_TRACE
|
||||
if (__predict_false(curthread->td_epochnest > 0))
|
||||
epoch_trace_list(curthread);
|
||||
#endif
|
||||
KASSERT(td->td_epochnest == 0,
|
||||
("userret: Returning in an epoch section"));
|
||||
KASSERT(td->td_locks == 0,
|
||||
|
@ -83,6 +83,7 @@ DPCPU_DECLARE(struct grouptask, epoch_cb_task);
|
||||
void _epoch_enter_preempt(epoch_t epoch, epoch_tracker_t et EPOCH_FILE_LINE);
|
||||
void _epoch_exit_preempt(epoch_t epoch, epoch_tracker_t et EPOCH_FILE_LINE);
|
||||
#ifdef EPOCH_TRACE
|
||||
void epoch_trace_list(struct thread *);
|
||||
#define epoch_enter_preempt(epoch, et) _epoch_enter_preempt(epoch, et, __FILE__, __LINE__)
|
||||
#define epoch_exit_preempt(epoch, et) _epoch_exit_preempt(epoch, et, __FILE__, __LINE__)
|
||||
#else
|
||||
|
Loading…
Reference in New Issue
Block a user