git: c15fc3249fa9 - stable/13 - Fix lockstat:::thread-spin dtrace probe with LOCK_PROFILING

From: Eric van Gyzen <vangyzen_at_FreeBSD.org>
Date: Wed, 02 Mar 2022 21:57:21 UTC
The branch stable/13 has been updated by vangyzen:

URL: https://cgit.FreeBSD.org/src/commit/?id=c15fc3249fa942e6229e65a7c07ff20a383da202

commit c15fc3249fa942e6229e65a7c07ff20a383da202
Author:     Eric van Gyzen <vangyzen@FreeBSD.org>
AuthorDate: 2021-08-02 18:54:57 +0000
Commit:     Eric van Gyzen <vangyzen@FreeBSD.org>
CommitDate: 2022-03-02 21:56:30 +0000

    Fix lockstat:::thread-spin dtrace probe with LOCK_PROFILING
    
    The spinning start time is missing from the calculation due to a
    misplaced #endif.  Return the #endif where it's supposed to be.
    
    Submitted by:   Alexander Alexeev <aalexeev@isilon.com>
    Reviewed by:    bdrewery, mjg
    MFC after:      1 week
    Sponsored by:   Dell EMC Isilon
    Differential Revision: https://reviews.freebsd.org/D31384
    
    (cherry picked from commit 428624130abfc225b479a09a3060d0939569b1ea)
---
 sys/kern/kern_mutex.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c
index 54a96603ece3..6343ad445623 100644
--- a/sys/kern/kern_mutex.c
+++ b/sys/kern/kern_mutex.c
@@ -899,6 +899,8 @@ thread_lock_flags_(struct thread *td, int opts, const char *file, int line)
 	doing_lockprof = 1;
 #elif defined(KDTRACE_HOOKS)
 	doing_lockprof = lockstat_enabled;
+#endif
+#ifdef KDTRACE_HOOKS
 	if (__predict_false(doing_lockprof))
 		spin_time -= lockstat_nsecs(&td->td_lock->lock_object);
 #endif