From nobody Thu Oct 19 21:41:02 2023 X-Original-To: dev-commits-src-branches@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 4SBLkR1nWZz4xv40; Thu, 19 Oct 2023 21:41:03 +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 4SBLkR0CXgz4Q97; Thu, 19 Oct 2023 21:41:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697751663; 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=bgarciCD37Vz+U0z75ErZ4lQHWnkSCo/HNn8H4JEsx8=; b=potONWHi/wdpbgmpSCWgr/qRBR/aZIoZzGl6hDJdDhpBgVvqZ6CDLAWB68IxavlWIz9JS3 RMnrXO5PSoiE6tHcMefjfNYAtLaT9h1f2xwt7wrYYjvrDPv5eiSBxlZ8UTOVM8UI6TzKfO eXF3BkiNY4WUaPPVmVZ+izyj43CFcgKJj9OQ2dnhkl3p8MCZh5aWllM28XXDp3afQjXqRz quL7ylk1lwWxMS/MWxhgn6zOfiDXBywKD+1gmdF679Ae8/MVoLzwpN4xs1HHyE/bpRTyxO 1GvdF2EOpW69AclaWwkr3oHw8yrqjRQKkcF7P9I5D0cCZMFBc7l+Fe9PvSDN/A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1697751663; a=rsa-sha256; cv=none; b=P8i3xN+Whj59lIgDfCiNyG3QgmaYP0deJS1klVt3dmn+zSHa1/oP+3x9P03ndYwieq5E5b 92I3pzp10oL4LXzpiF3DUEnXV71gJZXEQ4wDTjmP5XC+TH6XL4+zO+0klV5tImY+X1jHvW weQD/QhxLeKQ8tYHCUykURE+fvRy55jpTSI5LbiKijLFV4G0qglFDYi2m5QDQhPBAiKfom tSNP02m+gLRmsp8/VSG6vIlFm3leycgUuFLCqX7U812ML4V5ix39xzxoHopegYfq8/RswW JdU9OstBtu66fVUYzvE0EnepSE2o6WlhiDEYgYLkXFRzSxcjo2Ti6/cTeiPtnA== 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=1697751663; 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=bgarciCD37Vz+U0z75ErZ4lQHWnkSCo/HNn8H4JEsx8=; b=st3cKy5jzrLGWeVxde9E03VhjiPSsyNDUmRPpZby09qU8dS4MgrGIcY1Y5DyyDDi5+xd00 BG07h7pj9PwHiAnZKclIlMs1ZxZcYjtKIq0UjHiYmf8gl/BAldwgBC496lESveRzF/SZHG qsMfi8nLstsauomRTD7iKCdorl5vhUAbU9u6GfVvsofthhYzq0ALgigsbRKrIYqJmiwWa1 kdFVUYLM6VCQbKos/5bN1/+Kxg6Jo2h0+6GN8JgfpqFJIgMvNameprIotS94fjohM/xggD al1dDkuuOQcJ9py0d2opwEzIpKaYm5Z1gr7EbjOe/yBwoau3rMi3lfbDeYEhwQ== 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 4SBLkQ6Qllz15tJ; Thu, 19 Oct 2023 21:41:02 +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 39JLf2U6002698; Thu, 19 Oct 2023 21:41:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39JLf2fv002696; Thu, 19 Oct 2023 21:41:02 GMT (envelope-from git) Date: Thu, 19 Oct 2023 21:41:02 GMT Message-Id: <202310192141.39JLf2fv002696@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 4c1b67934589 - releng/14.0 - mpi3mr: Move creation of watchdog to interupt config hook List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/releng/14.0 X-Git-Reftype: branch X-Git-Commit: 4c1b679345899a5ba988497bda7585ca15326b60 Auto-Submitted: auto-generated The branch releng/14.0 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=4c1b679345899a5ba988497bda7585ca15326b60 commit 4c1b679345899a5ba988497bda7585ca15326b60 Author: Sumit Saxena AuthorDate: 2023-10-19 21:15:50 +0000 Commit: Warner Losh CommitDate: 2023-10-19 21:38:06 +0000 mpi3mr: Move creation of watchdog to interupt config hook Move creation of watchdog process from just before we configure the interrupt config hook to into the config hook itself. This prevents it from racing the config intr hook and doing an extra reset of the card. This extra reset is usually harmless, but sometimes it can prevent discovery of devices if done at just the wrong time. This can lead to no disks being registered in a box full of disks, for example. Starting it later eliminates this race, making discovery reliable. Reviewed by: imp (cherry picked from commit 7e02c7074c4c6df77b860e0dbcd032a2ea04b98b) (cherry picked from commit 10bbea2e25ef95936619b6522bbdeea2317e76a5) Approved-by: re (gjb) --- sys/dev/mpi3mr/mpi3mr_pci.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/sys/dev/mpi3mr/mpi3mr_pci.c b/sys/dev/mpi3mr/mpi3mr_pci.c index d7278e5549e7..4935ac0d519c 100644 --- a/sys/dev/mpi3mr/mpi3mr_pci.c +++ b/sys/dev/mpi3mr/mpi3mr_pci.c @@ -307,6 +307,7 @@ static void mpi3mr_ich_startup(void *arg) { struct mpi3mr_softc *sc; + int error; sc = (struct mpi3mr_softc *)arg; mpi3mr_dprint(sc, MPI3MR_XINFO, "%s entry\n", __func__); @@ -314,8 +315,16 @@ mpi3mr_ich_startup(void *arg) mtx_lock(&sc->mpi3mr_mtx); mpi3mr_startup(sc); + mtx_unlock(&sc->mpi3mr_mtx); + error = mpi3mr_kproc_create(mpi3mr_watchdog_thread, sc, + &sc->watchdog_thread, 0, 0, "mpi3mr_watchdog%d", + device_get_unit(sc->mpi3mr_dev)); + + if (error) + device_printf(sc->mpi3mr_dev, "Error %d starting OCR thread\n", error); + mpi3mr_dprint(sc, MPI3MR_XINFO, "disestablish config intrhook\n"); config_intrhook_disestablish(&sc->mpi3mr_ich); sc->mpi3mr_ich.ich_arg = NULL; @@ -443,14 +452,6 @@ mpi3mr_pci_attach(device_t dev) goto load_failed; } - error = mpi3mr_kproc_create(mpi3mr_watchdog_thread, sc, - &sc->watchdog_thread, 0, 0, "mpi3mr_watchdog%d", - device_get_unit(sc->mpi3mr_dev)); - if (error) { - device_printf(sc->mpi3mr_dev, "Error %d starting OCR thread\n", error); - goto load_failed; - } - sc->mpi3mr_ich.ich_func = mpi3mr_ich_startup; sc->mpi3mr_ich.ich_arg = sc; if (config_intrhook_establish(&sc->mpi3mr_ich) != 0) {