From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-179.mta0.migadu.com (out-179.mta0.migadu.com [91.218.175.179]) (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 127363A1E98 for ; Mon, 29 Dec 2025 23:31:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767051091; cv=none; b=ovgZWwaA1HuZZm0/JG65CeeVVy9zi/CnOfvGHDfo0b8Yw/CiHDvFy/BXLNPCthLl39xN94NWWUX3n5Ct1B8kbhGMs4sMRc9cWJEF5/MOhCxA7M9uRI/geVeEgw0Rg3vf8Fg+EPa1Kt41hwpoxIIRbKXdVGM6L3vjVIVTwQvh4Mg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767051091; c=relaxed/simple; bh=QnUAsZB9E9hOe+7pIms4H57UT5rF0CagMNSujvZag1k=; h=Mime-Version:Content-Type:Date:Message-Id:To:Cc:Subject:From: References:In-Reply-To; b=NOwcmb57k2vR04/HYibQj5+zYFgtOj6AShyiUUNZG3ua3oZCzXX5kh4btTHewzM937tGcz2dO/adS31YifW5y04FiOFjf/CV+i0jHHCrZj+0YOyPf11nG9paAEsk3wiY/6QvDx7l5vTHU+wW4eyr45h/E29jE/H6INkA89aZQGk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=cknow-tech.com; spf=pass smtp.mailfrom=cknow-tech.com; dkim=pass (2048-bit key) header.d=cknow-tech.com header.i=@cknow-tech.com header.b=LQG2D0R2; arc=none smtp.client-ip=91.218.175.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=cknow-tech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cknow-tech.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cknow-tech.com header.i=@cknow-tech.com header.b="LQG2D0R2" Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cknow-tech.com; s=key1; t=1767051085; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=egUaL+sUnKDXbV077QdhT1ThHmuXbBNBbL/PZQAMPZI=; b=LQG2D0R2RKv6aXIjVK5QMsxu+NDSMdPx8qrKKp8jsLQSYpaBtsf37p0mDHw2eQvl3LHr1t ntwVvY4184WgcNhKrvbC01GZgmnnnsBal6mWQ2THrjYudOFlMLULYgyWWFmlGLABqVny45 pyUbVHOXw1dsru/Cs1jpW85yEgxWwlXllTaVpGisDFz56LCj8VbgiiWZoZOoetN0ZBeQY1 cdeh3QKuHlC/RVBi86Kl4RHTv37MSghtHs+qrk7uHGU2NsfsmbcQ8USxHllO7GCZIlyNB2 pOJ/KRYPNHmHEDjSkpw/10jirFytoq5/acrtPZzradT4xu5rEm7HPmLCGS62Qg== Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Tue, 30 Dec 2025 00:31:17 +0100 Message-Id: To: "Andy Shevchenko" , "Diederik de Haas" Cc: "Michael Wu" , , , , "Dragan Simic" , Subject: Re: [PATCH v3] extcon: Fixed sysfs duplicate filename issue X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: "Diederik de Haas" References: <20251024024946.16618-1-michael@allwinnertech.com> In-Reply-To: X-Migadu-Flow: FLOW_OUT On Sun Dec 28, 2025 at 6:26 PM CET, Andy Shevchenko wrote: > On Sun, Dec 28, 2025 at 12:01:54PM +0100, Diederik de Haas wrote: >> On Sat Dec 27, 2025 at 4:08 PM CET, Andy Shevchenko wrote: >> > On Sun, Dec 21, 2025 at 03:01:11PM +0100, Diederik de Haas wrote: >> >> On Fri Oct 24, 2025 at 4:49 AM CEST, Michael Wu wrote: >> >> > With current extcon_dev_unregister() timing, ida_free is before >> >> > device_unregister(), that may cause current id re-alloc to another >> >> > device in extcon_dev_register() context but sysfs filename path not >> >> > removal completed yet. >> >>=20 >> >> I periodically get errors like this: >> >>=20 >> >> [ 7.116152] rockchip-usb2phy fe8a0000.usb2phy: error -EEXIST: fail= ed to register extcon device >> >> [ 7.117005] rockchip-usb2phy fe8a0000.usb2phy: probe with driver r= ockchip-usb2phy failed with error -17 >> >>=20 >> >> This was today on a NanoPi R5S (rk3568), but I have seen it before an= d >> >> on multiple devices. They are all Rockchip based, but that's (quite) >> >> possible because that's what I use the most (and where I pay quite a = bit >> >> of attention to dmesg). >> >>=20 >> >> Slightly fuller dmesg output of the above error is here: >> >> https://paste.sr.ht/~diederik/42c6b3405386c823cd9f837d73a9a32e810361b= e >> >> And via 'journalctl' I hopefully got the full dmesg output: >> >> https://paste.sr.ht/~diederik/7a6109115b1ad85290de482db091dad3759ec15= 9 >> >>=20 >> >> Here are 2 similar logs, this time on PineTab2 and Quartz64-A (both r= k3566) >> >> https://paste.sr.ht/~diederik/cfe606801d3dab0267bea7049687d24c0d6e8d7= 1 >> >>=20 >> >> Those are all the logs I have saved, but it has happened several time= s >> >> besides that. But most times I just rebooted and didn't save the log. >> >> Today I looked a bit further, found commit 7bba9e81a6fb, searched on >> >> lore.k.o and found this patch. >> >>=20 >> >> So I'm wondering whether this patch would also fix 'my' issue? >> >> Or is this a different issue? >> > >> > But have you had a chance to test it? The code looks correct after thi= s patch >> > as the first we remove the struct device and all associated data (incl= uding >> > sysfs nodes) and then remove the ID from the list. Without that there = is a >> > window to get the same id for the devices that is pending to be remove= d. >>=20 >> I've build a kernel with it and it will be part of my kernels going >> forward. But it can take many months before the issue shows up again. >> So if I don't get it in a year, then I'm going to *assume* it's probably >> fixed. > > I believe you may speed up the test case by creating two shell scripts th= at > trying insmod / rmmod the same module in parallel. I checked on several devices and the phy_rockchip_inno_usb2 module is used by various other modules on all of them, so I can't just 'rmmod' it. I guess it should technically be possible to remove all its dependencies and then remove that module. I don't know if my skills are sufficient for that and it feels like I'm mostly testing the robustness of the USB subsystem. As I regularly already get the following kernel warning ``Warning! ehci_hcd should always be loaded before uhci_hcd and ohci_hcd, n= ot after`` which often results in USB 2 ports not working, I have my doubts about the robustness anyway. So I'll just keep an eye out if the ``sysfs: cannot create duplicate filename`` error pops up again 'naturally' and report if/when it does. Cheers, Diederik