From owner-svn-src-head@freebsd.org Wed Oct 9 21:08:52 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0958812F6D6; Wed, 9 Oct 2019 21:08:52 +0000 (UTC) (envelope-from jhb@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46pRfC6Z2jz41xv; Wed, 9 Oct 2019 21:08:51 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C53A41E689; Wed, 9 Oct 2019 21:08:51 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x99L8p4j042628; Wed, 9 Oct 2019 21:08:51 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x99L8pPl042627; Wed, 9 Oct 2019 21:08:51 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910092108.x99L8pPl042627@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 9 Oct 2019 21:08:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353369 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 353369 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Oct 2019 21:08:52 -0000 Author: jhb Date: Wed Oct 9 21:08:51 2019 New Revision: 353369 URL: https://svnweb.freebsd.org/changeset/base/353369 Log: Remove adapters from t4_list earlier during detach. This ensures the clip task won't race with t4_destroy_clip_table. While here, make some mutex destroys unconditional since attach always initializes them. Reviewed by: np MFC after: 1 week Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D21952 Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Wed Oct 9 21:02:06 2019 (r353368) +++ head/sys/dev/cxgbe/t4_main.c Wed Oct 9 21:08:51 2019 (r353369) @@ -1475,6 +1475,10 @@ t4_detach_common(device_t dev) sc->cdev = NULL; } + sx_xlock(&t4_list_lock); + SLIST_REMOVE(&t4_list, sc, adapter, link); + sx_xunlock(&t4_list_lock); + sc->flags &= ~CHK_MBOX_ACCESS; if (sc->flags & FULL_INIT_DONE) { if (!(sc->flags & IS_VF)) @@ -1568,12 +1572,6 @@ t4_detach_common(device_t dev) free(sc->tids.tid_tab, M_CXGBE); free(sc->tt.tls_rx_ports, M_CXGBE); t4_destroy_dma_tag(sc); - if (mtx_initialized(&sc->sc_lock)) { - sx_xlock(&t4_list_lock); - SLIST_REMOVE(&t4_list, sc, adapter, link); - sx_xunlock(&t4_list_lock); - mtx_destroy(&sc->sc_lock); - } callout_drain(&sc->sfl_callout); if (mtx_initialized(&sc->tids.ftid_lock)) { @@ -1582,12 +1580,8 @@ t4_detach_common(device_t dev) } if (mtx_initialized(&sc->tids.atid_lock)) mtx_destroy(&sc->tids.atid_lock); - if (mtx_initialized(&sc->sfl_lock)) - mtx_destroy(&sc->sfl_lock); if (mtx_initialized(&sc->ifp_lock)) mtx_destroy(&sc->ifp_lock); - if (mtx_initialized(&sc->reg_lock)) - mtx_destroy(&sc->reg_lock); if (rw_initialized(&sc->policy_lock)) { rw_destroy(&sc->policy_lock); @@ -1603,6 +1597,10 @@ t4_detach_common(device_t dev) if (rw_initialized(&mw->mw_lock)) rw_destroy(&mw->mw_lock); } + + mtx_destroy(&sc->sfl_lock); + mtx_destroy(&sc->reg_lock); + mtx_destroy(&sc->sc_lock); bzero(sc, sizeof(*sc));