From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 0E127606A325 for ; Sun, 29 Nov 2026 21:13:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=WKGM4Ae/ DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=dHPAFOZzaZzVacmWXfTU1UVjGXqWrTu1Caf5snNCVG8=; b=WKGM4Ae/CZstjL5ajQyGU4iqwP hYjVGdSjPP5zmgBY7yRNltfl5DnIWW5a2+Wf0zwbOicuAeeax6JTXkxUxz+AivQaj7OKKGEegBvwv WedoWQWJBfvxvtn0RYilJdBjfvB6dn8zKixbG2d08pmC2mSAG3tJQxbW+4EYNYFS4/S8DkF1qgHYv c1dAjGJoOAe9zLVLs7vfjK6XVEdUnnVd+8fZL8lAeTOdkv0/O5Xk1ZTYK1F0UhuoNgFx+FXrJznHO sTlXtntEjDAYaQur7ayNdIp/T8/KmrTXgtstuUFmVokRZ3uPRD1MbTYaUXUODTTQTTJuU/K85qDdv e98PO2PQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xXmDF-00000002UMx-3GVt; Sun, 29 Nov 2026 21:13:33 +0000 Received: from mailout1.hostsharing.net ([2a01:37:1000::53df:5fcc:0]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xXmDB-00000002UMV-0J4f for linux-arm-kernel@lists.infradead.org; Sun, 29 Nov 2026 21:13:32 +0000 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 3021B3B9; Sun, 29 Nov 2026 22:06:33 +0100 (CET) Received: by h08.hostsharing.net (Postfix, from userid 100393) id 1803A6030A17; Sun, 29 Nov 2026 22:06:33 +0100 (CET) Date: Sun, 29 Nov 2026 22:06:33 +0100 From: Lukas Wunner To: Qiang Yu Cc: Will Deacon , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , 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-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261126-fix_deadlock_1126-v2-1-c0ed50bc7b04@oss.qualcomm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261129_131329_260349_7C40011D X-CRM114-Status: GOOD ( 10.98 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-3.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On Thu, Nov 26, 2026 at 12:26:45AM -0800, Qiang Yu wrote: > Commit 5b3f7b7d062b ("PCI: pciehp: Avoid slot access during reset") > introduced ctrl->reset_lock to serialize a Secondary Bus Reset (SBR) > with the pciehp code paths that read the Link Active and Presence > Detect bits, both of which flap during an SBR. > > pciehp_ist() holds reset_lock across the whole event handling, > including enumerating or de-enumerating the hotplugged devices. That > nests two PCI core locks inside reset_lock, each taken in the opposite > order by a concurrent SBR, causing two AB-BA deadlocks. It looks like you're trying to fix two separate deadlocks in a single patch. Can this be split in two patches? > 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(). Thanks, Lukas