From nobody Thu Apr 28 17:21:02 2022 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 19466199B8BC; Thu, 28 Apr 2022 17:21:03 +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 4Kq2TC0F08z4r3B; Thu, 28 Apr 2022 17:21:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651166463; 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=K5LXgrlZ217gsoo3eVRlgtcW938UeBFGzFW4LVIJIR0=; b=BioEgw7u8aXBWnG8NC+CgQXV6IOsthYRrUm5y+jMpUNZW7hm923k8wQy4yOC4vq0lrSdy0 5G/1S0pR1ErP7QsALZvj5RyA4Seq7fucXXAJ30EJNMhDXG3Erhmmujexyn3HnBE8RsKehF tNVxlTrdf/XS+yr2s78UPjVfRYYCmugfSFzCvLKeVEHzXXut6Vfmg2EIbFqiQwv5+3z9/0 gZvhXKjNQ7Ts5ZOdy9vwZEraET65aL7c/tu0RHiF6jtutmXrAVVgSWfu9XyGrNifvGk+lv zUwXMGtipwVq/n+TqG3Ge1/YN7w70F27YnkJtsMckSSq6Y0YSan5FV3MUaENHw== 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 DA0FB1C934; Thu, 28 Apr 2022 17:21:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 23SHL2JO024986; Thu, 28 Apr 2022 17:21:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 23SHL2v4024985; Thu, 28 Apr 2022 17:21:02 GMT (envelope-from git) Date: Thu, 28 Apr 2022 17:21:02 GMT Message-Id: <202204281721.23SHL2v4024985@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: c5041b4ee8c3 - main - mpr/mps: Add comment explaining state transition 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: c5041b4ee8c3385cec03e6ccf73af78cadfe8d90 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651166463; 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=K5LXgrlZ217gsoo3eVRlgtcW938UeBFGzFW4LVIJIR0=; b=wZmL8EZ2k1a0tMUvrxQKORKClm3D+CwhzB3D+1X+KpSgWrlH3HsGwfSq68C9oKvRmqCA6z thxuz7A85LnOCti4hOXPe2JBptbYH+ysTqw6qXzaW3QSq2XLJNpjQrTKSNTkdjrlsLHLDK 4tUhA1AvELCdi8OnES/d0mloEq+Fe+I95vUaMY4mFFlhjYwfGsWxdvvrnGsxdYB04P62sg tlltoYdERgQYjnfLprB/gc42rli5iX5oRfUVLNqJbEaSRAcnihG/LZRtAsoxrfWj1GCrSk htC3ZK6H+SHhnKa0WXwYC8SLyjCGJU5s4xtW+VhLLdrZN1yG3jZAJknBQe9SIQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1651166463; a=rsa-sha256; cv=none; b=JQ2OysCatC13zfn+Ve0JdbmU30tQRETyjMtzm6xzXXLijZ5cpaInIs1+AdgWvDKCC9ZaX3 8x4ASt31c1vmKpc6gayDJiI6ItIMAJXkXf7V7/v3mJHyX6aZKfTP/pVwmxJ/NZl0xK9IQ2 jvWo280VCBUN1bNyZ69M+stLk3KkMi9OjxZwvz9HOtDU9VIt99sdnNgehPmzOu+aOXZ+n5 03yTCkwSQor4GiCEZCLY/LtlKIoZZ57UlOzPtr/RTIlxofAaQFKh3aVNo5XMZJZIuqQjuU ckyN4/xvph92RGUp+oMuz1JcyL0L7Usvbn9aYclGcDDEj7CvVBV55+u+zh4NyQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=c5041b4ee8c3385cec03e6ccf73af78cadfe8d90 commit c5041b4ee8c3385cec03e6ccf73af78cadfe8d90 Author: Warner Losh AuthorDate: 2022-04-28 17:13:58 +0000 Commit: Warner Losh CommitDate: 2022-04-28 17:19:39 +0000 mpr/mps: Add comment explaining state transition When we can't load a request due to a shortage of chains, we complete the command's cm. However, to avoid an assert in mp?_complete_command, we transition its state to INQUEUE. This transition is legitimate because this is the only error path that terminates a cm before it's enqueued and the only other alternative would be an additional transient state that would add complexity w/o adding value. Add a comment explainging all this because otherwise the transition can look a bit weird. Sponsored by: Netflix --- sys/dev/mpr/mpr.c | 6 ++++++ sys/dev/mps/mps.c | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/sys/dev/mpr/mpr.c b/sys/dev/mpr/mpr.c index 0f4c5c906216..b4d3f3269dba 100644 --- a/sys/dev/mpr/mpr.c +++ b/sys/dev/mpr/mpr.c @@ -3704,6 +3704,12 @@ mpr_data_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error) mpr_dprint(sc, MPR_INFO, "Out of chain frames, " "consider increasing hw.mpr.max_chains.\n"); cm->cm_flags |= MPR_CM_FLAGS_CHAIN_FAILED; + /* + * mpr_complete_command can only be called on commands + * that are in the queue. Since this is an error path + * which gets called before we enqueue, update the state + * to meet this requirement before we complete it. + */ cm->cm_state = MPR_CM_STATE_INQUEUE; mpr_complete_command(sc, cm); return; diff --git a/sys/dev/mps/mps.c b/sys/dev/mps/mps.c index 5021acf930a3..b3f470bf5a39 100644 --- a/sys/dev/mps/mps.c +++ b/sys/dev/mps/mps.c @@ -2983,6 +2983,12 @@ mps_data_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error) mps_dprint(sc, MPS_INFO, "Out of chain frames, " "consider increasing hw.mps.max_chains.\n"); cm->cm_flags |= MPS_CM_FLAGS_CHAIN_FAILED; + /* + * mpr_complete_command can only be called on commands + * that are in the queue. Since this is an error path + * which gets called before we enqueue, update the state + * to meet this requirement before we complete it. + */ cm->cm_state = MPS_CM_STATE_INQUEUE; mps_complete_command(sc, cm); return;