summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2000-12-12 00:43:50 +0000
committerjhb <jhb@FreeBSD.org>2000-12-12 00:43:50 +0000
commit5791a3790632140a5f2e20a7962b123589408145 (patch)
tree111b415442217a641c50408363fdd4d74822602f
parent28288268c824bc639658eecdbcde3aefd4a8a0fc (diff)
downloadFreeBSD-src-5791a3790632140a5f2e20a7962b123589408145.zip
FreeBSD-src-5791a3790632140a5f2e20a7962b123589408145.tar.gz
- 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().
-rw-r--r--sys/kern/kern_ktr.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/kern/kern_ktr.c b/sys/kern/kern_ktr.c
index cb4039a..63f80ef 100644
--- a/sys/kern/kern_ktr.c
+++ b/sys/kern/kern_ktr.c
@@ -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';
OpenPOWER on IntegriCloud