Page MenuHomeFreeBSD

witness: actually set read-only tunables in time for witness_startup
ClosedPublic

Authored by rlibby on Jun 16 2026, 11:19 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Aug 19, 7:37 PM
Unknown Object (File)
Sat, Aug 15, 12:11 AM
Unknown Object (File)
Fri, Aug 14, 9:27 PM
Unknown Object (File)
Thu, Aug 13, 1:13 AM
Unknown Object (File)
Wed, Aug 12, 1:53 AM
Unknown Object (File)
Mon, Aug 10, 12:37 PM
Unknown Object (File)
Mon, Aug 10, 1:54 AM
Unknown Object (File)
Mon, Aug 10, 12:37 AM
Subscribers

Details

Summary

SYSCTL_XXX with CTLFLAG_RDTUN and without CTLFLAG_NOFETCH should not be
used for values that are needed before SI_SUB_KLD. Otherwise they are
tuned after they are needed. Set CTLFLAG_RDTUN | CTLFLAG_NOFETCH for
the debug.witness.witness_count and debug.witness.skipspin sysctls and
add separate tunables for them, which run at SI_SUB_TUNABLES time, i.e.,
in time for witness_startup.

Sponsored by: Dell Inc.

Diff Detail

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

Event Timeline

So, why mess with the types (int -> bool and int -> u_long)? Strictly speaking it is not necessary and I can revert it if you prefer. I note though that there is no TUNABLE_UINT() and a comment for TUNABLE_INT() suggests not to use it. I don't know why this is, but just converting to bool and u_long seems fine anyway.

So, why mess with the types (int -> bool and int -> u_long)? Strictly speaking it is not necessary and I can revert it if you prefer. I note though that there is no TUNABLE_UINT() and a comment for TUNABLE_INT() suggests not to use it. I don't know why this is, but just converting to bool and u_long seems fine anyway.

Converting to bool is fine IMO. sysctl_handle_bool() provides some backward compatibility for code which assumes the old type. The int -> u_long conversion is not backwards compatible but I can't imagine that it's a problem in this case.

This revision is now accepted and ready to land.Jun 17 2026, 1:27 PM