- Don't bother taking a trace message if we have panic'd since doing so

can lead to further panics.
- Call getnanotime() instead of nanotime() for the timestamp.  nanotime()
  is more precise, but it also calls into the timer code, which results
  in mutex operations on the i386 arch.  If KTR_LOCK is turned on, then
  ktr_tracepoint() recurses on itself until it exhausts the kernel stack.
  Eventually this should change to use get_cyclecount() instead, but that
  can't happen if get_cyclecount() is calling nanotime() instead of
  getnanotime().
This commit is contained in:
John Baldwin 2000-12-12 00:43:50 +00:00
parent 428b4b5562
commit d664747bfa
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=69880

View File

@ -107,6 +107,8 @@ ktr_tracepoint(u_int mask, char *format, u_long arg1, u_long arg2, u_long arg3,
va_list ap;
#endif
if (panicstr)
return;
if ((ktr_mask & mask) == 0)
return;
#ifdef KTR_EXTEND
@ -121,7 +123,7 @@ ktr_tracepoint(u_int mask, char *format, u_long arg1, u_long arg2, u_long arg3,
} while (atomic_cmpset_rel_int(&ktr_idx, saveindex, newindex) == 0);
entry = &ktr_buf[saveindex];
restore_intr(saveintr);
nanotime(&entry->ktr_tv);
getnanotime(&entry->ktr_tv);
#ifdef KTR_EXTEND
strncpy(entry->ktr_filename, filename, KTRFILENAMESIZE - 1);
entry->ktr_filename[KTRFILENAMESIZE - 1] = '\0';