Page MenuHomeFreeBSD

Add sysctl flag CTLFLAG_TUN to loader tunables
ClosedPublic

Authored by zlei on Oct 6 2023, 6:08 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, May 26, 1:58 AM
Unknown Object (File)
Sun, May 26, 1:53 AM
Unknown Object (File)
Sat, May 25, 9:04 PM
Unknown Object (File)
Apr 23 2024, 10:39 PM
Unknown Object (File)
Apr 23 2024, 1:37 AM
Unknown Object (File)
Apr 6 2024, 4:46 PM
Unknown Object (File)
Mar 16 2024, 11:32 PM
Unknown Object (File)
Mar 16 2024, 11:31 PM
Subscribers

Details

Reviewers
kib
imp
rmacklem
markj
Group Reviewers
cam
Commits
rGfc2149590f73: proc: Add sysctl flag CTLFLAG_TUN to loader tunable
rG205b1c574cae: buf: Add sysctl flag CTLFLAG_TUN to loader tunable
rG83091c864451: sockets: Add sysctl flag CTLFLAG_TUN to loader tunable
rG718c395417de: mbuf: Add sysctl flag CTLFLAG_TUN to loader tunables
rG4bf2e34a35ec: fd: Add sysctl flag CTLFLAG_TUN to loader tunables
rG5312436fef0a: x86: Add sysctl flag CTLFLAG_TUN to loader tunables
rGccf8370b8193: nfscl: Add sysctl flag CTLFLAG_TUN to loader tunable
rG654d8b545577: ddb: Add sysctl flag CTLFLAG_TUN to loader tunable
rGca40845c3aba: cam/scsi: Add sysctl flag CTLFLAG_TUN to loader tunable
rGfd18dc70ceda: mbuf: Add sysctl flag CTLFLAG_TUN to loader tunables
rG5e5a2ef8585d: buf: Add sysctl flag CTLFLAG_TUN to loader tunable
rG8651da955203: sockets: Add sysctl flag CTLFLAG_TUN to loader tunable
rG7563e1baf46e: fd: Add sysctl flag CTLFLAG_TUN to loader tunables
rG9d6eb30abb29: x86: Add sysctl flag CTLFLAG_TUN to loader tunables
rG4e74b80165b0: nfscl: Add sysctl flag CTLFLAG_TUN to loader tunable
rG148a0f6bf059: ddb: Add sysctl flag CTLFLAG_TUN to loader tunable
rGe266819e47f7: cam/scsi: Add sysctl flag CTLFLAG_TUN to loader tunable
rG5184476107f7: buf: Add sysctl flag CTLFLAG_TUN to loader tunable
rG6dbde8424561: sockets: Add sysctl flag CTLFLAG_TUN to loader tunable
rG0007ba082c33: mbuf: Add sysctl flag CTLFLAG_TUN to loader tunables
rG4f8eaa24a2ac: fd: Add sysctl flag CTLFLAG_TUN to loader tunables
rGcabab5c36287: x86: Add sysctl flag CTLFLAG_TUN to loader tunables
rG234919330105: nfscl: Add sysctl flag CTLFLAG_TUN to loader tunable
rG9edd54537025: ddb: Add sysctl flag CTLFLAG_TUN to loader tunable
rG7ac42534c234: cam/scsi: Add sysctl flag CTLFLAG_TUN to loader tunable
rG964a91aac9c9: proc: Add sysctl flag CTLFLAG_TUN to loader tunable
rG8c4eaac1534e: buf: Add sysctl flag CTLFLAG_TUN to loader tunable
rGe4f97a1ec798: sockets: Add sysctl flag CTLFLAG_TUN to loader tunable
rGb1456fd62094: mbuf: Add sysctl flag CTLFLAG_TUN to loader tunables
rGd9aa72334782: fd: Add sysctl flag CTLFLAG_TUN to loader tunables
rG9eac775b415b: x86: Add sysctl flag CTLFLAG_TUN to loader tunables
rG3133f4d9dec4: nfscl: Add sysctl flag CTLFLAG_TUN to loader tunable
rG0de3d5316cbc: ddb: Add sysctl flag CTLFLAG_TUN to loader tunable
rG4bf38105464b: cam/scsi: Add sysctl flag CTLFLAG_TUN to loader tunable
rG35b3be81f1d9: proc: Add sysctl flag CTLFLAG_TUN to loader tunable
rG31b94065300a: buf: Add sysctl flag CTLFLAG_TUN to loader tunable
rG978be1ee5d5f: sockets: Add sysctl flag CTLFLAG_TUN to loader tunable
rG6a88498e53b2: mbuf: Add sysctl flag CTLFLAG_TUN to loader tunables
rG2af5ce5b5efb: fd: Add sysctl flag CTLFLAG_TUN to loader tunables
rG149b9c234b00: x86: Add sysctl flag CTLFLAG_TUN to loader tunables
rG95c01e9b3294: nfscl: Add sysctl flag CTLFLAG_TUN to loader tunable
rG0eb2e197896e: ddb: Add sysctl flag CTLFLAG_TUN to loader tunable
rGe2ad7ce37b1a: cam/scsi: Add sysctl flag CTLFLAG_TUN to loader tunable
Summary

These variables are actually loader tunables. Add sysctl
flag CTLFLAG_TUN to them so that sysctl -T will report them correctly.

No functional change intended.

MFC after: 3 days

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

zlei requested review of this revision.Oct 6 2023, 6:08 PM

Those are part of the tunables spotted by the following script:

#!/bin/sh

egrep -ohr 'TUNABLE_[A-Z]+_FETCH\(.+,' sys | egrep -o '".+"' | sed -n -Ee 's/^"(.+)"$/\1/p' | sort | uniq > tunables_uniq.txt

while read -r line; do
    sysctl -q $line > /dev/null && {
      t=$( sysctl -TN $line )
      [ -z "$t" ] && echo "$line"
    }
done < tunables_uniq.txt

Tested on an amd64 VM.

sys/kern/kern_proc.c
165 ↗(On Diff #128379)

What if enabling this tunable everywhere, might be in a follow-up commit?

This revision is now accepted and ready to land.Oct 6 2023, 8:28 PM
sys/kern/kern_proc.c
165 ↗(On Diff #128379)

It was loader tunable since edc8222303c78 (Make kstack_pages a tunable on arm, x86, and powepc.)

init_param1(void)
 {
 
+#if !defined(__mips__) && !defined(__arm64__) && !defined(__sparc64__)
+       TUNABLE_INT_FETCH("kern.kstack_pages", &kstack_pages);
+#endif

Then spark64 support was removed in 58aa35d42975c

init_param1(void)
 {
 
-#if !defined(__mips__) && !defined(__arm64__) && !defined(__sparc64__)
+#if !defined(__mips__) && !defined(__arm64__)
        TUNABLE_INT_FETCH("kern.kstack_pages", &kstack_pages);
 #endif

And finally mips support was removed in a3571129380d:

init_param1(void)
 {
 
-#if !defined(__mips__) && !defined(__arm64__)
+#if !defined(__arm64__)
        TUNABLE_INT_FETCH("kern.kstack_pages", &kstack_pages);

What if enabling this tunable everywhere, might be in a follow-up commit ?

It is good to enable it everywhere. That requires extra works to enable kstack_pages tunable on arm64, but I'm not expert on arm64 architecture and have no clues how to enable that feature.

To enable this feature on arm64, you need to remove the remaining #ifdef braces. When I added the knob, I disabled it on arches where thread0 stack size cannot be controlled with it. I think it is not too important in current times, and arm64 maintainers can fix it eventually if they want.

Just leave a note here.
It seems riscv might have problem with kern.kstack_pages. The logic for thread0 stack size is identical to arm64.