HomeFreeBSD

iflib: initialize the STATE_LOCK in iflib_register

Description

iflib: initialize the STATE_LOCK in iflib_register

From Jake:
r347197 contained an MFC for r332389, adding the STATE_LOCK to the iflib
core driver. Unfortunately, the commit accidentally missed adding the
STATE_LOCK_INIT.

Without this, if you build a STABLE-11 kernel with INVARIANTS enabled,
any mtx_lock of the state lock will result in a panic:

panic: mtx_lock() of spin mutex (null) @ /usr/src/sys/net/iflib.c:5522

It actually ends up looking like a panic due to taking a spin mutex when
we could be interrupted. However, the real cause is because the lock
class was never initialized.

Initialize the STATE_LOCK properly during iflib_register to fix this.

Submitted by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed by: erj@
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D21540

Details

Provenance
erjAuthored on
Differential Revision
D21540: initialize the STATE_LOCK in iflib_register
Parents
rS352090: bectl(8): fix mis-merge
Branches
Unknown
Tags
Unknown