From nobody Wed Jan 15 02:49:40 2025 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 4YXr7S6yftz5knLp; Wed, 15 Jan 2025 02:49:40 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXr7S4d8Sz3j3G; Wed, 15 Jan 2025 02:49:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736909380; 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=JzA9U/RmKa//XSQfGU89PAbfX+ocD7zctnK1IxAEuTY=; b=lhOnIDFu4k3Md5evXe02wwzCZ/KTvacBfvSqgWcMOowBrOvDdbWIgoxtQ9oLxEpeHBb8Ib +NhhYO5H4AykiqoLYIyud3t6LPLxe682QleixXcIECw8tOc3CUwyT2Jj3+O03zIpBLKknv w1RGozFaqhWHEkd+VAAFp/HKzBHhEf3ePvzB3uAFZaMDw+4c5c/tjsCwX7qxovQFodJ800 krQqtLQRb6DcbUbU6/MLpIdh0k+MGDXGyp8Wlb5MfWEOdEFu04n6aF1wzE1tYNvQ3wyxzR kIOciScv9ybwIo3WUCR4JR+L0goqmpxLHc8SiR6QCnGKUuT93H9FfcMfxRjMGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736909380; 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=JzA9U/RmKa//XSQfGU89PAbfX+ocD7zctnK1IxAEuTY=; b=OEy3BiMXsZ03//6t3lJgpxySE6UWMZMc63P66baCf6w8CT7qOo4HR7p1j4d4qQtMzDzXnC 8UFhOdnVE7jUiJ0RJu1SrpCQKtaPpIyE3fsmB2gEPnZfMS9OsmPA4+gZjeh6glTGdhSJ4G jpEU+i4/uXgL/XfHrkcexlCFvlfGhrlWbQFrPXNpyzD3Vp3JPCifRRSxaY/uarQxVK+F5p 1gTE6miCcTQRU1P9mpp/qPgJZ4uznxh6dLBtQhua1p13IThi5qxLqqitKqEEWQokfeHffN J3m1oTnIydBef4JS7JQi0NX7eylJiQSayxv0MtXa2N841aDJuz7T9NwvYHIGMQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736909380; a=rsa-sha256; cv=none; b=HNoQciSAZHmfaKb9UfZu+gjjs2yZgk7JcMEQ2jb6fCMts17uWgIa6GFVDawJ43Nc63cscE RHSaSK1PK++JaOUCYZjrlzGX2iXjJn29KObUEwlIBOqdMx7SCdD/ELY6Gdt53v21qZhBiY sLyOAMAtcRSVziWr8jMPsJKXFmAFj3fNNR+FN4AfgmUWCoyfUG59MJ2j6TcG4U8uVSVZcA te1KLMmvXBwIi7iJVDYt+/jRdPbZe+y3eOi64KvVDLZfy2XekE3ZYaXiaVjYgiif8IEprQ MhwrZy/+cc/xoW1ChA76Hlcxe6q+QTdwcSmdXRYszpYIm6U+EKnXPrpFhSlMbQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YXr7S3tqRzBS8; Wed, 15 Jan 2025 02:49:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50F2neOi067581; Wed, 15 Jan 2025 02:49:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50F2ne0v067578; Wed, 15 Jan 2025 02:49:40 GMT (envelope-from git) Date: Wed, 15 Jan 2025 02:49:40 GMT Message-Id: <202501150249.50F2ne0v067578@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 519121f5ea03 - stable/13 - isp: Fix abort issue introduced by previous commit 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 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 519121f5ea03c93da8f0600555c138df4a1c5e0a Auto-Submitted: auto-generated The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=519121f5ea03c93da8f0600555c138df4a1c5e0a commit 519121f5ea03c93da8f0600555c138df4a1c5e0a Author: Alexander Motin AuthorDate: 2025-01-08 18:23:26 +0000 Commit: Alexander Motin CommitDate: 2025-01-15 02:49:23 +0000 isp: Fix abort issue introduced by previous commit Aborting ATIO while its CTIOs are in progress makes impossible to handle their completions, making them stuck forever. Detect this case by checking ctcnt counter and if so instead of aborting just mark the ATIO as dead to block any new CTIOs. It is not perfect since the task id can not be reused for some more time, but not as bad as the task stuck forever. MFC after: 1 week (cherry picked from commit 2c48a8f161c91bf7020122697d064a25287097a3) --- sys/dev/isp/isp_freebsd.c | 19 +++++++++++++++++-- sys/dev/isp/isp_freebsd.h | 3 ++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/sys/dev/isp/isp_freebsd.c b/sys/dev/isp/isp_freebsd.c index d5aa7a54142e..b496eae1b466 100644 --- a/sys/dev/isp/isp_freebsd.c +++ b/sys/dev/isp/isp_freebsd.c @@ -986,6 +986,16 @@ isp_target_start_ctio(ispsoftc_t *isp, union ccb *ccb, enum Start_Ctio_How how) continue; } + /* + * Is this command a dead duck? + */ + if (atp->dead) { + isp_prt(isp, ISP_LOGERR, "%s: [0x%x] not sending a CTIO for a dead command", __func__, cso->tag_id); + ccb->ccb_h.status = CAM_REQ_ABORTED; + xpt_done(ccb); + continue; + } + /* * Check to make sure we're still in target mode. */ @@ -2503,14 +2513,19 @@ isp_action(struct cam_sim *sim, union ccb *ccb) } /* - * Target should abort all affected CCBs before ACK-ing INOT, + * Target should abort all affected tasks before ACK-ing INOT, * but if/since it doesn't, add this hack to allow tag reuse. + * We can not do it if some CTIOs are in progress, or we won't + * handle the completions. In such case just block new ones. */ uint32_t rsp = (ccb->ccb_h.flags & CAM_SEND_STATUS) ? ccb->cna2.arg : 0; if (ntp->nt.nt_ncode == NT_ABORT_TASK && (rsp & 0xff) == 0 && (atp = isp_find_atpd(isp, XS_CHANNEL(ccb), ccb->cna2.seq_id)) != NULL) { - if (isp_abort_atpd(isp, XS_CHANNEL(ccb), atp) == 0) + if (atp->ctcnt == 0 && + isp_abort_atpd(isp, XS_CHANNEL(ccb), atp) == 0) isp_put_atpd(isp, XS_CHANNEL(ccb), atp); + else + atp->dead = 1; } if (isp_handle_platform_target_notify_ack(isp, &ntp->nt, rsp)) { diff --git a/sys/dev/isp/isp_freebsd.h b/sys/dev/isp/isp_freebsd.h index 5bb3dd43b6de..73390fa14769 100644 --- a/sys/dev/isp/isp_freebsd.h +++ b/sys/dev/isp/isp_freebsd.h @@ -104,8 +104,9 @@ typedef struct atio_private_data { uint16_t ctcnt; /* number of CTIOs currently active */ uint8_t seqno; /* CTIO sequence number */ uint8_t cdb0; - uint8_t srr_notify_rcvd : 1, + uint16_t srr_notify_rcvd : 1, sendst : 1, + dead : 1, tattr : 3, state : 3; void * ests;