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
F174582042: D57613.id179970.diff
Sun, Oct 4, 9:42 AM
Unknown Object (File)
Sat, Oct 3, 2:24 AM
Unknown Object (File)
Fri, Oct 2, 11:05 AM
Unknown Object (File)
Fri, Oct 2, 12:43 AM
Unknown Object (File)
Tue, Sep 29, 6:03 AM
Unknown Object (File)
Sun, Sep 27, 3:54 PM
Unknown Object (File)
Sun, Sep 27, 2:51 AM
Unknown Object (File)
Sat, Sep 26, 3:12 PM
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 Not Applicable
Unit
Tests Not Applicable

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