From nobody Tue Oct 06 07:51:28 2026 X-Original-To: dev-commits-src-all@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 4hzT3Q1Fmkz6cWGX for ; Tue, 06 Oct 2026 07:51:30 +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 "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hzT3P12bHz4H3c for ; Tue, 06 Oct 2026 07:51:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1791273089; 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=LM5J9NAxK0viWrg7+pM3UG+F6FttroJ2db9itq0yGRQ=; b=yddRkLlVjihe3YHMZzSOoZFJReVh0h/SPfbUdCOFyWAN0J7KnJ9ANK2ObwENg69UBJ5a/h RMxbXIRTO/M2eqqqyoweHnVKMBbspgeCsB2vVjzZF+HbT4M/DnmSzHFSk//GQrcJuHUYBM HJ1ZvP1b5DC7HziYtPKpVEcSQjNUi0fGY1dCH3CJs6UQ9Frfy8t8NlQF9ml/bO/Yr6JGIq Md3gs3GVZnwqW8VZqThd5F6moCeiNG8MDWI8aEIVPyrX1ELa0T4mLGe4iv1aRGFnjPFvLA bzP/h068wmGdepDiW1uWYssr2Mtdd05OZNea0qdG2ZCB5ZV3WNfOoPiKckIRTg== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1791273089; b=lFk24OHdC7PjcH60NdcEDPoW7to/QjSk3vp2rNs+ISAb0lUUxTv1KtrBB4SIR+CKdF0rW8 58te4ox7bFo3hIWQJbGFwEUBGLH0hr3jCPfPkgXf/xmVq4ojOZSlssjOTpW7YdHBuv7lE2 iVCpBI3bAj2/VrE0iG4Lpmmp2F4Zm0GzEqhoBNcI4+7mKw0H5YznO1aguKUc9KxfziydPb YXjWjNT6QwgsjZZr6mwTKYNH19pGdqx5aI9qfR3mGuFbdurfF+Xf3brcZHCeu5rktCRbvL ITLi2i+Wg6Xcu1kADNe1Dbu7CVWQ+XbdT8Xde+BuAeSI4PC2uV6xsUxs8GlQDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1791273089; 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=LM5J9NAxK0viWrg7+pM3UG+F6FttroJ2db9itq0yGRQ=; b=YxajNJx7x8cY2oKFewsqeIEGRTJHicoTBjl8jrYmMucjcteWguODwn/Gj0dunDVA714DD5 uoInAQ7vNcwTOJdGNztkXiGN4nsglNhSiYmuS23TotQkKke75wjMSFCFPP2vYeMQLeA6jA QXyo5h/6E3Voaj2t82rOxcvRWeJNb6b8/ZnRoWldzzyk3SFsm0lHwXGkMmKJQF7a59HaS6 m3157UDeDdVKNj+M2qZBKH8oqNx76sr+dLtjzMYZmU525/I23SVulsPuVGZdG0UvSfyhGn W03Ew2emuquwbqXpOp3qRNQnVQuey/2f7COmsG9C0cnR7U8jpLKrPKFTegA+1A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hzT3P01rWzxcc for ; Tue, 06 Oct 2026 07:51:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 18f1b by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 06 Oct 2026 07:51:28 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jaeyoon Choi Subject: git: d4e7c457a762 - stable/15 - ufshci: claim trackers before failing them List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jaeyoon X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: d4e7c457a762403faab9bb1c71844353fda7b275 Auto-Submitted: auto-generated Date: Tue, 06 Oct 2026 07:51:28 +0000 Message-Id: <6ac4a880.18f1b.6d24723b@gitrepo.freebsd.org> The branch stable/15 has been updated by jaeyoon: URL: https://cgit.FreeBSD.org/src/commit/?id=d4e7c457a762403faab9bb1c71844353fda7b275 commit d4e7c457a762403faab9bb1c71844353fda7b275 Author: Jaeyoon Choi AuthorDate: 2026-08-27 05:00:41 +0000 Commit: Jaeyoon Choi CommitDate: 2026-10-06 06:28:05 +0000 ufshci: claim trackers before failing them ufshci_req_queue_fail() drops the queue lock to complete each tracker. In that window the completion path could complete the same tracker again. Claim the slot before dropping the lock, so the completion scan skips it. Reserved slots are left to their submit thread, which completes them itself. The manual request completion helper lost its only caller, so drop it. Reviewed by: imp (mentor) Sponsored by: Samsung Electronics Differential Revision: https://reviews.freebsd.org/D58945 (cherry picked from commit 7682b8f37669671844fedd94a382ec0c459b9b2c) --- sys/dev/ufshci/ufshci_req_queue.c | 60 +++++++++++++-------------------------- 1 file changed, 20 insertions(+), 40 deletions(-) diff --git a/sys/dev/ufshci/ufshci_req_queue.c b/sys/dev/ufshci/ufshci_req_queue.c index db96d13fad24..97eccd082176 100644 --- a/sys/dev/ufshci/ufshci_req_queue.c +++ b/sys/dev/ufshci/ufshci_req_queue.c @@ -182,29 +182,6 @@ ufshci_req_queue_manual_complete_tracker(struct ufshci_tracker *tr, uint8_t ocs, ufshci_req_queue_complete_tracker(tr); } -static void -ufshci_req_queue_manual_complete_request(struct ufshci_req_queue *req_queue, - struct ufshci_request *req, uint8_t ocs, uint8_t rc) -{ - struct ufshci_completion cpl; - bool error; - - memset(&cpl, 0, sizeof(cpl)); - cpl.response_upiu.header.response = rc; - error = ufshci_req_queue_response_is_error(req_queue, ocs, - &cpl.response_upiu); - - if (error) { - ufshci_printf(req_queue->ctrlr, - "Manual complete request error:0x%x", error); - } - - if (req->cb_fn) - req->cb_fn(req->cb_arg, &cpl, error); - - ufshci_free_request(req); -} - void ufshci_req_queue_fail(struct ufshci_controller *ctrlr, struct ufshci_req_queue *req_queue) @@ -221,23 +198,26 @@ ufshci_req_queue_fail(struct ufshci_controller *ctrlr, for (i = 0; i < req_queue->num_trackers; i++) { tr = hwq->act_tr[i]; - if (tr->slot_state == UFSHCI_SLOT_STATE_RESERVED) { - mtx_unlock(&hwq->qlock); - ufshci_req_queue_manual_complete_request(req_queue, - tr->req, UFSHCI_DESC_ABORTED, - UFSHCI_RESPONSE_CODE_GENERAL_FAILURE); - mtx_lock(&hwq->qlock); - } else if (tr->slot_state == UFSHCI_SLOT_STATE_SCHEDULED) { - /* - * Do not remove the tracker. The abort_tracker path - * will do that for us. - */ - mtx_unlock(&hwq->qlock); - ufshci_req_queue_manual_complete_tracker(tr, - UFSHCI_DESC_ABORTED, - UFSHCI_RESPONSE_CODE_GENERAL_FAILURE); - mtx_lock(&hwq->qlock); - } + /* + * A slot in UFSHCI_SLOT_STATE_RESERVED is visible here + * only while its submit thread is failing a PRDT setup. + * That thread completes the request, so leave the slot + * alone. + */ + if (tr->slot_state != UFSHCI_SLOT_STATE_SCHEDULED) + continue; + + /* + * Claim the tracker under the lock. The completion + * scan only completes SCHEDULED slots, so it will + * skip this one while the lock is dropped. + */ + tr->slot_state = UFSHCI_SLOT_STATE_NEED_ERROR_HANDLING; + mtx_unlock(&hwq->qlock); + ufshci_req_queue_manual_complete_tracker(tr, + UFSHCI_DESC_ABORTED, + UFSHCI_RESPONSE_CODE_GENERAL_FAILURE); + mtx_lock(&hwq->qlock); } mtx_unlock(&hwq->qlock);