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)
Tue, Sep 8, 7:33 PM
Unknown Object (File)
Tue, Sep 8, 4:21 PM
Unknown Object (File)
Mon, Sep 7, 7:05 PM
Unknown Object (File)
Mon, Sep 7, 12:45 PM
Unknown Object (File)
Sat, Sep 5, 11:00 AM
Unknown Object (File)
Sat, Sep 5, 8:29 AM
Unknown Object (File)
Sat, Sep 5, 4:52 AM
Unknown Object (File)
Fri, Sep 4, 10:49 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