Page MenuHomeFreeBSD

Add corresponding sysctl knobs for loader tunables
ClosedPublic

Authored by zlei on Oct 9 2023, 6:42 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 1, 11:22 PM
Unknown Object (File)
Fri, Nov 1, 11:22 PM
Unknown Object (File)
Fri, Nov 1, 11:14 PM
Unknown Object (File)
Sep 27 2024, 2:35 AM
Unknown Object (File)
Sep 27 2024, 2:12 AM
Unknown Object (File)
Sep 26 2024, 5:59 PM
Unknown Object (File)
Sep 26 2024, 12:47 PM
Unknown Object (File)
Sep 26 2024, 3:20 AM
Subscribers

Details

Summary

Those are loader tunables but missing corresponding sysctl knobs. Add them so that sysctl -T will report them correctly.

MFC after: 1 week

Test Plan

Verify via sysctl -T with kernel built with KASAN or KMSAN (can not built with both).

Kernel with KASAN:
Escape to boot loader prompt:

set kern.boottrace.enabled=1
set vm.pgcache_zone_max_pcpu=1024
set vm.numa.disabled=1
set debug.kasan.disabled=1
boot
# sysctl -T kern.boottrace
kern.boottrace.table_size: 3000
kern.boottrace.shutdown_trace_threshold: 0
kern.boottrace.shutdown_trace: 0
kern.boottrace.enabled: 1

# sysctl -T vm.pgcache_zone_max_pcpu
vm.pgcache_zone_max_pcpu: 1024

# sysctl -T vm.numa.disabled
vm.numa.disabled: 1

# sysctl -T debug.kasan
debug.kasan.disabled: 1
debug.kasan.panic_on_violation: 1

Kernel with KMSAN:

Escape to boot loader prompt:

set debug.kmsan.disabled=1
boot
# sysctl -T debug.kmsan
debug.kmsan.disabled: 1
debug.kmsan.panic_on_violation: 1

Diff Detail

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

Event Timeline

zlei requested review of this revision.Oct 9 2023, 6:42 PM
zlei edited the test plan for this revision. (Show Details)

Tested on amd64.

set debug.kmsan.disabled=1

With KMSAN enabled, the kernel would not boot correctly. Update test plan to disable it.

In D42138#961451, @zlei wrote:

set debug.kmsan.disabled=1

With KMSAN enabled, the kernel would not boot correctly. Update test plan to disable it.

Yes, there is a bug there that I'm working on this week. Related to the LLVM 16 import.

sys/kern/subr_msan.c
145 ↗(On Diff #128464)

Why did you invert the sense of the existing knob? That is, why not have debug.kmsan.enabled? It seems unnecessarily confusing.

sys/vm/vm_page.c
204 ↗(On Diff #128464)
sys/kern/subr_msan.c
145 ↗(On Diff #128464)

I planned to MFC it to stable branches.

IMO convert debug.kmsan.disabled to debug.kmsan.enabled is a breakage, although the affected users are mainly developers.

Another point is that, if the compile option KMSAN is enabled (in the kernel conf) then debug.kmsan.disabled can hint the default is enabled rather than disabled.

I must admit that a define

#define kmsan_enabled (!kmsan_disabled)

is not elegant but that prevent too many diffs.

# egrep -r 'kmsan_enabled' sys/kern/subr_msan.c
sys/kern/subr_msan.c:#define kmsan_enabled (!kmsan_disabled)
sys/kern/subr_msan.c:	if (__predict_false(!kmsan_enabled)) {
sys/kern/subr_msan.c:	if (__predict_false(!kmsan_enabled))
sys/kern/subr_msan.c:	if (__predict_false(!kmsan_enabled))
sys/kern/subr_msan.c:	if (__predict_false(!kmsan_enabled))
sys/kern/subr_msan.c:	if (__predict_false(!kmsan_enabled))
sys/kern/subr_msan.c:	if (__predict_false(!kmsan_enabled))
sys/kern/subr_msan.c:	if (__predict_false(!kmsan_enabled))
sys/kern/subr_msan.c:	if (__predict_false(!kmsan_enabled))
sys/kern/subr_msan.c:	if (!kmsan_enabled)
sys/kern/subr_msan.c:	if (!kmsan_enabled)
sys/kern/subr_msan.c:	if (__predict_false(!kmsan_enabled))
sys/kern/subr_msan.c:	if (__predict_false(!kmsan_enabled))
sys/kern/subr_msan.c:	if (!kmsan_enabled)
sys/kern/subr_msan.c:	if (__predict_false(!kmsan_enabled))
sys/kern/subr_msan.c:	if (__predict_false(!kmsan_enabled || curthread == NULL))

Ideally I can convert all !kmsan_enabled to kmsan_disabled.

This revision is now accepted and ready to land.Oct 11 2023, 1:44 PM