From 4de9e65520c65e36038c989bd5e325ea311db27f Mon Sep 17 00:00:00 2001 From: grog Date: Fri, 29 Dec 2000 06:27:39 +0000 Subject: [PATCH] Partially revert revision 1.7: Only use getnanotime instead of nanotime if we would run into trouble with nanotime (i.e. if we are tracing KTR_LOCK). Reviewed by: jhb --- sys/kern/kern_ktr.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_ktr.c b/sys/kern/kern_ktr.c index 01467d12f8b8..65a4ac6b22ab 100644 --- a/sys/kern/kern_ktr.c +++ b/sys/kern/kern_ktr.c @@ -128,7 +128,15 @@ 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); - getnanotime(&entry->ktr_tv); + if (ktr_mask & KTR_LOCK) + /* + * We can't use nanotime with KTR_LOCK, it would cause + * endless recursion, at least under the Intel + * architecture. + */ + getnanotime(&entry->ktr_tv); + else + nanotime(&entry->ktr_tv); #ifdef KTR_EXTEND strncpy(entry->ktr_filename, filename, KTRFILENAMESIZE - 1); entry->ktr_filename[KTRFILENAMESIZE - 1] = '\0';