From nobody Mon May 13 22:38:28 2024 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 4VdZC83yxJz5L57D; Mon, 13 May 2024 22:38:28 +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 4VdZC83SZWz41Wn; Mon, 13 May 2024 22:38:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715639908; 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=LTqKrajkm2ZSe1SIJUAjmfjKHx9XoKEuA7P0t9AYji4=; b=OvE1Hi1XwGsCbJB2XleuAUV84AT7mFXVIBOUBy3hgSVy9jtpsAwwW85EPaDhkXmB37UrkI rRPEMuYlQWVpI3KgGbpTn5JAkwB8l1oir4O585lw0klr866CNC18r2GGsUzESvnckAR9EO Cpw05GmGEft2GwKEV60fmItdR+xxqCCJ0zLDjQWqGYRIv4eXgrJDmDSH/2RCvJDn3vuZbZ ce36X5gGFNMnpnEhKcHAgQFHe4DG1grjTpi4/3hXFmjQyxlwNgbev/weYGNEyR/E0I0QIV wZnFZQowJoKkug+0iBoYcKJSm1fcV3ELaquzcqoTlwTSbUei6qa+qNu368Xh+g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715639908; a=rsa-sha256; cv=none; b=ykUX2rV8yJh9nHmkcbHkPEhDI5UrlL4MlzLxsYx0Ent3noj9Vthh2kpGWNbSez+nILydf6 pPTLdk8h00RwKbz2s/9IsxkfgeqZTxXI2I7ag5ZeeQS9AjyWosgIHMPaHaZF/pfnZw7gfZ mx9kPavuI+o3boDoGrZ/NYCOASdvh8BDBMKJUhbzk0x2IrmIm50jfIFA7D8mst7Ags0zsP z2KetgwmWyN3DWNJfZxrjc4KuM3KOll8h3oZXudkBDcytX1gZm3lxX488HmR/w/SsVOd6f eZkNz5UMNO3j9gn72exNx1NWJ365LnpOIFnUgrIMSh2ylNwR3In95cuge6WTVQ== 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=1715639908; 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=LTqKrajkm2ZSe1SIJUAjmfjKHx9XoKEuA7P0t9AYji4=; b=U5Bm3ozH9ktrPfStOCYiXItNy9Pn1k/7J4Gp5y/VAUFjwcDFa7ynWYgScdqiin0/CKuu2N zOgC4/YHibdwcocwJMfqJA4sJAw5XB0SzgizCX6d/LwciczL3HqfnYZp9Y7Fp072XIEeAq sdhmtfHTJmcTLkVdhxd4jUJ9p3eXT69YQhJX9dBCt9gAp/sGtbDoBNggGvq+zaRUMbJVGt vMqsa3zVV+TsLVwMiyaKerQ/rvwmszC6R31abb/S+U2x/YLg1ZvgxXojCKxqV9QChhASVd /OO2/eX2SlqNg8Z6HL85X2PPvG54O3d2ykuLxYpwB+LPvr6rhaWvqavaW2BetA== 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 4VdZC833z0z160V; Mon, 13 May 2024 22:38:28 +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 44DMcSk2058185; Mon, 13 May 2024 22:38:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44DMcS5X058182; Mon, 13 May 2024 22:38:28 GMT (envelope-from git) Date: Mon, 13 May 2024 22:38:28 GMT Message-Id: <202405132238.44DMcS5X058182@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: 5a178b831a9f - main - nvme: Add locking asserts 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: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-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: 5a178b831a9fe8c51e406355f0164d01627cf1f4 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=5a178b831a9fe8c51e406355f0164d01627cf1f4 commit 5a178b831a9fe8c51e406355f0164d01627cf1f4 Author: Warner Losh AuthorDate: 2024-05-13 20:53:48 +0000 Commit: Warner Losh CommitDate: 2024-05-13 22:14:03 +0000 nvme: Add locking asserts nvme_qpair_complete_tracker and nvme_qpair_manual_complete_tracker have to be called without the qpair lock, so assert its unowned. Sponsored by: Netflix --- sys/dev/nvme/nvme_qpair.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/dev/nvme/nvme_qpair.c b/sys/dev/nvme/nvme_qpair.c index 62d27e439180..b11bdc44dc40 100644 --- a/sys/dev/nvme/nvme_qpair.c +++ b/sys/dev/nvme/nvme_qpair.c @@ -414,10 +414,12 @@ static void nvme_qpair_complete_tracker(struct nvme_tracker *tr, struct nvme_completion *cpl, error_print_t print_on_error) { - struct nvme_qpair * qpair = tr->qpair; + struct nvme_qpair *qpair = tr->qpair; struct nvme_request *req; bool retry, error, retriable; + mtx_assert(&qpair->lock, MA_NOTOWNED); + req = tr->req; error = nvme_completion_is_error(cpl); retriable = nvme_completion_is_retry(cpl); @@ -486,10 +488,11 @@ nvme_qpair_manual_complete_tracker( error_print_t print_on_error) { struct nvme_completion cpl; + struct nvme_qpair * qpair = tr->qpair; - memset(&cpl, 0, sizeof(cpl)); + mtx_assert(&qpair->lock, MA_NOTOWNED); - struct nvme_qpair * qpair = tr->qpair; + memset(&cpl, 0, sizeof(cpl)); cpl.sqid = qpair->id; cpl.cid = tr->cid;