Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3680462rdh; Tue, 28 Nov 2023 00:16:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IGjfUcyI1x4YJsLwEX+ZfJPAKOHAjwtXxjmlX3qysk4toJCppunIaV6x4gXwrgP8qljWluH X-Received: by 2002:a05:6870:9e8a:b0:1f9:67db:2d51 with SMTP id pu10-20020a0568709e8a00b001f967db2d51mr19690341oab.31.1701159363730; Tue, 28 Nov 2023 00:16:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701159363; cv=none; d=google.com; s=arc-20160816; b=wrCG3N0yqNEJxIopP8ASBoUEE4Be6ylQV2g2CGlLPaXK5E+GLtN6n5H4/QJeZcpeGg vZk6sM59uswz3nTKgJhs0xKTowtCbk1/PYmjlMdvSBwn3WsZ0d3wBO9IrbZEhYITPsvD +A111YbsOf0HILBsfOv2QJ4Z4HuMI2P4bTgcRRl1Mx+UDKEB9NS8F/DKmXNJm7t9pbpn G7BiRr6G5g8tCZndJfNfYRrL829CwPNvn8NpUxAhu7ey/jiGgdWLEUJgCBuh7Rz13WNJ rvDTae8LGveTIaMSNmDaTbxOyD0DNuM8/JUSrIAyWqEq97t+ORsX+qllYNOif2jCKdSn aWvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=ClCYQq8qSShgVcYCv9wBlVVWMHjVga7mrZM8j/jToko=; fh=iycQ+tVGzEwtrJDjdL61nWNrCNm6/XQUS3tmS/wf7eA=; b=Xv1idWLQyMILiWj7qQJb7ObQ89g3hpdK774/XO6vuucmPwV+aII1HeoYE6jzVrClCW 3PuKRXAtnW6aQQm2BZdBfx/jroVk1tQJ3yBrXESZdQBXAeaXW7T1aix2/frBN4v0WaMR Q84teBZ1rH7c9UpelMhBoLjov2B3Mtf1b+onKcfLOCKFegPC319/K8EH3CKuu3VGikjN qXKGgCnE7h+RBCFea00aL4UWkNusgi8DlnmhUgVxrSP+Cu/w8WRv7IjexVXzKgVHPzM/ IpcULjsZC6tkHhlmd2s5cIF3HAUeBsRzcfNWHno+b758H05pVlZuHrWIGZw+Tk8z8BE8 Qwwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PnNpAEzk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id y16-20020a056a00191000b006cbeff5ae49si10654693pfi.3.2023.11.28.00.16.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 00:16:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PnNpAEzk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 7C2F082EC547; Tue, 28 Nov 2023 00:15:57 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344064AbjK1IPV (ORCPT + 99 others); Tue, 28 Nov 2023 03:15:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230044AbjK1IPS (ORCPT ); Tue, 28 Nov 2023 03:15:18 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED071DB for ; Tue, 28 Nov 2023 00:15:24 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54D89C433CB; Tue, 28 Nov 2023 08:15:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701159324; bh=e1PcYzYbTNGpVaCcrOSsdIFbJOZYRYBf4r0j5u1WFhE=; h=From:To:Cc:Subject:Date:From; b=PnNpAEzkB5uqEBeZm9QHP9op3cULwxXdOCDWsdgloE72TTyngsnpeQaqHd4ea6/wt rBPumlRF9D3096Yp4PlPDqbmZ6lrflrLcD+r44/0TwQ8xl/OZ1O4j//pRgMFOMCL6s m+csegl+47y24fwx5C5bo3vzd8Z7Y7OxMXuIAyjoc+9EHVkc5y7CTh4IVAfsFfwt0M dFz+LYyFTZh7Y5xSXgiZpn7uYwL9jBBIJKr8sjUb0A7IVHFfW97Wuy9Mtk1TfpJ0uT uJ0Gf3jDknuXwjEsGwu/6kDsabz0txTwpNLrBJ6YR+s3WbwQXDO+236Ab+EXckBvTQ AlGGVsNA8QdnQ== Received: from johan by xi.lan with local (Exim 4.96.2) (envelope-from ) id 1r7tG3-00053n-2I; Tue, 28 Nov 2023 09:15:52 +0100 From: Johan Hovold To: "Lorenzo Pieralisi" , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , "Bjorn Helgaas" Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Manivannan Sadhasivam , Rob Herring , Nirmal Patel , Jonathan Derrick , linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH v2 0/6] PCI: Fix deadlocks when enabling ASPM Date: Tue, 28 Nov 2023 09:15:06 +0100 Message-ID: <20231128081512.19387-1-johan+linaro@kernel.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 28 Nov 2023 00:15:57 -0800 (PST) The pci_enable_link_state() helper is currently only called from pci_walk_bus(), something which can lead to a deadlock as both helpers take a pci_bus_sem read lock. Add a new locked helper which can be called with the read lock held and fix up the two current users (the second is new in 6.7-rc1). Note that there are no users left of the original unlocked variant after this series, but I decided to leave it in place for now (e.g. to mirror the corresponding helpers to disable link states). Included are also a couple of related cleanups. Johan Changes in v2 - fix up the function name in a kernel doc comment as reported by the kernel test robot Johan Hovold (6): PCI/ASPM: Add locked helper for enabling link state PCI: vmd: Fix deadlock when enabling ASPM PCI: qcom: Fix deadlock when enabling ASPM PCI: qcom: Clean up ASPM comment PCI/ASPM: Clean up disable link state parameter PCI/ASPM: Add lockdep assert to link state helper drivers/pci/controller/dwc/pcie-qcom.c | 7 ++- drivers/pci/controller/vmd.c | 2 +- drivers/pci/pcie/aspm.c | 65 +++++++++++++++++++------- include/linux/pci.h | 3 ++ 4 files changed, 56 insertions(+), 21 deletions(-) -- 2.41.0