Page MenuHomeFreeBSD

D22017.1795805950.diff
No OneTemporary

Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None

D22017.1795805950.diff

Index: head/sys/kern/kern_malloc.c
===================================================================
--- head/sys/kern/kern_malloc.c
+++ head/sys/kern/kern_malloc.c
@@ -520,6 +520,10 @@
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"));
}
Index: head/sys/kern/kern_synch.c
===================================================================
--- head/sys/kern/kern_synch.c
+++ head/sys/kern/kern_synch.c
@@ -148,6 +148,10 @@
("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,
Index: head/sys/kern/subr_epoch.c
===================================================================
--- head/sys/kern/subr_epoch.c
+++ head/sys/kern/subr_epoch.c
@@ -234,6 +234,17 @@
} 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
Index: head/sys/kern/subr_trap.c
===================================================================
--- head/sys/kern/subr_trap.c
+++ head/sys/kern/subr_trap.c
@@ -166,6 +166,10 @@
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,
Index: head/sys/sys/epoch.h
===================================================================
--- head/sys/sys/epoch.h
+++ head/sys/sys/epoch.h
@@ -83,6 +83,7 @@
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

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 27, 6:59 PM (5 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42049388
Default Alt Text
D22017.1795805950.diff (2 KB)

Event Timeline