From nobody Tue Sep 05 22:15:22 2023 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 4RgKZL5pzBz4sXs3; Tue, 5 Sep 2023 22:15:22 +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 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RgKZL5LwDz4MRK; Tue, 5 Sep 2023 22:15:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1693952122; 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=F30PriHE+s3b2ipeV7cFY/EkxN4LEaku4cIsSkvJlR8=; b=MX1O78vmvM3gWa/f37aqIEthztLOwVhL0rY66baqVj9h66EdsgwbUk8WHYqW0ojLwhXGFZ 4FvCYDVWq2i71OtoOuIjF7fa7rCZgDnsiGX3ylnDffWkWKPFLCi2r3lJzmHnPaAaaImM9x y7F/SQms8phrae2pVyshUS8+YuiDHlBuVkTm8xxNTCsohPosNIujiWbXl4YR/4nq8BViVW dEteK6kBXG7lkfpFe9kffiv0wI5SfhAR6pKz3i1jkw9ATtFm9fqlgJzWDsg1t8uo/fI9U1 VUusAlDwtSne1U2lX7eCxBqLGPmDv4w6iSkQU71GJVf+KI1os3LaXwW3fvjTZA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1693952122; a=rsa-sha256; cv=none; b=boocVjpjxLBJZdY3o5nFmgDgqyIXDPkb5SUfYlH3+xL7hYWVXwwyh1Xj3wdH4kIMoxbcOq qss0l4e/4uuR2eilFX7brRI23jYUwQOrxfNcpLZ7vzkKs/bwKNtos6vvN8xjoCi4S6mQZK TPdH1Tt9xiokmGbqyw15b/joerltiCNv3slmd7Unw1743+Jr2xSEvpNaH5uG8gOztwwyOj uvDI8ux+nbNJL9pm9FCeXDrBMwl3/jJVKy2Zn+V0I0mWuZxqSZG3huCuMuCl6636t2pFOM wAXFsCXidbhbKWw1Su5o1ePg49NjW/7hxdRHUnpis6lJV11xbVdaG8+JIWbN9A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1693952122; 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=F30PriHE+s3b2ipeV7cFY/EkxN4LEaku4cIsSkvJlR8=; b=GSwQyUxqwHXADqb16wwAyekpWS2qdRwEhzgJdVUI/ktdmUPFpJ8dpi3PYKMbPxyGSYFgFr raGkdnFpDjMbe6G0j4wr5Pz2mFLf2jVvT+vzX6KIdNiprvBqqeL/gCS3od2aHClG/o4jYi 9hBxjvbtCxITXI2iLU2aYz0ADur6hL0ekpezDYNDBrihL+9bYY7vowVv7ExAlhNxu8CSFz esGSqRAaZPTyu4bP6tcmasrlvBBzUuvPUAWt3U4GkLJK0lgjAJrR7CnOostCuCVD5R+jQX 9lfnHy7wfd+6151qnZizAi0EfDfh8Ugj1o2laHD6RAzDzcErcm4lES/GJwRU4Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4RgKZL4QJfzrBP; Tue, 5 Sep 2023 22:15:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 385MFMRF058598; Tue, 5 Sep 2023 22:15:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 385MFMZh058595; Tue, 5 Sep 2023 22:15:22 GMT (envelope-from git) Date: Tue, 5 Sep 2023 22:15:22 GMT Message-Id: <202309052215.385MFMZh058595@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Navdeep Parhar Subject: git: 3814249f1e8d - main - cxgbe(4): Avoid hang on kldunload on netlink enabled kernels. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3814249f1e8dacfcd326dd7c416c528a1d88b6a1 Auto-Submitted: auto-generated The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=3814249f1e8dacfcd326dd7c416c528a1d88b6a1 commit 3814249f1e8dacfcd326dd7c416c528a1d88b6a1 Author: Navdeep Parhar AuthorDate: 2023-09-05 18:21:03 +0000 Commit: Navdeep Parhar CommitDate: 2023-09-05 22:10:02 +0000 cxgbe(4): Avoid hang on kldunload on netlink enabled kernels. netlink(4) calls back into the driver during detach and it attempts to start an internal synchronized op recursively, causing an interruptible hang. Fix it by failing the ioctl if the VI has been marked as DOOMED by cxgbe_detach. Here's the stack for the hang for reference. #6 begin_synchronized_op #7 cxgbe_media_status #8 ifmedia_ioctl #9 cxgbe_ioctl #10 if_ioctl #11 get_operstate_ether #12 get_operstate #13 dump_iface #14 rtnl_handle_ifevent #15 rtnl_handle_ifnet_event #16 rt_ifmsg #17 if_unroute #18 if_down #19 if_detach_internal #20 if_detach #21 ether_ifdetach #22 cxgbe_vi_detach #23 cxgbe_detach #24 DEVICE_DETACH MFC after: 3 days Sponsored by: Chelsio Communications --- sys/dev/cxgbe/t4_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index 759887a2a488..a32cd9a3f2df 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -3459,7 +3459,7 @@ cxgbe_media_status(if_t ifp, struct ifmediareq *ifmr) struct adapter *sc = pi->adapter; struct link_config *lc = &pi->link_cfg; - if (begin_synchronized_op(sc, NULL, SLEEP_OK | INTR_OK, "t4med") != 0) + if (begin_synchronized_op(sc, vi , SLEEP_OK | INTR_OK, "t4med") != 0) return; PORT_LOCK(pi);