bad call to sched_bind() => hang, even with INVARIANTS

Chris Torek torek at torek.net
Thu May 15 17:29:31 UTC 2014


I was poking around with a bhyve emulation, where the emulation
has only one CPU but the real systems have more.

In our real-system code we had a sched_bind() that just assumed there
were 2 or more CPUs, instead of just the 1.  This caused the entire
system to hang.  (Note: using SCHED_ULE.)

It's not immediately obvious to me what went wrong "underneath" to
cause the whole-system hang, but clearly it is wrong to attempt to
pin a thread to a CPU that does not exist.  Should sched_bind()
have a KASSERT in it to make sure that the cpu argument is
sensible?  (Or maybe even something a little more aggressive?)

Chris


More information about the freebsd-hackers mailing list