From nobody Wed Nov 29 01:55:47 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 4Sg2Tv6nmzz52tX9; Wed, 29 Nov 2023 01:55:47 +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 4Sg2Tv49nCz4FJN; Wed, 29 Nov 2023 01:55:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1701222947; 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=BGSAK9hlVH+ssrRx0qRCvhDCwr46ZR0RQRkV/vbDcJc=; b=pLmEPXh+OpDLtAnMmYcSXBrlFGQ1sOcqqaTaWSLUWL1p3ANilaohQCOxqCEkERghpfmhSX 0oET3RAn5RSlE63ThSkj8BZv6f5D0Uqj4gabOUBwNeWfIeXPTTT/NYqn4KhvBUZCgLkPPt uXpQPtsWF4L3WpQm3DCymTUyCP1OSER7kNMXqblAXYhf2o/8PbmYIrML2ZO8o8nmV+uK3l OcjlSC2Ilv+HNmluBadZ+NiWHLfQgcGcOMWxAm50/kH5/ly0aVwhcypTzXRLMFvN6y8Ult Onexoz/P2/rkKbx0WNWmCFIlpZmKIzarWVkeAoiGypHfFrRgv0hysJLi9XIZ+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1701222947; 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=BGSAK9hlVH+ssrRx0qRCvhDCwr46ZR0RQRkV/vbDcJc=; b=S9Wn6HoBEtehX17FOP4YRHQmqeYhGQaE5eX1Vd1bZsd0vScuwEdzUKILB1q4F8tt6VxpyB XjjqJpZ9mYuDlR7ju/r8eiV0iC1KZ55YuBJliD+97ynXwAP93OatSjcv2g7ttsenXjg+LP 544F8x4lzwr0LkTPKQX8aueIhTR8/XVnjEaRZfbkOjZlwIDWA8MOzKvE5RUrh92ZK5QQWn M5ycQx2iy+UYqOMOCOh5y4in3tPiAQwFYPPdrv8iuBhr2aUpgo5Off2Shsw+ZBvbfoKG6Z A2iSP8xOVaGBm/KS+SBCEva/ZP2WHVj4zr2XZl8VwjwkJf1PA3lzHzs7pVK0xA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1701222947; a=rsa-sha256; cv=none; b=bmI62wes/s0cHMsdyCpkQvie+OlLVULea4S3IoiBIShtUnzPGD8gMDo0rEh2IW0hSRCYEn qwPBQIKYUdOnP5u00+iVYBHstWPE/PVLH6wHf0D4oGehPYz0NhWXay8SWUMM1fPQajj2y+ gWd2ix5PI47rnVGpOClSvhP6n4A0lu8G8OyR/xBywnLVVyaHObmm914kZOgr+/ginxk9gL fWy0RxtqRjafkwuzn9Kt84CtPIbURR7HdB4yDMAp49WQLt6L+Ul6oFYGjl3cXzNwDtTcuL vRwwjkcpWtSgZse3sYzpaRdWYpB2j0SZZXvsgCTr9g9eFhF6zwmFIWryPYGNjw== 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 4Sg2Tv3GzgzmtD; Wed, 29 Nov 2023 01:55:47 +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 3AT1tle3064892; Wed, 29 Nov 2023 01:55:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3AT1tlv5064889; Wed, 29 Nov 2023 01:55:47 GMT (envelope-from git) Date: Wed, 29 Nov 2023 01:55:47 GMT Message-Id: <202311290155.3AT1tlv5064889@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: 272a40604260 - main - mpi3mr: Minor tweak to task queue pausing 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: 272a406042608da9bc3e67e41c6b7fc31d4166b8 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=272a406042608da9bc3e67e41c6b7fc31d4166b8 commit 272a406042608da9bc3e67e41c6b7fc31d4166b8 Author: Warner Losh AuthorDate: 2023-11-29 01:50:57 +0000 Commit: Warner Losh CommitDate: 2023-11-29 01:52:28 +0000 mpi3mr: Minor tweak to task queue pausing Use a while loop with cancel / drain to make sure that all tasks have completed before proceeding to reset. Suggested by: jhb Sponsored by: Netflix --- sys/dev/mpi3mr/mpi3mr.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sys/dev/mpi3mr/mpi3mr.c b/sys/dev/mpi3mr/mpi3mr.c index 39cefd15d476..932d174a6b50 100644 --- a/sys/dev/mpi3mr/mpi3mr.c +++ b/sys/dev/mpi3mr/mpi3mr.c @@ -5860,13 +5860,16 @@ static int mpi3mr_issue_reset(struct mpi3mr_softc *sc, U16 reset_type, inline void mpi3mr_cleanup_event_taskq(struct mpi3mr_softc *sc) { /* - * Block the taskqueue before draining. This means any new tasks won't - * be queued to a worker thread. But it doesn't stop the current workers - * that are running. taskqueue_drain waits for those correctly in the - * case of thread backed taskqueues. + * Block the taskqueue before draining. This means any new tasks won't + * be queued to the taskqueue worker thread. But it doesn't stop the + * current workers that are running. taskqueue_drain waits for those + * correctly in the case of thread backed taskqueues. The while loop + * ensures that all taskqueue threads have finished their current tasks. */ taskqueue_block(sc->cam_sc->ev_tq); - taskqueue_drain(sc->cam_sc->ev_tq, &sc->cam_sc->ev_task); + while (taskqueue_cancel(sc->cam_sc->ev_tq, &sc->cam_sc->ev_task, NULL) != 0) { + taskqueue_drain(sc->cam_sc->ev_tq, &sc->cam_sc->ev_task); + } } /**