From nobody Thu Oct 19 21:16:17 2023 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 4SBL9t19zzz4xskd; Thu, 19 Oct 2023 21:16:18 +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 4SBL9s66DYz4KhW; Thu, 19 Oct 2023 21:16:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697750177; 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=WOyDTdeIsmHSNvND4Ez95Tt6BxE9PShgWDCTzVOKqpo=; b=eiRkZzLSr4uNqt5oZzdYSN1r/iWIGn6RDTUoT6IHmGDg5+00hXqYoYrJAQL61dL7xGFN7+ CJA7sIcYbYyJ99aiw+EcFLVh6xw2I1R182vCpWOyr1kp25rWaG67Gn8C/M2tHYoOqs7GHI u2LUv4n7P6j/L+Oug67I99cgQPjERA6Fcg7gmSwpKauJ7qd6x0pvC0likNYMkk8P/1AMy0 LccIs6y1ZrwULjgrn2WHugP08aJeF1+nMiHy50WRXYYj2WndSF3bM+eSkWR7/1Wh0HBizz 0rZRv2UimiwOfi3x1m6VqnKf0chMGG9GJHyMl7q+5B5CnXqKD7SF4ajo1JQ1ug== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1697750177; a=rsa-sha256; cv=none; b=bLGPnTmzGL4FH4xEXdtz+lg6cvCJjY8Eg9ZBjaXq0DKhYZEdaUHisepdFD5JMbVu/Fuhhs ZRwcp5pOQlZL2PVmoPNIg+BVgm83zTv/TDgRSly3qD2VZzKKu14elYqp3gbpZH3hWw7yyB sMr3eWg3RsVqFJDEtmAYD12QEzugmgfMlEK9KbfgVz+ouF/vhymmG8U+MSEWdYSku7W9hU c1DWI9xbIq2Kk8mHHrNS4AROFzfUdRA5EZbD1jZ/P9iLLlo2aJVW3Sm6YEVqiTJQdg5J/J P0Aml9UB/JaH5Uq78zdeq2HYI+1xxkSaKdaLho0vHT9kwLXYzTQGhS9pFUnS9Q== 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=1697750177; 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=WOyDTdeIsmHSNvND4Ez95Tt6BxE9PShgWDCTzVOKqpo=; b=AUxiPLFerusRIlr3OZjv+iEcFYgSo6pKq6g4+NmfOaIvq7a0pvsFz04L/dR02+Lt8gYW3T BPcKOnd5N5DV1iNadjGXwLBEqX4XFav14cT3/MDLKbYsZlFEdoHY6beCQBs92kYIX/HDSm M9xkb2P4y7JSQz63th5lAML5JOI53s7hpm0nuHXxwyptfLPG26xDmhes0eWDNjaTU5PXeY BmRUkvvyOTs2T7DtfE16baRNmrGjYh3i9BpESJLNdgOuqf0Vf0EMLvxDDRZfxYBxgSyXUD ZgJpLHVGECDezCB5B/KKVeS5U7Q8z8fDgeO1IrsZgjERuYggEVLjrotmKPkNuw== 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 4SBL9s54rqz15Td; Thu, 19 Oct 2023 21:16:17 +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 39JLGHub060199; Thu, 19 Oct 2023 21:16:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39JLGHxX060196; Thu, 19 Oct 2023 21:16:17 GMT (envelope-from git) Date: Thu, 19 Oct 2023 21:16:17 GMT Message-Id: <202310192116.39JLGHxX060196@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 7e02c7074c4c - main - mpi3mr: Move creation of watchdog to interupt config hook 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: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7e02c7074c4c6df77b860e0dbcd032a2ea04b98b Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=7e02c7074c4c6df77b860e0dbcd032a2ea04b98b commit 7e02c7074c4c6df77b860e0dbcd032a2ea04b98b Author: Sumit Saxena AuthorDate: 2023-10-19 21:06:29 +0000 Commit: Warner Losh CommitDate: 2023-10-19 21:09:38 +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 --- 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) {