From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796460971; b=igUYCrWFrXF7msW46ucnyj28rG8axtkT8ATyJwZ93sF1o7xXMmJU9TMtlTfPxGV61LNs lTVvxhW5cIKoErnX9Jg/2kzUdtY6+yRbk/PzWCRWWao8aw6oVS/x0c5Yi64Z8CDJqlOk2 GdHMr70LU2iAvzP6mIbEZ9fKDZA/yd9s5F4c0nPdmWhbIcIlKk2iWOmpnIS2DVqO6/rJ0 jeFyhYVcUDocmaeFR5H3/HVqMb6UvtKnnV41IxwXNjM6PMlbfKc6KvdGodjeydCfdJOyg sn430UxaI9uLZDVRE8kOhz417Lf1BcK34EjiNkOkC+9XFUQtG1+kxRKZu5A4Vh7cHLQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796460971; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=0Zfgq8mPNHxYPSfk2AoPkb0xeIlzpEgVwHEg+Lcse9Q=; b=dNpScffsE/AAquBX0kKvr1iokDl7rxtaKheLsUpfhTU6PpVw8vlXSjK8vJ3h+P19tuev f1iqXyhLYhKJqNlEVwLhBQ0dFbtyiW8xDvw6xLhM8OZZhi5wbtHZ2gSgR41MSeuhUsiFk hetGTtXXfz6OXJc173ZnBQUWe5wUmg6kD3S/TGW+i1fy9r7s12JdARgeCn4kj3dE5Yh+2 jeoiKZXSwB5Ka09foVPmWjhzm/5hPJ99iY8/GMiJIUXp99PrkdZrjaIXAt5MXSc/XSOGU pw+dSEfP28lEXlq6sWtVBcvDn+oNxeoKz20109c59zHhRGX0iOogTrA8WTR4gtfxBGw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=N1uha4vq; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1F01F606A322 for ; Sat, 5 Dec 2026 08:56:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=N1uha4vq Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA2F21F0092B; Sat, 5 Dec 2026 08:56:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796460970; bh=0Zfgq8mPNHxYPSfk2AoPkb0xeIlzpEgVwHEg+Lcse9Q=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=N1uha4vqk62TsFhxsyOs1JuEfPhd639obLPqDcHKN6Ux6R2Ti4p1U9O45wnvIf0uQ mbADsYJolXKp6Vz38uPZoo2CrNNQyV+1cLFOCr8zIG4a4i1c9YKudnSfHepe3WPZ/N 6YHLxZzIpsVBioFkyl9jRP7N+Vk0sMIhy9hUPfDfCsLhXTzM7VEohVIAVbeJtlUVO5 yVuvc+xPSwAcAB1m0aVIzfrbAFdy2cKS0JbkVFEokeoLOT0A9n+eTHaCSiFXsVZSkP l/Ax7MFg8ovi837ezAPwG2ic84nmqTFIue48rKg/qHeMpboxkD+AELoZnOv3+QoH3H V805ctVPk5eSw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v4 13/14] thunderbolt: Decouple the waiting time of TB_PORT_UNPLUGGED and TB_PORT_UP Reply-To: sashiko-reviews@lists.linux.dev To: "Chunfeng Yun" Cc: linux-usb@vger.kernel.org In-Reply-To: <20261205083342.4009278-14-chunfeng.yun@mediatek.com> References: <20261205083342.4009278-1-chunfeng.yun@mediatek.com> <20261205083342.4009278-14-chunfeng.yun@mediatek.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 05 Dec 2026 08:56:10 +0000 X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] thunderbolt: tb_wait_for_port() cuts TB_PORT_UNPLUGGED timeout to 400ms -- commit 05565fb12a80e9ccebefeee4587f7154d13fd01e Author: Chunfeng Yun thunderbolt: Decouple the waiting time of TB_PORT_UNPLUGGED and TB_PORT_UP This commit caps the time tb_wait_for_port() spends waiting in TB_PORT_UNPLUGGED at 400 ms instead of using the full 2 second retry budget. > diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c > index e0bbdc5fb2f66..f25c358181dd3 100644 > --- a/drivers/thunderbolt/switch.c > +++ b/drivers/thunderbolt/switch.c [ ... ] > @@ -500,6 +501,7 @@ int tb_port_state(struct tb_port *port) > */ > int tb_wait_for_port(struct tb_port *port, bool wait_if_unplugged) > { > + int unplugged_retries =3D 4; > int retries =3D 20; > int state; > if (!port->cap_phy) { > @@ -519,7 +521,7 @@ int tb_wait_for_port(struct tb_port *port, bool wait_= if_unplugged) > return 0; > =20 > case TB_PORT_UNPLUGGED: > - if (wait_if_unplugged) { > + if (wait_if_unplugged && unplugged_retries--) { > /* used during resume */ > tb_port_dbg(port, > "is unplugged (state: 7), retrying...\n"); [Severity: Medium] Can cutting unplugged_retries to 4 (400 ms) regress resume on slower hardware that relied on the previous 1000 ms timeout? The 400 ms limit is based on empirical USB4 timing, but tb_wait_for_port(port, true) is also used on legacy Thunderbolt 1/2/3 resume paths (after tb_switch_reset() in tb_resume_noirq() and lane init in tb_port_resume()) and in tb_xdomain_lane_bonding_enable(). If a port stays in TB_PORT_UNPLUGGED between 400 ms and 1000 ms, tb_wait_for_port() now returns 0 early, causing tb_switch_resume() to mark the downstream subtree unplugged and tear down its active tunnels. Setting unplugged_retries to 10 would decouple TB_PORT_UNPLUGGED from the new 2 second TB_PORT_UP timeout without shrinking the existing 1000 ms window, or a shorter timeout could be restricted to USB4 disconnect wakes via PORT_CS_18_WODS. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261205083342.4009= 278-1-chunfeng.yun@mediatek.com?part=3D13