The branch main has been updated by kp:

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

commit 928864a93594eddbf5bf67310bb0f5c684350dc6
Author:     Kristof Provost <k...@freebsd.org>
AuthorDate: 2024-11-27 17:06:41 +0000
Commit:     Kristof Provost <k...@freebsd.org>
CommitDate: 2024-12-02 19:36:35 +0000

    fix build with LOCK_PROFILING but without KDTRACE_HOOKS
    
    Reviewed by:    kib, markj
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
    Differential Revision:  https://reviews.freebsd.org/D47822
---
 sys/kern/kern_rwlock.c | 10 ++++------
 sys/kern/kern_sx.c     | 10 +++-------
 2 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/sys/kern/kern_rwlock.c b/sys/kern/kern_rwlock.c
index 3286fce76d96..03d59d613e74 100644
--- a/sys/kern/kern_rwlock.c
+++ b/sys/kern/kern_rwlock.c
@@ -461,9 +461,9 @@ __rw_rlock_hard(struct rwlock *rw, struct thread *td, 
uintptr_t v
        u_int sleep_cnt = 0;
        int64_t sleep_time = 0;
        int64_t all_time = 0;
+       uintptr_t state = 0;
 #endif
 #if defined(KDTRACE_HOOKS) || defined(LOCK_PROFILING)
-       uintptr_t state = 0;
        int doing_lockprof = 0;
 #endif
 
@@ -473,12 +473,11 @@ __rw_rlock_hard(struct rwlock *rw, struct thread *td, 
uintptr_t v
                        goto out_lockstat;
                doing_lockprof = 1;
                all_time -= lockstat_nsecs(&rw->lock_object);
-               state = v;
        }
+       state = v;
 #endif
 #ifdef LOCK_PROFILING
        doing_lockprof = 1;
-       state = v;
 #endif
 
        if (SCHEDULER_STOPPED())
@@ -936,9 +935,9 @@ __rw_wlock_hard(volatile uintptr_t *c, uintptr_t v 
LOCK_FILE_LINE_ARG_DEF)
        u_int sleep_cnt = 0;
        int64_t sleep_time = 0;
        int64_t all_time = 0;
+       uintptr_t state = 0;
 #endif
 #if defined(KDTRACE_HOOKS) || defined(LOCK_PROFILING)
-       uintptr_t state = 0;
        int doing_lockprof = 0;
 #endif
        int extra_work = 0;
@@ -955,13 +954,12 @@ __rw_wlock_hard(volatile uintptr_t *c, uintptr_t v 
LOCK_FILE_LINE_ARG_DEF)
                extra_work = 1;
                doing_lockprof = 1;
                all_time -= lockstat_nsecs(&rw->lock_object);
-               state = v;
        }
+       state = v;
 #endif
 #ifdef LOCK_PROFILING
        extra_work = 1;
        doing_lockprof = 1;
-       state = v;
 #endif
 
        if (SCHEDULER_STOPPED())
diff --git a/sys/kern/kern_sx.c b/sys/kern/kern_sx.c
index 4cc8ac8ce106..952cfae7c977 100644
--- a/sys/kern/kern_sx.c
+++ b/sys/kern/kern_sx.c
@@ -582,9 +582,9 @@ _sx_xlock_hard(struct sx *sx, uintptr_t x, int opts 
LOCK_FILE_LINE_ARG_DEF)
        u_int sleep_cnt = 0;
        int64_t sleep_time = 0;
        int64_t all_time = 0;
+       uintptr_t state = 0;
 #endif
 #if defined(KDTRACE_HOOKS) || defined(LOCK_PROFILING)
-       uintptr_t state = 0;
        int doing_lockprof = 0;
 #endif
        int extra_work = 0;
@@ -600,13 +600,12 @@ _sx_xlock_hard(struct sx *sx, uintptr_t x, int opts 
LOCK_FILE_LINE_ARG_DEF)
                extra_work = 1;
                doing_lockprof = 1;
                all_time -= lockstat_nsecs(&sx->lock_object);
-               state = x;
        }
+       state = x;
 #endif
 #ifdef LOCK_PROFILING
        extra_work = 1;
        doing_lockprof = 1;
-       state = x;
 #endif
 
        if (SCHEDULER_STOPPED())
@@ -1034,8 +1033,6 @@ _sx_slock_hard(struct sx *sx, int opts, uintptr_t x 
LOCK_FILE_LINE_ARG_DEF)
        u_int sleep_cnt = 0;
        int64_t sleep_time = 0;
        int64_t all_time = 0;
-#endif
-#if defined(KDTRACE_HOOKS) || defined(LOCK_PROFILING)
        uintptr_t state = 0;
 #endif
        int extra_work __sdt_used = 0;
@@ -1048,12 +1045,11 @@ _sx_slock_hard(struct sx *sx, int opts, uintptr_t x 
LOCK_FILE_LINE_ARG_DEF)
                        goto out_lockstat;
                extra_work = 1;
                all_time -= lockstat_nsecs(&sx->lock_object);
-               state = x;
        }
+       state = x;
 #endif
 #ifdef LOCK_PROFILING
        extra_work = 1;
-       state = x;
 #endif
 
        if (SCHEDULER_STOPPED())

Reply via email to