Improve EPOCH_TRACE
Two changes to EPOCH_TRACE: (1) add a sysctl to surpress the backtrace from epoch_trace_report(). Sometimes the log line for the recursion is enough and the backtrace massively spams the console. (2) In order to be able to go without the backtrace do not only print where the previous occurance happened, but also where the current one happens. That way we have file:line information for both and can look at them without the need for getting line numbers from backtrace and a debugging tool. Reviewed by: glebius Sponsored by: Netflix (originally) Differential Revision: https://reviews.freebsd.org/D22641
This commit is contained in:
parent
0a833dff03
commit
173c062a56
@ -169,6 +169,10 @@ RB_GENERATE_STATIC(stacktree, stackentry, se_node, stackentry_compare);
|
|||||||
static struct mtx epoch_stacks_lock;
|
static struct mtx epoch_stacks_lock;
|
||||||
MTX_SYSINIT(epochstacks, &epoch_stacks_lock, "epoch_stacks", MTX_DEF);
|
MTX_SYSINIT(epochstacks, &epoch_stacks_lock, "epoch_stacks", MTX_DEF);
|
||||||
|
|
||||||
|
static bool epoch_trace_stack_print = true;
|
||||||
|
SYSCTL_BOOL(_kern_epoch, OID_AUTO, trace_stack_print, CTLFLAG_RWTUN,
|
||||||
|
&epoch_trace_stack_print, 0, "Print stack traces on epoch reports");
|
||||||
|
|
||||||
static void epoch_trace_report(const char *fmt, ...) __printflike(1, 2);
|
static void epoch_trace_report(const char *fmt, ...) __printflike(1, 2);
|
||||||
static inline void
|
static inline void
|
||||||
epoch_trace_report(const char *fmt, ...)
|
epoch_trace_report(const char *fmt, ...)
|
||||||
@ -197,7 +201,8 @@ epoch_trace_report(const char *fmt, ...)
|
|||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
(void)vprintf(fmt, ap);
|
(void)vprintf(fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
stack_print_ddb(&se.se_stack);
|
if (epoch_trace_stack_print)
|
||||||
|
stack_print_ddb(&se.se_stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
@ -209,8 +214,9 @@ epoch_trace_enter(struct thread *td, epoch_t epoch, epoch_tracker_t et,
|
|||||||
SLIST_FOREACH(iet, &td->td_epochs, et_tlink)
|
SLIST_FOREACH(iet, &td->td_epochs, et_tlink)
|
||||||
if (iet->et_epoch == epoch)
|
if (iet->et_epoch == epoch)
|
||||||
epoch_trace_report("Recursively entering epoch %s "
|
epoch_trace_report("Recursively entering epoch %s "
|
||||||
"previously entered at %s:%d\n",
|
"at %s:%d, previously entered at %s:%d\n",
|
||||||
epoch->e_name, iet->et_file, iet->et_line);
|
epoch->e_name, file, line,
|
||||||
|
iet->et_file, iet->et_line);
|
||||||
et->et_epoch = epoch;
|
et->et_epoch = epoch;
|
||||||
et->et_file = file;
|
et->et_file = file;
|
||||||
et->et_line = line;
|
et->et_line = line;
|
||||||
@ -223,9 +229,10 @@ epoch_trace_exit(struct thread *td, epoch_t epoch, epoch_tracker_t et,
|
|||||||
{
|
{
|
||||||
|
|
||||||
if (SLIST_FIRST(&td->td_epochs) != et) {
|
if (SLIST_FIRST(&td->td_epochs) != et) {
|
||||||
epoch_trace_report("Exiting epoch %s in a not nested order. "
|
epoch_trace_report("Exiting epoch %s in a not nested order "
|
||||||
"Most recently entered %s at %s:%d\n",
|
"at %s:%d. Most recently entered %s at %s:%d\n",
|
||||||
epoch->e_name,
|
epoch->e_name,
|
||||||
|
file, line,
|
||||||
SLIST_FIRST(&td->td_epochs)->et_epoch->e_name,
|
SLIST_FIRST(&td->td_epochs)->et_epoch->e_name,
|
||||||
SLIST_FIRST(&td->td_epochs)->et_file,
|
SLIST_FIRST(&td->td_epochs)->et_file,
|
||||||
SLIST_FIRST(&td->td_epochs)->et_line);
|
SLIST_FIRST(&td->td_epochs)->et_line);
|
||||||
|
Loading…
Reference in New Issue
Block a user