From nobody Wed Jan 08 18:24:41 2025 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 4YSxCY3wRwz5kvQd; Wed, 08 Jan 2025 18:24:41 +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 4YSxCY2vpkz4Fkf; Wed, 8 Jan 2025 18:24:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736360681; 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=laiBCGcapaJ8z3CUYaSa7qFAZqA6P93wRA2+ZVNNzUs=; b=h6Su7JutqX4Q4QQVphdxz8tb3UvipZt1tvA3kXEYHAryimcNPUmPIo1RdutUmb6kHHCG4h 7Wfvs90W3RKmxMM6H/jkBS5cv478kepGIrG5slHSOLQCiFVUbvpaAlq1aPtStThtiGQuaj IZ09+m5evElK6W2rRt6CJYlaE+4yIZIRtfuXBKjzidHS7xFKJlVwWbx0N2jURfTIel98NA /NtaSzyIw8pExC5+xngfAFrP+9JqbgpRB4D5f2+4b1n9Ti2W/3c6Pv+AeMBnVesvtzFM3/ jk3Apf5kKGbfolAQ1/dcYCC+MXK8qUGTK0frpK3Y8CRzPJxS+aNZqetvGihVkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736360681; 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=laiBCGcapaJ8z3CUYaSa7qFAZqA6P93wRA2+ZVNNzUs=; b=pC7EVuvJdPA3ut6+Tj+4GC7ZduWjbvTKVMVMzt/pdGJB3LBHZCHhUHrIDwjQY3BlI0k3V4 KFar6H/3ukGIbdLcdMaiVMa2Gohr+Y0sQdTq5xYq0WBrhiPaPB5V/40r5SBBc/1S/HLVD6 qjKy3xx9Ka2vQ+a1F81CoSbi/Grhsr4TY6CdVPLPx83qnmKEVbP0DQNCVlXH+S1CeteNdy 5PXzxRLGIJrSmnS2HniPto99cwtYHN/od1JSN/g/71Wg8u43ZUb2YDfJ4PzjMmIgzDjkXs kAbChIkU/OYGas5Uafs06F0xXbwglsA1wrLaJzaiGCT88qWtqTIwF3S1CV8teQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736360681; a=rsa-sha256; cv=none; b=uyADxcbTfgPcZPJeYxwxQisbKJUno0GtAKVUQxZC9cbzEoMlhsGmTnqKU7pYgzRL1QfSDm EaDRJf2OlzmGl7cinNEoagDzBV0VBByUb/+jE5ySWjM0oTKnBZvqWKvDpWS1lzPgDVLjyt B4ymYP0bdw5+IOpiTH0jJzBpkhjh7wxfVJdHnW3sueWlkhsPLglJ5nJh6Y/KtSVHtY8yGO cotTBAJTBI7WrhxeWRxqciiNoVmEzOHNcwO/1s85p8G9pJ4hPp0DfrFoi8VDwKuQPHX+E5 NYlk/umVOagdvmrXUbi2jv7bfboTiCbM8SSBg7d32jdMg6ZFBAUk9JhIRe+9KQ== 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 4YSxCY2T17z16pg; Wed, 08 Jan 2025 18:24:41 +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 508IOfGt042936; Wed, 8 Jan 2025 18:24:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 508IOfns042933; Wed, 8 Jan 2025 18:24:41 GMT (envelope-from git) Date: Wed, 8 Jan 2025 18:24:41 GMT Message-Id: <202501081824.508IOfns042933@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: 2c48a8f161c9 - main - isp: Fix abort issue introduced by previous commit 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: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2c48a8f161c91bf7020122697d064a25287097a3 Auto-Submitted: auto-generated The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=2c48a8f161c91bf7020122697d064a25287097a3 commit 2c48a8f161c91bf7020122697d064a25287097a3 Author: Alexander Motin AuthorDate: 2025-01-08 18:23:26 +0000 Commit: Alexander Motin CommitDate: 2025-01-08 18:23:26 +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 --- 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;