Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp487752lql; Mon, 11 Mar 2024 08:27:32 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUNHaNrbrrTEeLdg/Trfqtpp3Q8gUCfl06LnvZCK6bUOzzs/nb3WH3GN9E4VB41SwJYZXxrFG6lWG9dPsWum4diNmFEmjE3xYhVdSrz9Q== X-Google-Smtp-Source: AGHT+IFp+Mi/0rTAmfbj0+z12gqV/7ipd0MqVHW9TLQjXCrX1UlR3ltWw1I8NgOfjyCbB+mN4HeE X-Received: by 2002:a05:6214:1887:b0:690:bdd1:455d with SMTP id cx7-20020a056214188700b00690bdd1455dmr6677355qvb.48.1710170852125; Mon, 11 Mar 2024 08:27:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710170852; cv=pass; d=google.com; s=arc-20160816; b=Kv++OYUrGnbmYP4ZTdpiLQrh+99ja4AkydNHDAQ6uMq/+b0KnrsqvFCWyUV+KWR0GZ BAP2BOLe282jcD9OWu5sQpfb2gZ7moEuiwHRsx5gBpRGMMnWWQ9nwppJaU01wwTgyTpq LE8/1bgMjLygyCnnnXupzCzGQ+Q4THSQSCrlSawLFclxPEhu06jq54Up9GfNiAvLOyCt 0IQe+7i42bHa7buV2z8NNwrT0lpn6aww0aoB3NikjA4d9umokvOl9/D4+LhcFeIwva68 vZEqUKmBlbtBiIJYJZu4hht8JNijENlYNCfW3X4i1SkbpmfuZRNGo+g4EtKlCE/UcdmW DZiQ== 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=JU/1P+EoxxjIUyfv9j6n1m2E6K7pqghE/Ceu6505cd42FgFQ3X2nkeeE67DaZVYnzG 6dP47aRA7sj99OiXdV9y81nR63j6j/8waFu8SvrT85LKEV5EXoVPtUJuWWE56YXbcEvG HPAwDJMgHnRXfJp0fT7R1FE3BTRaprYe9W5OhyZgYWyb9jmDMaZr5yxWC2GCOnirvdHN geWmlleWk5D5MnGtcHYppU/8/7rxIn1Kk2ZmZZS/KbYQN4jNxb/3gOqsCf6CYnlmXEXP 84wTu7cNzbCA7sNJ3gbyHxtTefULZKxHURmh0+/vxrCrFy3JKIqQfIijskq66x5qT7Ok XsbA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="GXdahz/3"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-99104-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-99104-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id kd28-20020a056214401c00b00690b67ee92asi5383937qvb.460.2024.03.11.08.27.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 08:27:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-99104-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="GXdahz/3"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-99104-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-99104-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 92E301C21AB9 for ; Mon, 11 Mar 2024 15:27:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 37BE248787; Mon, 11 Mar 2024 15:14:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GXdahz/3" 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 52288657A8; Mon, 11 Mar 2024 15:14:21 +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=1710170061; cv=none; b=a8taDuelEB+LA9WBc+g+aI6LNq150t2CBhQgc2PGQ1BGPJzoHn1fegFENc5nOfOnNR+4ZXr9ahcEtTeAXz5KOKweFCxUI6qebyZfdKfrY/Z7MmCbB+BIS3X7N3C+EpS1DnvP8a0ioleA8c8M8G30TFKkIzxqdBEO5ykheB9Tr+o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710170061; c=relaxed/simple; bh=CIckCfCvElbP7qNZyEFS868bjqgWhDCd+IzI7ldl7Hg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tkELtfXPHdWg16TcS45mvrwtBq94afGSgasdVebNXZ7gKeADJHrCqGgQ1jAxVBaaCrrx7Vsgfg3RdyfQ2jQCdXEM8g3dUmCBCydlVoHisI35lvyZ6Q7HvU1KaW6/3ugS4ZPswwsGHw+SQPr9rH/Mt2o3zVqyos75hDzvF3B0X+A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GXdahz/3; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78342C43394; Mon, 11 Mar 2024 15:14:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710170061; bh=CIckCfCvElbP7qNZyEFS868bjqgWhDCd+IzI7ldl7Hg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GXdahz/35VWEIMAPrTAprS3MVHK5R13ChjoZg80H9SQF9N6HX3SI4i+aNGWeRKNLX a+ZTP2nUxWv3xiFVZIDQNNT8hUDsuX3cnkpj1x3Qu7QBMf7idLd1VAIIlm0/DtDkLl 3Be4T5fWQIcHAyAhQajBE07E+VTQOB6iWETOjHbXPLWbALYFHWmvvvxVcMYvmV2xUF 2HIqMVQQ59dgjtK85JFBoVn+W2LkxEjXdWFSrpAYVrjSsBzZ33d5ManC2srRf8IV+h mPUnd+crB2pTHqw6xJhZtsL37PRTGUfbBSsErhoe2zj6mvU9yQ8+X3FlVOWdcP777Z kdAnj4ECwgXZw== 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.1 13/13] firewire: core: use long bus reset on gap count error Date: Mon, 11 Mar 2024 11:13:48 -0400 Message-ID: <20240311151354.318293-13-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240311151354.318293-1-sashal@kernel.org> References: <20240311151354.318293-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.1.81 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