From nobody Tue Nov 10 12:49:21 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4jP60x6PH9z6yNXk for ; Tue, 10 Nov 2026 12:49:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jP60x5vgPz3CPb for ; Tue, 10 Nov 2026 12:49:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794314961; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KBidI5qwCCRiumg7qRfjgpKyxtfwHDsh0xUmIUhEFa0=; b=VjiHlMYZPLuuX0NhcuvQpCDW2VD4K4s7mfN4ibGpVOC+YzRXYLnBzgpgR2xOGGiJXvEqco D9x6TT/usZ+bgfkeC0Fdg1u8oX9EBbWWxShCSxY8BXYBxEmIY2CH5N4iOhQ3DzDFVwuDn5 VQtRqKZ/Wmb9C1iwRwdyW0BZtT7wl71o66/1FrsH8caHD+G0+mWGaUVLwoiDodEKpFjNbD ItIXfiupzn0OSHtYZQwVYHVJk6Ms07w2whc8s1ehEafQf5oRHucPI5bKItKOsGUXIt9J55 L9lCIuO1cKqBoRkCrVRuDXS3fPj02NeZOSrlGUWznpctcTVjDwCV3yQqb2p4dw== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1794314961; b=glgX6MVe+x6S17MhuSBNlv0JtYlFXh8WecQR3UOQcHyk6TBVq7285dxyOMy5NO3OqBxuJJ l2Sj1iR4C2797Gu/VQf7WaVPtZvnYD0RIWIMeEFajXK/ptBHGWB21WedbebBjGI1Qb6w+Y 2A74yn4Q5l4BuVmVZWT525W8wfV3KD+PIOHxhrebUMzc3+VA5gAYHkVr5VtRbUZx+ZaDAc YyQMqNQCXLpFAAovv+3W7PoNNWFb3s1j5dJ7G2yopGvlo1pG1aNTxhHIGGhziukyO+4mfD JIkKF32Bi4c9Bo5aDMTG/hKiXSFfZwx7G2si7oDVUipfXBBsvqTi75uxlaFZBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794314961; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KBidI5qwCCRiumg7qRfjgpKyxtfwHDsh0xUmIUhEFa0=; b=LERrfFWQHb46WeaVYkjwtToWqYTHgCdE9uHfwM46jpBD204QVir2t5s7R0SfK9ojWc5Hdf 2J6di/dv9P/AEI8M9jkelU++tnj5szUokPgYsFN7VNkmYnBAiaJSQeL9GblhhXLQklzHHc jxwz0XIT9Jm03LeCp18ElWVRisaVb6POKlu4RLXqw+9vmLOe3aQPGdrZrOA8X2QotxrI4a BP+r6iw8RBFoSG0Woo9S3eQdylc5MMHLpdo30j5SLZ3Myc7uZt4m+LSWHmnIH33Xcg/ZJU h6XFjhLf2vRFgCcuq2vbxp9acUvui2wRlYIP+WD3Zd0y6JWNfbS77W/H6kdNbw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jP60x5ZKKzRY9 for ; Tue, 10 Nov 2026 12:49:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 15b0a by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 10 Nov 2026 12:49:21 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: R. Christian McDonald Subject: git: 88b7b8512107 - main - ixgbe: Attach the MDIO bus after iflib drops the context lock List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org List-Id: Commit messages for all branches of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rcm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 88b7b851210762af4827f71b2757a7d4673006a9 Auto-Submitted: auto-generated Date: Tue, 10 Nov 2026 12:49:21 +0000 Message-Id: <6af312d1.15b0a.4f2f7950@gitrepo.freebsd.org> The branch main has been updated by rcm: URL: https://cgit.FreeBSD.org/src/commit/?id=88b7b851210762af4827f71b2757a7d4673006a9 commit 88b7b851210762af4827f71b2757a7d4673006a9 Author: R. Christian McDonald AuthorDate: 2026-11-10 12:48:01 +0000 Commit: R. Christian McDonald CommitDate: 2026-11-10 12:48:01 +0000 ixgbe: Attach the MDIO bus after iflib drops the context lock 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. Reviewed by: kbowling Fixes: cfec995c87f3 ("ixgbe: add MDIO bus support") Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D61199 --- sys/dev/ixgbe/if_ix.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c index b429fb3992fb..688ff53ebb39 100644 --- a/sys/dev/ixgbe/if_ix.c +++ b/sys/dev/ixgbe/if_ix.c @@ -178,6 +178,7 @@ static const pci_vendor_info_t ixgbe_vendor_info_array[] = }; static void *ixgbe_register(device_t); +static int ixgbe_attach(device_t); static int ixgbe_if_attach_pre(if_ctx_t); static int ixgbe_if_attach_post(if_ctx_t); static int ixgbe_if_detach(if_ctx_t); @@ -317,7 +318,7 @@ static device_method_t ix_methods[] = { /* Device interface */ DEVMETHOD(device_register, ixgbe_register), DEVMETHOD(device_probe, iflib_device_probe), - DEVMETHOD(device_attach, iflib_device_attach), + DEVMETHOD(device_attach, ixgbe_attach), DEVMETHOD(device_detach, iflib_device_detach), DEVMETHOD(device_shutdown, iflib_device_shutdown), DEVMETHOD(device_suspend, iflib_device_suspend), @@ -1151,6 +1152,24 @@ ixgbe_register(device_t dev) return (&ixgbe_sctx_init); } /* ixgbe_register */ +/************************************************************************ + * ixgbe_attach - Device attach entry point + * + * The MDIO bus children are attached here rather than in + * ixgbe_if_attach_post(): their register accesses take the iflib + * context lock, which iflib holds across IFDI_ATTACH_POST. + ************************************************************************/ +static int +ixgbe_attach(device_t dev) +{ + int error; + + error = iflib_device_attach(dev); + if (error == 0) + ixgbe_mdio_attach(iflib_get_softc(device_get_softc(dev))); + return (error); +} /* ixgbe_attach */ + /************************************************************************ * ixgbe_if_attach_pre - Device initialization routine, part 1 * @@ -1459,9 +1478,6 @@ ixgbe_if_attach_post(if_ctx_t ctx) /* Add sysctls */ ixgbe_add_device_sysctls(ctx); - /* Add MDIO bus if required / supported */ - ixgbe_mdio_attach(sc); - /* Init recovery mode timer and state variable */ if (sc->feat_en & IXGBE_FEATURE_RECOVERY_MODE) { sc->recovery_mode = 0;