Page MenuHomeFreeBSD

fix build with LOCK_PROFILING but without KDTRACE_HOOKS
ClosedPublic

Authored by kp on Wed, Nov 27, 8:39 PM.
Tags
None
Referenced Files
F106170537: D47822.diff
Thu, Dec 26, 1:24 PM
Unknown Object (File)
Sat, Dec 14, 12:06 AM
Unknown Object (File)
Fri, Dec 13, 4:48 AM
Unknown Object (File)
Wed, Dec 11, 3:51 AM
Unknown Object (File)
Tue, Dec 10, 10:53 PM
Unknown Object (File)
Tue, Dec 10, 10:13 AM
Unknown Object (File)
Sat, Dec 7, 8:53 PM
Unknown Object (File)
Thu, Dec 5, 12:10 PM
Subscribers

Details

Summary

Sponsored by: Rubicon Communications, LLC ("Netgate")

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 60857
Build 57741: arc lint + arc unit

Event Timeline

kp requested review of this revision.Wed, Nov 27, 8:39 PM
kib added inline comments.
sys/kern/kern_rwlock.c
476

I do not understand this block. LOCK_PROFILING does not depend on KDTRACE_HOOK. While your patch puts LOCK_PROFILING control inside KDTRACE_HOOK block.

sys/kern/kern_rwlock.c
476

I think I misunderstood the intent behind doing_lockprof. It's to allow lock profiling to be enabled either unconditionally (with LOCK_PROFILING) or conditionally. (if KDTRACE_HOOKS and LOCKSTAT_PROFILE_ENABLED() returns true).

So the correct thing here would be:

#if defined(KDTRACE_HOOKS)
	uintptr_t state = 0;
#endif
#if defined(KDTRACE_HOOKS) || defined(LOCK_PROFILING)
	int doing_lockprof = 0;
#endif

(And then not have this #ifdef LOCK_PROFILING here, of course)

sys/kern/kern_rwlock.c
476

Yes, this sounds more correct.

sys/kern/kern_rwlock.c
465

Merge this block of ifdef with the previous one?

480

Remove the assignment?

966

Same?

sys/kern/kern_sx.c
586

Same, merge?

607

This line can be removed, the same assignment is happen right after the block.

1055

Same

Review remarks

We now unconditionally assign 'state = v' (ifdef KDTRACE_HOOKS), but that should
be fine, because we only ever use 'state' if doing_lockprof is true, which is
when it was assigned prior to this change.
Updating D47822: fix build with LOCK_PROFILING but without KDTRACE_HOOKS

This revision is now accepted and ready to land.Fri, Nov 29, 4:09 PM
sys/kern/kern_rwlock.c
480

I don't see how this assignment can be removed. Without we'd always have state = 0.

sys/kern/kern_rwlock.c
480

It’ll be set if doing_lockprof == 1, which is the only case we actually use it.
Either because LOCKSTAT_PROFILE_ENABLED or LOCK_PROFILING.

markj added inline comments.
sys/kern/kern_rwlock.c
480

I think I misunderstood kib's comment because it applied to an old version of the file, so the comment appears in a misleading place.