Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Oct 2024 18:39:36 GMT
From:      Navdeep Parhar <np@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 42d8f6b75933 - stable/14 - cxgbe(4): Use correct synchronization when marking the adapter offline.
Message-ID:  <202410211839.49LIdabl037454@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by np:

URL: https://cgit.FreeBSD.org/src/commit/?id=42d8f6b75933329aaa7fcffed3abc5c7bfb43cb2

commit 42d8f6b75933329aaa7fcffed3abc5c7bfb43cb2
Author:     Navdeep Parhar <np@FreeBSD.org>
AuthorDate: 2024-10-04 18:11:22 +0000
Commit:     Navdeep Parhar <np@FreeBSD.org>
CommitDate: 2024-10-21 17:15:33 +0000

    cxgbe(4): Use correct synchronization when marking the adapter offline.
    
    adapter->flags are guarded by a synch_op, as noted in the comment in
    adapter.h where the flags are defined.
    
    Fixes:  5241b210a4e cxgbe(4): Basic infrastructure for ULDs to participate in adapter reset.
    Sponsored by:   Chelsio Communications
    
    (cherry picked from commit 52e5a66eac22d24e29f204c5b65232378e71f4cf)
---
 sys/dev/cxgbe/t4_main.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c
index f4e6b41d9fb4..769d4778a8d2 100644
--- a/sys/dev/cxgbe/t4_main.c
+++ b/sys/dev/cxgbe/t4_main.c
@@ -1990,18 +1990,23 @@ restart_adapter(struct adapter *sc)
 static inline void
 set_adapter_hwstatus(struct adapter *sc, const bool usable)
 {
-	mtx_lock(&sc->reg_lock);
 	if (usable) {
 		/* Must be marked reusable by the designated thread. */
+		ASSERT_SYNCHRONIZED_OP(sc);
 		MPASS(sc->reset_thread == curthread);
+		mtx_lock(&sc->reg_lock);
 		atomic_clear_int(&sc->error_flags, HW_OFF_LIMITS);
+		mtx_unlock(&sc->reg_lock);
 	} else {
 		/* Mark the adapter totally off limits. */
+		begin_synchronized_op(sc, NULL, SLEEP_OK, "t4hwsts");
+		mtx_lock(&sc->reg_lock);
 		atomic_set_int(&sc->error_flags, HW_OFF_LIMITS);
+		mtx_unlock(&sc->reg_lock);
 		sc->flags &= ~(FW_OK | MASTER_PF);
 		sc->reset_thread = NULL;
+		end_synchronized_op(sc, 0);
 	}
-	mtx_unlock(&sc->reg_lock);
 }
 
 static int



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202410211839.49LIdabl037454>