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=1795986403; b=wxO926qZxrhAKlZsSn/mHG3NZW09sw1T4XMrP8Me0BIHqTu57yD7ir4FhXaqWxRF8cpK kI0EftsQwfbe+qkPq5r+r0Hsdpz6kK6SzxZ+IkLElBp7nmyRtrWveXbg+Xa4rxID7vhSx zLxcUvIIGTBRBZxn75O61oljhiZ//JX0Ag+1vHS7fB2sMMBgbX4QOZyYgB/UfyoXOy556 sXKOu27yrtWveyGIZx/vfSiQoIt6kb5YVlk8sSg4PFVi5gcXQ1Dfu3F/81LPgKqNP1aHU 1SAkA6Avw5+LawID0YmVpgedgoVOyxSAPqNJuznVI9xYFSI1xSxnHTIQwgnCi23CwaQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795986403; h=DMARC-Filter:Received:Received:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=dHPAFOZzaZzVacmWXfTU1UVjGXqWrTu1Caf5snNCVG8=; b=NOiDRMxO0Hq671nOCE+uczyQIKjN9m2Fg+maglOtzvjSUajBSpk+73a1wG31Axkl54ri EFFCVYPHAmAD1bcrIfBTK9tkpDYQTt1JLfDuog8RILraeJGJmbqQI3RN/MhFArAHUmo6p O3ik+jelWmgDRTg2yvHcxN5ld+jiAyLS3Ih2O020nfh9C3CzWcg/7xjLOS88YQ1y/bQ3b h/mT/oFql1EjuMcH9iXu3uBhuBI8lSw87Cnuaxj349rIDAyJDD/pjbUD/iBUpuBDwq10O AybagZd1ke/oqQUN5AhOQh4CBi4QJ8uSRy7+WH1NkCtFbhoAepJoPlUynHwRbMGSzzw== 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 77B7C606A31C; Sun, 29 Nov 2026 21:06:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 77B7C606A31C 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 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-Mailing-List: linux-pci@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: <20261126-fix_deadlock_1126-v2-1-c0ed50bc7b04@oss.qualcomm.com> 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