ixgbe_mdio_attach() ran from ixgbe_if_attach_post(), which iflib calls
with the context lock held. Attaching the MDIO bus there also probes
and attaches the devices on it, and their register accesses go through
ixgbe_mdio_readreg_c22() and ixgbe_mdio_writereg_c22(), which take the
same lock. A driver on the bus that was in the kernel or loaded by
loader(8) therefore recursed on the non-recursive iflib sx lock as soon
as it touched a register: INVARIANTS kernels panic in _sx_xlock_hard(),
others recurse silently.
Wrap iflib_device_attach() and attach the MDIO bus once it has
returned, so the children take the context lock like any later MDIO
access does.
Fixes: cfec995c87f3 ("ixgbe: add MDIO bus support")
Sponsored by: Rubicon Communications, LLC ("Netgate")