Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp488797lql; Mon, 11 Mar 2024 08:29:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVb4OZhl9ZqYXYZWfdKSQGmThhBtVjktjEvv/Hs0kxK1VuB1HhRmGClJ2wxvq7QQoQYJVQVq8NgLoZR++VrsfnZAUNln1T3JOOr/58iqw== X-Google-Smtp-Source: AGHT+IG3sVC85THYN7LqDqCZeVjun3DGU+pSBicKq66Icjr209V3EytMUNQX5K3uqkWvZ4JxGyQE X-Received: by 2002:a17:902:d2c8:b0:1dd:66d1:a62b with SMTP id n8-20020a170902d2c800b001dd66d1a62bmr7315060plc.5.1710170963298; Mon, 11 Mar 2024 08:29:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710170963; cv=pass; d=google.com; s=arc-20160816; b=AfxWKqeB+ivBcZh6NXk71EVva/PSetdhQx0DHeOsTOy/BrglPQfbWRMi7tDPZuYlw6 wXPS8FFBov/i6BrwvK6sKIEEOMyYb+OkMhGnhT9D7hSj0MnC3CRkG2Q4ISQCB7gNAeq4 GnZORwzfJzZYNsHlIhhnrkKIindit0e1w/JyIBMUa4Xd8u7IgiMj2oaX7Xv+iA8nEprc dWBcytnQpUZkL55r6Zye80pe2UllatUAfP/jCec87iy3t/k8/n6+P4ZhSAzMvLBcsUQW swI0j6fH/nLeEohOhvjwKbTekfjJ1tVddYasNs8qMvo3FuWMMZjraqZaN7BGGJ3dXlFw Crmg== 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=gifbMiGwBgZWIzXSatYwmKvz0bpUn77vJWnEaba2+pY=; fh=80ae2A0BYBdM8k0U17td2TZqMk8I5zWshWfYHHtnKZc=; b=YjTIOggubgYHvx6E+3J/+Yg8uB0KROEA7l2d6viqlBLX+7KlBClT0hiLjcOI66HIL5 oM4dWrBdVdnhgbEgSf4TJd81vWp+ddY4MI2qCO/0hB+RyrjPbkSjvjm7PdGOyJybl7du SHkoDZimlZ7lh7KrahgY0c09I9uO04Scw6ucA5QdAd/yEPDCD0fJWazQAIP0diE11YJb 25TtJ6yNd6Ob2QMw/9j9uJznMCp1hc0jpusjZ07luPyohbZd1RWPUQ7fdBuM5xK1OLJr lh0Q39W4KyWF4Pl7rVtMlWjccn+AX2jGcfzaF9JDOfTkdk4ibY/ufKKFsX/jREB7JYHl 4bew==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RfCyfkJI; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-99109-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-99109-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id b16-20020a170902d51000b001dd63fe7f59si5171613plg.35.2024.03.11.08.29.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 08:29:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-99109-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RfCyfkJI; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-99109-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-99109-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 2F8E0281DAE for ; Mon, 11 Mar 2024 15:28:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E615F664CA; Mon, 11 Mar 2024 15:14:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="RfCyfkJI" 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 03949664BB; Mon, 11 Mar 2024 15:14:37 +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=1710170077; cv=none; b=TU86fTLZSuoXV5hvyKePRdCXj9RgjIDEZjh2GT8yYe4TX3vNabM05RhLsJ4+qoSAnV32QFnvZu2oi/GSw3CY3VjUrtZxzGPsCitKl2g2AZl53s2YPJeLNTS0TkB0rdoPjYITi4Ls1Af0HlRxATNFAyMjPk4/c36X+naV3oqtpVM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710170077; c=relaxed/simple; bh=gAqdm49DZG7gHX8FLf99AYsnKM/Po+UYbJY+eyoQle0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=W9jog0DbwGMkeWik50QiwmBkv32gTBEzQ1VRcSJMTI2Z5ld90WaDNJjtM1NbsfaPYsiJurZ6y6M6nEEu/+qo95biUN7jB654+lRLemsfB+foMAm7V1C7ao3tBeAnZYPJI+s13SUuWzdC+rK17YLQxibEe8dnJUYSMhQ5Q+8eZSQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=RfCyfkJI; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2DF62C433C7; Mon, 11 Mar 2024 15:14:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710170076; bh=gAqdm49DZG7gHX8FLf99AYsnKM/Po+UYbJY+eyoQle0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RfCyfkJIAZZqCnWnNZzHlCob8f9h2XP7m6IygER0seqwCciw4Q4+/vndeIWknkK47 BbjN/kcuwQyG70I58SDNS3dCPerlIqEMQ2HZ5EzYDpALLUl+NuHu53RkCxoMWW2lI7 2Wd2Ry9YnGiNnka+bMUK4qwbHUH9KEPp7d8yprpsc+AljpkO90pjIuhM0PawbxnKMP SJdb34ewn6j/rhRn1OHSCsKqbOQoqGchxSXDsdshds+dYXCSjP8ujjEPc6jPzrPZYx nPE/GQnWXDQ37QmcKx4gnN1ZIVBT9AFhwL8JacIoNChT+PwLxh0WKzs1oTxSkYMDS+ 9FZ63Mg3jOV7g== 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 5.15 5/5] firewire: core: use long bus reset on gap count error Date: Mon, 11 Mar 2024 11:14:21 -0400 Message-ID: <20240311151424.318621-5-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240311151424.318621-1-sashal@kernel.org> References: <20240311151424.318621-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 5.15.151 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 be195ba834632..d446a72629414 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