From nobody Fri Aug 19 21:09:45 2022 X-Original-To: dev-commits-src-main@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 4M8ZBx5v7nz4ZBP4; Fri, 19 Aug 2022 21:09:45 +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 4M8ZBx5Ms6z3jFr; Fri, 19 Aug 2022 21:09:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660943385; 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=pXK+6JBjTO32+3l7G58TiKnD1gx5FkbIrF2qWOMPCPI=; b=oSJsBW/xztAPBL6o+n31wSPIzU+scFmjMIWv3ferQV0Kf0TcZxA1LngztEpFud/HqH8A0/ DWmR65y5DI08u8I04FdtY3AHIA2/BKpU1T/fHXcKli0SYg69EhazUUklaM5PIDs4vd4MbI d5esDgc/Cr17ceGBDLg1iov0fAc783cETrngLPPZEYMIQsYYzxTx9MyxgBKEFynlHXMQZf UZSJVGuul3KgaJebfAL5myvZC8napQUEOndEsPgW3cgAHf56GCgJq7oOTMgsXGxiugK7KX e60wmSup6rz+6BZvfLoO/iOmb+zAUxrT5LcdXlbuHzELWpIzKiqC2UuVOnR10w== 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 4M8ZBx49MWz168h; Fri, 19 Aug 2022 21:09:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 27JL9jb5056569; Fri, 19 Aug 2022 21:09:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 27JL9joI056568; Fri, 19 Aug 2022 21:09:45 GMT (envelope-from git) Date: Fri, 19 Aug 2022 21:09:45 GMT Message-Id: <202208192109.27JL9joI056568@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 7647626d3380 - main - e6000sw: fix incorrect locking List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7647626d3380d17096b2690eb25f9d8fa18d0f83 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660943385; 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=pXK+6JBjTO32+3l7G58TiKnD1gx5FkbIrF2qWOMPCPI=; b=lW2ijRSX0csHRwbxDxWXGoEEyVRwBB4rfUKFU4NYKQ52707AgWZLfT08NzHVN0HEsNBeLB vhcnUCF6MCudgzbI+V7/NyCCJ78lODMWxam6nXYt5CBhigmkLUb6ALQXlA81CrRJeI1TMk OD2RMolHoiYrrTaIuJm3kERosXqFHMMkGxmFHzG01J5uxTygq6REn6st6GRkEjKGxhM0zt KChvsXZk2sFwP+G3ys4qkxzcX6oId2qpfo5e6D7tDWoQ05x7sggT4L+KCrpmlCGXnu/cpq h9f19X3aRvBFOMTFYY8MY7qMJupQPI0GBxsL7OqecWFPH/XCh7ljIFtnOF335g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1660943385; a=rsa-sha256; cv=none; b=tUgsr0Ron9QBvowaMFQ0KDUD6PNUO3KstY11wzvbrKwD45DtRRzRcAl9H+I1uwwEXC6RtJ heAeyLME9Onns5fW+KHPst51iWcWnmchBaVFqCcmgZwXii85p0Qpu2CQHzcFaS/4axwdfO 0aECzHJkNp+JOKGac1Hcfi7fORk952ns5OFyK1zx52EdgTl/1rW3fdn2w1BcIPH/g8oFTq 1xrLLdo9wmSmRRfOW7QHE/MmTGM++Ec9bS0OrNDkTuf4nBgd1+vzj7Lyiy9bKWndlaHE1e T2yLLiGrXJYX6TTYyksdJnTj97DLk6iHBA9o6z+8Xc5A2++h47/hfMCTOg7kmg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=7647626d3380d17096b2690eb25f9d8fa18d0f83 commit 7647626d3380d17096b2690eb25f9d8fa18d0f83 Author: Kristof Provost AuthorDate: 2022-08-10 13:57:05 +0000 Commit: Kristof Provost CommitDate: 2022-08-19 21:09:11 +0000 e6000sw: fix incorrect locking During attach we release the lock to call e6000sw_attach_miibus(), which calls mii_attach(). The mii_attach() function calls miibus_readreg() / miibus_writereg(). However, these are set to be e6000sw_readphy_locked(). That is, the read/write phy functions do not acquire the lock, but expect to be called while locked. Simply do not unlock and relock while calling mii_attach(). Reviewed by: Hubert Mazur Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D36117 --- sys/dev/etherswitch/e6000sw/e6000sw.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/sys/dev/etherswitch/e6000sw/e6000sw.c b/sys/dev/etherswitch/e6000sw/e6000sw.c index d096c31b349a..f3d46ff2f926 100644 --- a/sys/dev/etherswitch/e6000sw/e6000sw.c +++ b/sys/dev/etherswitch/e6000sw/e6000sw.c @@ -529,20 +529,11 @@ e6000sw_attach(device_t dev) if (!e6000sw_is_phyport(sc, port)) continue; - /* - * It's necessary to unlock mutex, because e6000sw_attach_miibus - * calls functions, which try to lock mutex.That leads - * to recursive lock on non recursive mutex. - */ - E6000SW_UNLOCK(sc); - err = e6000sw_attach_miibus(sc, port); if (err != 0) { device_printf(sc->dev, "failed to attach miibus\n"); goto out_fail; } - - E6000SW_LOCK(sc); } etherswitch_info.es_nports = sc->num_ports;