Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3680825rdh; Tue, 28 Nov 2023 00:17:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IEvaRQ3JjYefCjrsq38eDGFF5lAtR59shuR8hHt6OBxoEvEjcv5ZAh9/M7w2NOg8irUrOLu X-Received: by 2002:a17:902:7688:b0:1cf:ef92:18f3 with SMTP id m8-20020a170902768800b001cfef9218f3mr2509475pll.58.1701159421298; Tue, 28 Nov 2023 00:17:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701159421; cv=none; d=google.com; s=arc-20160816; b=PjjDin9Si172A5xYd1IEej1MJe9omExXHi25Vj/5r8ETJ7TQ502E6GEcbb0wY9HUMz T62CKq65MNL6jA8Ah9PFjzrd17eGo6RBF3iL2re7x8ZZ/QM9ByJQyFuHQ9dtQEB3M2vS DQZSUH5FNLs0e9KZ2Cisgd2UqrQYrl6RNajduHbc0Q5U9ahjrUqI4Nm2w95YE1Ziy3KV xH4jM9LQrS5j8Hx5D68ZC1+eR0CGfFdIBB1JYOdpPUKrP7rQWsLpnjwPxl6qk0MpK6wL 1GbQMkKFO4oDk5dZfZ2utqgNF1oJykmAq1+1N9P4VY/7lA7OCEqZHAI5BCUbi/p+edv/ c0Nw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=onr/WRNyd2rW1X0Q1rrAQNSnQdDbAl0uq7N8W17c5Aw=; fh=jEABbWuetT5+LxbCqNrUjetIGt3iqMbKO/+N8e9vXIc=; b=zqSsizp+wC4pTTuNFd99NRz/ccEFBlDMCVL3pogKNXLfRyK6Ud/TJ65tMZfe5wYxhZ qVC3h0FVq0vNCb9S9S2O60p1qvr7EIMwUBHJ45t6wPeu8hrwx3iWE0qXJF+iHHzP21t8 vWYD+DjF2VibGMgEAQByKtsyP/MUFJxsCF3a6UVhTMTGM25DeGqcoLMPLaNdDwnAzhJk rPiTSsAKCQVEwTtzqNA6RJ2EHJDXVBrhbnBR+rVMEdzt+KRt/ZTuVXYp615yZAc/jNPv WvRwnIZzZFqhJKvjWDXW5NTgqG7QWnnFktltrrCdu2J+s/EB5C1S46igjF6YIazqTXdb UKbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RHUCTUN8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id o9-20020a170902d4c900b001cfc3295702si5880299plg.109.2023.11.28.00.17.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 00:17:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RHUCTUN8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (Postfix) with ESMTP id 9DA54807C86C; Tue, 28 Nov 2023 00:16:05 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344094AbjK1IPb (ORCPT + 99 others); Tue, 28 Nov 2023 03:15:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234630AbjK1IPT (ORCPT ); Tue, 28 Nov 2023 03:15:19 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECE40CE for ; Tue, 28 Nov 2023 00:15:24 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B476C433C7; 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=hZl0Zl2shFZ9nd3i3exKHPLcrEYuE5Q2dGx/0v/2UmE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RHUCTUN8GpfK2qw9YG3t3WUpZ9OZZSAgsODxI7qZCH9vzISzi1F8eC0qa1rW5f6Sz alWD3mRUTC9KjJpB7dC6VmfJiQVnEDyR+FM3y+r44EVKNAe4imgDRToE4wMRMg9+2y UjsOlhGo0e9M6QqzwuTYr+aWI0ikhFWMYPlNdNiICzSd+ClUWMPv4Pv0Ex7kxwCsgT UqrXJKK1RcWvnrMaYvxA/7lBqafpUrydIE8HvK8lnG6+8dn9LVJPrAIySV4NdkwgC5 iEbVty5i6hi2WP3/RgfLY1r6g4NDNHN6eXkJS4NN1W1i5nZkIrZmQpCQ/TEpa94/Da zA2Vsjp4h0AeQ== Received: from johan by xi.lan with local (Exim 4.96.2) (envelope-from ) id 1r7tG4-00053r-1s; 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 , stable@vger.kernel.org, Michael Bottini , "David E . Box" , Manivannan Sadhasivam Subject: [PATCH v2 2/6] PCI: vmd: Fix deadlock when enabling ASPM Date: Tue, 28 Nov 2023 09:15:08 +0100 Message-ID: <20231128081512.19387-3-johan+linaro@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231128081512.19387-1-johan+linaro@kernel.org> References: <20231128081512.19387-1-johan+linaro@kernel.org> 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 morse.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 (morse.vger.email [0.0.0.0]); Tue, 28 Nov 2023 00:16:05 -0800 (PST) The vmd_pm_enable_quirk() helper is called from pci_walk_bus() during probe to enable ASPM for controllers with VMD_FEAT_BIOS_PM_QUIRK set. Since pci_walk_bus() already holds a pci_bus_sem read lock, use the new locked helper to enable link states in order to avoid a potential deadlock (e.g. in case someone takes a write lock before reacquiring the read lock). Fixes: f492edb40b54 ("PCI: vmd: Add quirk to configure PCIe ASPM and LTR") Cc: stable@vger.kernel.org # 6.3 Cc: Michael Bottini Cc: David E. Box Reviewed-by: Manivannan Sadhasivam Signed-off-by: Johan Hovold --- drivers/pci/controller/vmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c index 94ba61fe1c44..0452cbc362ee 100644 --- a/drivers/pci/controller/vmd.c +++ b/drivers/pci/controller/vmd.c @@ -751,7 +751,7 @@ static int vmd_pm_enable_quirk(struct pci_dev *pdev, void *userdata) if (!(features & VMD_FEAT_BIOS_PM_QUIRK)) return 0; - pci_enable_link_state(pdev, PCIE_LINK_STATE_ALL); + pci_enable_link_state_locked(pdev, PCIE_LINK_STATE_ALL); pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_LTR); if (!pos) -- 2.41.0