Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp485130lql; Mon, 11 Mar 2024 08:23:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV9XgHFOsWBte8yk78BjMPJMg1et35QV7+nW5oES4BbfQLyDoQtV9yI9nfp3fGV1iMimYUP1AR3SUszrn3mXvwII7xpEMghUIK0vfRO1w== X-Google-Smtp-Source: AGHT+IF1ZT2g2YuSNs0+CbuiiXEuBML9KJvobRx1U6oNKQl53CGUlc2TumNLnI3vl/zuRY6HUbl6 X-Received: by 2002:a17:902:cece:b0:1dd:a12e:15c8 with SMTP id d14-20020a170902cece00b001dda12e15c8mr3523879plg.33.1710170598757; Mon, 11 Mar 2024 08:23:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710170598; cv=pass; d=google.com; s=arc-20160816; b=XAwUoiMM2hU9Up7A9T7aErBn/JRUex/HBhKFgJT/Sv6aRMTp43/4LZ3aqz0PVs1z+b fO5qmRFikP5FuvKUU7mxKhafHHodRn+zy0+uEiDs7nzJ+1AQOFZq4firRmwR6aDk3P6B Hig0kjQ+U91WdhWZGnASZrxAZc7sp/I9U8YZZ97+U78+Ptes9HCduWHZr9yQjdq/cPd2 Je8XuZOYt6mvu0XX1Tg6Uc1saADpJU6EdRw9l/1NcdK+MnqJukqB8H4zoYm0y/4Zn93F EJuXSct5swR2nymLwDNDSea+/EfTjV6wxrwz5D2fMB3PZtBQZzKqRu+cN7wc7cwSIkQv Ofpg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Xz9DJVYrSx6uF1m+X2tG7e+x40zKckI7V95wDN569/I=; fh=80ae2A0BYBdM8k0U17td2TZqMk8I5zWshWfYHHtnKZc=; b=yCYzpPmISjtGkfVAoxWRDhDMIRWUagnV6I8ruY6LLayZ7RDyhb6AddLHD3jyhN/ZbZ hPoFzCc6gntblljKS9W0+hVujz/BtbFxQM8Ygx18qeo2wMR+fBbEoEZU6ZDcEfnKOz7t DJpHHV7U8FxytU4QSQ51AP/Df5hv8nC2aCBucnQX5fOoBeTnGddoeX4AyP33pAk2DJeR FcQLSgOvItJ6g4AyF80qEqvF/1QkzjlKO3HfWc4CLfi3It74tHkOKsyhxlCnPk4V4DTM kHbemXUOiozrCgy7HzDDcouqnS+8IWRPJrFleMfBMRtrPD3dRW3q4vFzAwi7RRl9WddV QQQA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=R7xUMlv9; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-99071-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-99071-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id y2-20020a17090264c200b001dda3363e0esi1422525pli.223.2024.03.11.08.23.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 08:23:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-99071-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=R7xUMlv9; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-99071-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-99071-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 8E6A8B210D3 for ; Mon, 11 Mar 2024 15:18:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C97045821C; Mon, 11 Mar 2024 15:13:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="R7xUMlv9" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DFB4B58129; Mon, 11 Mar 2024 15:13:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710169986; cv=none; b=OW3yH1UosdBwsUjAOIY4Tgu3dLrhCJ3wg0MF00Wv3Rwo17I9zf7yDjsfux72XYSM12PFvupLnXkH/Q/E5SOJrUjlXx5kN0ihXXRZklNkF605QSUWJjRuYMlKBGgvMxferRLxEWgfOJJDRayRXk2HT8Yp9j+IuxwNifVB0whgHi0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710169986; c=relaxed/simple; bh=CIckCfCvElbP7qNZyEFS868bjqgWhDCd+IzI7ldl7Hg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nBUZI5JNSnd+1KCsJCwGLDylH2p+QN6wFLzyEIyg4ifG5wWQRYA1A4jqsAxReeoXYV7/QdEFOFhESMvZeyd+pcEk75eCLzWg6q/pOfX7CFV/bs8+HAO/Ee4yhH+oATdGm2uagihmLzQPP15X7PuFRlFV5tKerXDvYf8aYCjVmUc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=R7xUMlv9; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD918C43399; Mon, 11 Mar 2024 15:13:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710169985; bh=CIckCfCvElbP7qNZyEFS868bjqgWhDCd+IzI7ldl7Hg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R7xUMlv9GPFNPKD3VXqvm5eEiJW1YuQaCR3R9SNvB3rZzdOXSk50AEdhG8bLG4FZ0 +RD8RCRBuqmIB/k7tlMmaFfmX4RD8v4UFW4B7PbUfxnCLNFEyZ3m2zcG6kji8/JN33 odgvvaiS+g/9Dj7EUOB4OASNvIElrIVVmrOd+aB6zJ/SF4qtPGrfFiYU/3XLKY7VYX AV0qGVyW/gBUafvDTnNE093BWn4DDn0x0rFaNCjcT2R5Sz7OANv3mgpckFRSWunDHY 1VWsHl7FyOchPt+z5h612IIH+W3SHFuXhHLEWwfdZVnpXS8v94WMCRUwuT3L4VtElt b7/FzE5zon8fQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Takashi Sakamoto , Adam Goldman , Sasha Levin , linux1394-devel@lists.sourceforge.net Subject: [PATCH AUTOSEL 6.7 22/23] firewire: core: use long bus reset on gap count error Date: Mon, 11 Mar 2024 11:12:02 -0400 Message-ID: <20240311151217.317068-22-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240311151217.317068-1-sashal@kernel.org> References: <20240311151217.317068-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.7.9 Content-Transfer-Encoding: 8bit From: Takashi Sakamoto [ Upstream commit d0b06dc48fb15902d7da09c5c0861e7f042a9381 ] When resetting the bus after a gap count error, use a long rather than short bus reset. IEEE 1394-1995 uses only long bus resets. IEEE 1394a adds the option of short bus resets. When video or audio transmission is in progress and a device is hot-plugged elsewhere on the bus, the resulting bus reset can cause video frame drops or audio dropouts. Short bus resets reduce or eliminate this problem. Accordingly, short bus resets are almost always preferred. However, on a mixed 1394/1394a bus, a short bus reset can trigger an immediate additional bus reset. This double bus reset can be interpreted differently by different nodes on the bus, resulting in an inconsistent gap count after the bus reset. An inconsistent gap count will cause another bus reset, leading to a neverending bus reset loop. This only happens for some bus topologies, not for all mixed 1394/1394a buses. By instead sending a long bus reset after a gap count inconsistency, we avoid the doubled bus reset, restoring the bus to normal operation. Signed-off-by: Adam Goldman Link: https://sourceforge.net/p/linux1394/mailman/message/58741624/ Signed-off-by: Takashi Sakamoto Signed-off-by: Sasha Levin --- drivers/firewire/core-card.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/firewire/core-card.c b/drivers/firewire/core-card.c index 8aaa7fcb2630d..401a77e3b5fa8 100644 --- a/drivers/firewire/core-card.c +++ b/drivers/firewire/core-card.c @@ -500,7 +500,19 @@ static void bm_work(struct work_struct *work) fw_notice(card, "phy config: new root=%x, gap_count=%d\n", new_root_id, gap_count); fw_send_phy_config(card, new_root_id, generation, gap_count); - reset_bus(card, true); + /* + * Where possible, use a short bus reset to minimize + * disruption to isochronous transfers. But in the event + * of a gap count inconsistency, use a long bus reset. + * + * As noted in 1394a 8.4.6.2, nodes on a mixed 1394/1394a bus + * may set different gap counts after a bus reset. On a mixed + * 1394/1394a bus, a short bus reset can get doubled. Some + * nodes may treat the double reset as one bus reset and others + * may treat it as two, causing a gap count inconsistency + * again. Using a long bus reset prevents this. + */ + reset_bus(card, card->gap_count != 0); /* Will allocate broadcast channel after the reset. */ goto out; } -- 2.43.0