Using SCHED_4BSD now leads to a panic during kernel boot

From: Gary Jennejohn <garyj_at_gmx.de>
Date: Thu, 19 Jun 2025 14:46:08 UTC
I downloaded the latest HEAD sources today and compiled world and kernel.

I use SCHED_4BSD as my scheduler and that results in a panic during
the kernel boot.

Here's the text from the panic copied from a photo:

panic: runq_findq(): No thread on non-empty queue with idx=43
cpuid = 13
time = 1
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe00d6c4ee30
vpanic() at vpanic+0xff/frame 0xfffffe00d6c4ee60
panic() at panic+0x43/frame 0xfffffe00d6c4eec0
runq_not_empty() at runq_not_empty+0x72/frame 0xfffffe00d6c4eed0
sched_idletd() at sched_idletd+0x7c/frame 0xfffffe00d6c4eef0
fork_exit() at fork_exit+0x82/frame 0xfffffe00d6c4ef30
fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe00d6c4ef30
--- trap 0, rip = 0, rsp = 0, rbp = 0 ---
KDB: enter: panic
[ thread pid 11 tid 100016 ]

NOTE that I didn't get a crash dump.

However, if I enable SCHED_ULE everything works as expected.

So, it's pretty obvious that something is missing in the SCHED_4BSD
code which is causing the panic, and it would be good if it could be
identified and fixed.

-- 
Gary Jennejohn