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 5C745606A320 for ; Tue, 1 Dec 2026 11:25:12 +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=RSu0jB7O 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=wzvP47cmVOwBhr5SQJQUI8VJ6gTDcw8aHeAhgp2BNgQ=; b=RSu0jB7OGVh97JEMnd+APdx7wZ /bKDF0t4gQwsVHHQrPgia0ESYZJVBDuwITWcdshNLallVCnqp4fOSPYjC6KN69Jb8oU0PXZx9US+q QBmmy3kRwHEjiwsTkiuawOnjPPIqTg4CQ1AsxQ31lfP3HaZxGQpIv13GKNS975kQsRX/hLGE5dsMy S9thIKKoM2OqY01cFL+sG4SRIYXV+wfK26AFwvLGUpUbmgxAFY4VXpmAWcjhN5ZwmPyiNUkojiRsh X0alRBwOi8X3g2OxtPh7DRU/2s9XcAmUKxqyW4aN6L7gLgFgPxcQncC68GLVAxz+1Sgy58Tbj9Jsp qESzE7zA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYLyr-00000007YuZ-2yB5; Tue, 01 Dec 2026 11:25:06 +0000 Received: from mailout1.hostsharing.net ([83.223.95.204]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYLyf-00000007YsV-1xZt for linux-arm-kernel@lists.infradead.org; Tue, 01 Dec 2026 11:25:04 +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 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-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261201_032502_075979_C2B2FECE X-CRM114-Status: GOOD ( 16.27 ) 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 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