From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=83.223.95.204 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796124291; b=hgRwNMgOstMpqqT6sKE86lfm4eUaR53ZplRoNIK5dznDHFoEish0jVsiK8knCDl0/SWr f+1HkE1N8HJb8wB+HtSNuIl8WNaEM2JEDuEtsREZSr23c0y1p9YO1bgfQCn65SHyQcwNj yfVyiO3zQNhd7cA8/BoHXZ4lRPb/9CBXs4yjfe3Bi6/CDEYgNiAXdsZ5r/7z6JNMbjMVY GHa4egUUx/eSQ3osxAxjhiGVmIOvoq3baHKKi4VDndGMo6dRwF5yj2JTO9w24V3QZchPL b9spsUyzRJkkoKM7GbXWWeSD2wpQntEAQ3EmrKuXeEAAo4D9aZZRIT3ICzSrU8lAHqw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796124291; h=DMARC-Filter:Received:Received:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=wzvP47cmVOwBhr5SQJQUI8VJ6gTDcw8aHeAhgp2BNgQ=; b=3eR5ZU/DBLq6Mqocxpc8l7nsTc4fqdbdSPp9FaeFF3oUr3EgVOWShYMGMZw3mkI3isv7 mQa0BfVmIa98HPPDtgd8cy4OMBd5t3GFKC9dSXSKUTtT06idjKbrdQijNgi8+4wf7qNzB vt1gK6S+azyvX/z3mhaE+46EXyvSkILwhwYp30j7DOKULxDTcJn+SSErkDQZ7FTn2/YaT 8UByB87Lq3p59DTTIAKJywLX+M9u0KE0mO94ce10WG47MKzsDg7cbtzOBekmbvs09DEEr pFjrlASl6MX7/2WxoI+TI9nkPmFidp0THeOs7lQCsBHOubL0/bVvOUfLOM/ROdd4bBQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=wunner.de; spf=pass smtp.mailfrom=wunner.de; arc=none smtp.remote-ip=83.223.95.204 Received: from mailout1.hostsharing.net (mailout1.hostsharing.net [83.223.95.204]) (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 71359606A31A; Tue, 1 Dec 2026 11:24:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 71359606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=wunner.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wunner.de Received: from h08.hostsharing.net (h08.hostsharing.net [IPv6:2a01:37:1000::53df:5f1c:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384 client-signature ECDSA (secp384r1) client-digest SHA384) (Client CN "*.hostsharing.net", Issuer "GlobalSign GCC R6 AlphaSSL CA 2025" (verified OK)) by mailout1.hostsharing.net (Postfix) with ESMTPS id 2E34C369; Tue, 01 Dec 2026 12:24:49 +0100 (CET) Received: by h08.hostsharing.net (Postfix, from userid 100393) id 18703601CACB; Tue, 1 Dec 2026 12:24:49 +0100 (CET) Date: Tue, 1 Dec 2026 12:24:49 +0100 From: Lukas Wunner To: Qiang Yu Cc: Will Deacon , Lorenzo Pieralisi , Krzysztof Wilczy??ski , Manivannan Sadhasivam , Rob Herring , Bjorn Helgaas , Nirmal Patel , Jonathan Derrick , Frank Li , Manivannan Sadhasivam , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH RFC v2] PCI: pciehp: Fix AB-BA deadlocks between reset_lock, pci_rescan_remove_lock and pci_slot_mutex Message-ID: References: <20261126-fix_deadlock_1126-v2-1-c0ed50bc7b04@oss.qualcomm.com> 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 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Tue, Dec 01, 2026 at 02:29:15AM -0800, Qiang Yu wrote: > On Sun, Nov 29, 2026 at 10:06:33PM +0100, Lukas Wunner wrote: > > On Thu, Nov 26, 2026 at 12:26:45AM -0800, Qiang Yu wrote: > > > A Root Port reset from link-down recovery takes them the other way > > > round, pci_rescan_remove_lock -> reset_lock (the boot path, via > > > pci_host_probe(), takes the same reverse order): > > > > > > qcom_pcie_global_irq_thread() > > > pci_host_handle_link_down() > > > pci_host_reset_root_port() > > > pci_lock_rescan_remove() # pci_rescan_remove_lock > > > pci_bus_error_reset() > > > pci_reset_bridge() > > > pci_slot_reset() > > > pci_reset_hotplug_slot() > > > pciehp_reset_slot() # down_write(reset_lock) > > > > Why is it necessary to lock rescan/remove for a reset? > > This looks wrong. I suggest removing pci_lock_rescan_remove() > > from pci_host_reset_root_port(). > > It's needed because on qcom the reset goes through host->reset_root_port() > -> qcom_pcie_reset_root_port() which powers down the PHY, disables clocks > and regulators before re-training. So a concurrent bus scan would access > config space and lead to NOC error in that window. Doesn't that apply to *any* access to the devices during reset? Why prevent a bus scan specifically? If this is Qualcomm-specific, why is it in a generic helper? If the Root Port is hotplug-capable, pciehp is prevented from de-enumeration and re-enumeration by the mechanism introduced by 2af781a9edc4, so why acquire an extra lock to prevent the same thing? I assume the NOC error causes an NMI? Shouldn't the NMI handler catch that and handle it gracefully? Thanks, Lukas