From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=198.175.65.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796401059; b=XXXFCehnxNbjSRBoM2j69SrupMmUU0BBjtXXZzYRFMu38ESUT9jNSMMfkD+ikuGGLRAh J3kw3rosSF3YwQcTb+RQMjyn3ruRvg4ZFxos9KrsDriL6xt/61IC9s/nex26/6sQCnrGA V2iVTutc4gzpzxsdXjkrU4gNXCxN0/Z4w8BwXFgssQrZyjMkOHgTwBo40CU1+91deIKhe hIqzFrYTN7jbxqUrnZc8ICfkLkQcJbuT3cpirrdioojUR3nR5lU0FFyFpRFuY8qxumzbI Z6hPBdcXxVQf8L0sFkQzdsfXIPLUMcJOXIf+7QmMwNg7szEIlClr61XrIEIEwg/ag2Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796401059; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:Message-ID:Date: MIME-Version:User-Agent:Subject:To:Cc:References:Content-Language: From:In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=9K16X0tGWHfi5shXWzqBuZSPpwzvBpOBflYizCJJ9FQ=; b=dlMoybqarTrG/mpYULc3U3F/yjUs8mVtFd8CihkRuDfKFJsONDun5mEd2/iQPA81Eogt kABCbpEYxkBd9m9Hn9Vc6ZxobbPO1AumYMdRroX18VGC6rK9jzW+Xu7ljIMltF9B+SzFr G8UPeINtqzEh/d6UVEhg6Q+w++WB3dumVEBjnVrLTi2RoRXGQjaMIniz04q6pOSlWnzMz 9ljGSxaWSmfTeYov8reVzTjyFspoH8/9m3XI0cWhnGfvQqjEHz3lh9jOzu8HtVIkztz04 18N2MBS5Mnl5wzbx0aqnAoYFsoOUkd/bFYXlec6c6z449b1WrWpqEef3omC86a3QUjA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=g3OIHb+Y; arc=none smtp.remote-ip=198.175.65.18 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CB79D606A32D for ; Fri, 4 Dec 2026 16:17:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org CB79D606A32D Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=g3OIHb+Y DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796401059; x=1827937059; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=9K16X0tGWHfi5shXWzqBuZSPpwzvBpOBflYizCJJ9FQ=; b=g3OIHb+YDvDO823aKlA2rQI/OJaEe2Ueu98pOoYw9mdpKF6+PdgRaN3U gTFHHEdayyJW3/S9NAK+N+RKagNnvBQo6YVYwDJHkeEqNjd9tasQw3RbR Alm2nAJ0S5AFQhC9WRENiExsD6r9wD7cvBdbhC28rFzo2/cq0qOtWkjlq 3Ind/b9pPoP1EgzHnqgd0RlPQkT7rriBsEzFZKlZ1hQPzwqD0YQav6xiW roFEK8Q4K4i5Ja+e701gEgD55VeIhL/fl4F5RGP+TR8xwlCPBGi+VAWf7 3p3OXy9mVtM+gbfkr045sUmDo1waFUDG+GbduJN9sSqx80NWOwTPGlkTZ Q==; X-CSE-ConnectionGUID: ktpMBbaoQLGY7naGkJq3Gg== X-CSE-MsgGUID: 73N2IwA/T3Kmg8lQofWWVw== X-IronPort-AV: E=McAfee;i="6800,10657,11986"; a="5404823" X-IronPort-AV: E=Sophos;i="6.29,78,1794902400"; d="scan'208";a="5404823" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2026 08:17:39 -0800 X-CSE-ConnectionGUID: /SLaM48eSQq7VSFUz2dA+w== X-CSE-MsgGUID: AC4RhDTbTbWdZxbKdLBFwQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.29,78,1794902400"; d="scan'208";a="14312062" Received: from conormcd-mobl2.ger.corp.intel.com (HELO [10.245.244.254]) ([10.245.244.254]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2026 08:17:36 -0800 Message-ID: <3b580d95-ffb7-4e5c-af72-6e7633acf6e8@linux.intel.com> Date: Fri, 4 Dec 2026 18:17:34 +0200 X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 0/2] xhci: handshake timeout overrun and configure endpoint hang on device disconnect To: Michal Pecio , Henry Tseng Cc: Mathias Nyman , Greg Kroah-Hartman , linux-usb@vger.kernel.org References: <20260930101752.15794-1-henrytseng@qnap.com> <20261127101730.70717-1-henrytseng@qnap.com> <20261204115823.04daaa91.michal.pecio@gmail.com> Content-Language: en-US From: Mathias Nyman In-Reply-To: <20261204115823.04daaa91.michal.pecio@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 12/4/26 12:58, Michal Pecio wrote: > On Fri, 27 Nov 2026 18:17:21 +0800, Henry Tseng wrote: >> On Wed, 30 Sep 2026 18:17:50 +0800, Henry Tseng wrote: >>> This series addresses two problems found while debugging an AMD Raven >>> USB 3.1 xHCI (1022:15e0) that gets declared dead when a USB storage >>> enclosure is unplugged. During teardown a command fails to complete, >>> aborting the command ring also fails, and the whole host is declared >>> dead, taking unrelated devices on other root ports down with it: >>> >>> xhci_hcd 0000:0c:00.3: Command timeout, USBSTS: 0x00000010 PCD >>> xhci_hcd 0000:0c:00.3: Abort command ring >>> xhci_hcd 0000:0c:00.3: Abort failed to stop command ring: -110 >>> xhci_hcd 0000:0c:00.3: xHCI host controller not responding, assume dead >>> >> >> Hi Mathias, >> >> Gentle ping on this series. A short summary, since the thread got long: >> >> On an AMD Raven xHCI (1022:15e0), unplugging a QNAP TL-D800C enclosure >> leaves the Configure Endpoint command that drops a hub's endpoints >> during teardown incomplete. The command ring abort then fails and the >> host is declared dead, taking down devices on other root ports too. >> It only happens when the command is issued after the root port >> disconnect, deconfiguring the same hubs while still connected works. >> >> Since Disable Slot follows right after and disables all endpoints of >> the slot anyway (xHCI 4.8.3), the idea is to skip this Configure >> Endpoint for disconnected devices. Michal saw no side effects on his >> hosts when it is omitted before Disable Slot. >> >> v1 decided this from the roothub port state, but as Michal pointed >> out, that can miss the case where the link comes back before >> xhci_check_bandwidth() runs. For v2 I'd like to check >> udev->state == USB_STATE_NOTATTACHED instead. usb_disconnect() sets >> it on the device and its children before the command is issued, and >> it doesn't change back. > > This should work, AFAICT usb_disconnect() is the only path in USB core > which destroys configured devices, and it works as you described. > > USB_STATE_NOTATTACHED has the advantage of being immune to brief > disconnections and not dependent on new v7.3 functionality, so easier > to backport if necessary. > > Disadvantage: slower to respond, if somebody deconfigures manually > while also pulling the plug. I suspect this is less likely to occur in > practice than transient loss of link. > >> Would that work for you, and if so, would you prefer the check in >> xhci_check_bandwidth() or in usb_hcd_alloc_bandwidth() in USB core? > > Probably in xhci-hcd: this ability to omit bandwidth reconfiguration > in certain cases is xHCI-specific, even if xhci-hcd is the only HCD > using these function now (and possibly forever, but who knows). > > I think core maintainers wouldn't want to deal with this hack. Checking for udev->state == USB_STATE_NOTATTACHED sounds good. Best place is probably xhci_check_bandwidth(). hosts like xhci-mtk depend on usb core calling drop_endpoint() to set bandwidth scheduling. XHCI_SW_BW_CHECKING hosts do software bandwidth tracking in xhci_configure_endpoint(), so those should still take the full old path. Thanks Mathias