From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=46.30.211.176 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796470455; b=ZlYDvJw6tnfIVgW0fEbS7JPnJPmFfh40deGTxHUH38T0VnkVcskEsUqrUwgqW4jpPc+/ kuYcdUdPQV7Q4Htkji+JcGx2dnppo8sY1dogytVGjGQENmSUMlGApyvmztUAP3mzr/2RS yXmNwkDkyJGGpRjGoMZeln48ylBVMJvRJbT+NUSHLXLxWIXDj9meb9C0oXddiasGUlPO+ z1UkmFV8bIswCyHkWEaLjiE1qKu852jxtlubK/4ueLqShNdGr2aPiAS8nK3Ac8T8w7Bin lI93m0rt3mAHms/+wbwNdAPsRbBfXNH3hcNekejYetwOdLdQHU8FvnBL4u/ZJmbawVA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796470455; h=DMARC-Filter:DKIM-Signature:DKIM-Signature:X-HalOne-ID:Received: Message-ID:Date:MIME-Version:User-Agent:Subject:To:Cc:References: Content-Language:From:In-Reply-To:Content-Type: Content-Transfer-Encoding; bh=Tmjf2OD8rZHg4bY4gLtB4Z/JbwYPB89VuVsQnxPijs0=; b=HkzS+OWQKXXnU+tZJFVN1lbiWbm1MkBtHYgKFcNSQrkr0qoRwpdWu+7Wyxl5FfOsxJqE R7L+pePUSz2l+9hnM8ehelvVy/fN/6fVVAqUFhS0zVtrHxv3vE/NrAxV+u9Wjd3teKUnQ j0ySHcRJItcFQXsm4NcBYKULNVcBCzG4TiWR2w+9eGLWgoRLr+cCixz9+3n/jVuBmQjke OaUoEwr65kI2GsZfZJghzsgwnCcwryO1yGQ8TKKyicyVFpc4PP2qJ6S2Nk1hVp+13w3KE 1/aLZsEjbX9sGd2zFFSmEMfL2u2z5ADRFjMHB+Y4QoBzFDiYSXniQLjwJ0UNUTfLnfg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=sudmix.de; spf=none smtp.mailfrom=sudmix.de; dkim=pass header.d=sudmix.de header.i=@sudmix.de header.a=rsa-sha256 header.s=rsa1 header.b=O7qPkBXY; dkim=pass header.d=sudmix.de header.i=@sudmix.de header.a=ed25519-sha256 header.s=ed1 header.b=pitBwbbG; arc=none smtp.remote-ip=46.30.211.176 Received: from mailrelay-egress1.pub.mailoutpod2-cph3.one.com (mailrelay-egress1.pub.mailoutpod2-cph3.one.com [46.30.211.176]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BA2A4606A322 for ; Sat, 5 Dec 2026 11:34:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org BA2A4606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sudmix.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=sudmix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=sudmix.de header.i=@sudmix.de header.a=rsa-sha256 header.s=rsa1 header.b=O7qPkBXY; dkim=pass header.d=sudmix.de header.i=@sudmix.de header.a=ed25519-sha256 header.s=ed1 header.b=pitBwbbG DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1796470439; x=1797075239; d=sudmix.de; s=rsa1; h=content-transfer-encoding:content-type:in-reply-to:from:references:cc:to: subject:mime-version:date:message-id:from; bh=Tmjf2OD8rZHg4bY4gLtB4Z/JbwYPB89VuVsQnxPijs0=; b=O7qPkBXYbKKI6hK2m8uyev4xWP6V1rfvnJdCKjTELc7x8DrHIF/iLCQM5+B0o0FFgz8NmVDjUZaIl 7p/a5LLDnV+MdTaHgC+g7dCHXrXoKktKV4dVX0iaIHxCqyPLPpgZQWSKWH2WQTCjv6FR5Kf47rB37w 90Ckq6UUDc/e3HVhjBZtD+xQL7V4gucWOhPSy71XN8H7fp2S4qS1IE6OnWW3AQtOR+p9R8n+PydYEr qKkbcWSqaCBDllVY1VP1FbRyiRQ7xCHbSBytCku18ikSbn6kjM4QyC7rUzcVlnZ3vfTmk7GP3Luk7g wWR3wgct86PvE8nIJTI27Wnsiwuxjog== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1796470439; x=1797075239; d=sudmix.de; s=ed1; h=content-transfer-encoding:content-type:in-reply-to:from:references:cc:to: subject:mime-version:date:message-id:from; bh=Tmjf2OD8rZHg4bY4gLtB4Z/JbwYPB89VuVsQnxPijs0=; b=pitBwbbG+J3zphmpBouC8vI9DjhKY7LOkwDPRfKPb4OdiFsTvG3mHUgORjbidNRs17lh0S/OI9arC ZEsvmX4Cg== X-HalOne-ID: c293db0b-f09f-11f1-9ed5-fd361d09a561 Received: from [192.168.0.225] (unknown [94.31.108.188]) by mailrelay1.pub.mailoutpod3-cph3.one.com (Halon) with ESMTPSA id c293db0b-f09f-11f1-9ed5-fd361d09a561; Sat, 05 Dec 2026 11:33:59 +0000 (UTC) Message-ID: <233bbbd1-a5ed-4737-89e1-6d69b210c0a0@sudmix.de> Date: Sat, 5 Dec 2026 12:34:00 +0100 X-Mailing-List: linux-kernel@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 v2] usb: core: sysfs: show product, manufacturer and serial without the device lock To: Greg Kroah-Hartman Cc: Alan Stern , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org References: <20261014-usb-string-attrs-v2-1-c5cacdad7094@sudmix.de> <2026120355-dropkick-owl-c480@gregkh> Content-Language: en-US From: Joe Finzel In-Reply-To: <2026120355-dropkick-owl-c480@gregkh> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On Thu, Dec 03, 2026 at 07:06:11PM +0100, Greg Kroah-Hartman wrote: > On Wed, Oct 14, 2026 at 11:01:51PM +0200, Joe Finzel via B4 Relay wrote: > > is done -- seconds on a hub with several devices. > > "seconds"?  USB isn't that slow. Not per device, but it adds up because hub_event() keeps the hub locked for the whole port loop. This is the root hub of the Z790 board from the commit message, real hardware, 7.3.6:   [2.419] usb 1-2: new high-speed USB device number 2 using xhci_hcd   [4.295] hid-generic 0003:0B05:1A52.0001: ... [Generic USB Audio]   [4.408] usb 1-3: new full-speed USB device number 3 using xhci_hcd   [4.704] usb 1-4: new full-speed USB device number 4 using xhci_hcd   [4.950] usb 1-10: new high-speed USB device number 5 using xhci_hcd   [5.194] usb 1-11: new high-speed USB device number 6 using xhci_hcd   [5.600] usb 1-13: new high-speed USB device number 8 using xhci_hcd   [6.009] usb 1-14: new full-speed USB device number 10 using xhci_hcd Most of it is the on-board audio device on port 2, which takes 1.9 s from getting its address to its HID interface being bound (I haven't looked into why yet); the other ports take 0.1-0.3 s each. systemd stops udevd at 4.14 s and it exits at 6.15 s. In the last 40 boots of this machine the stop took 1.6-2.3 s, and every time it ended 141-152 ms after the "usb 1-14: new" line, so udevd waits for the root hub's port loop to finish. > qemu is "fake", so it can't provide real numbers, sorry.  Use real > hardware for testing this type of thing. Fair enough. The numbers above are from the real machine; I only used QEMU to show the effect of the patch reproducibly. I can run the same board with the patch applied and send before/after numbers from it. > They can still change. The device can change them, but the kernel reads them only once: usb_enumerate_device() sets udev->product, ->manufacturer and ->serial, and nothing writes them again until usb_release_dev() frees them. If a device comes back from a reset with different descriptors, usb_reset_and_verify_device() re-enumerates it as a new device. > What happens if the device goes away when this is called? device_del() removes the attribute, and kernfs waits for any show() that is already running (kernfs_drain()). The strings are only freed in usb_release_dev(), after that. > How is usb_lock_device() so slow?  Is it because you are racing and > trying to read the same device all at once and grabbing the lock and > hitting the sleep in usb_lock_device() somehow?  Why not turn that value > down if that's the real issue? There is no sleep in it, usb_lock_device() is device_lock(). It only waits because hub_event() holds the same lock while it enumerates every port, as above. If you still prefer to keep the lock, I can drop the patch. thanks, Joe