Message ID | 20231128081512.19387-1-johan+linaro@kernel.org |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp3757811vqx; Tue, 28 Nov 2023 00:15:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IG2+UJXWnAL4RkDFvtXSJT+gXL5nVs6izdC8NLVrMo1Xq1FuQYBSuOuiMbrTfufOEMPXGNW X-Received: by 2002:a05:6871:806:b0:1f9:e965:191d with SMTP id q6-20020a056871080600b001f9e965191dmr16520409oap.56.1701159344784; Tue, 28 Nov 2023 00:15:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701159344; cv=none; d=google.com; s=arc-20160816; b=UcQ7lqmhXiGEwvTesXn+OAL7OtVlqosL8Fhw3Pj7NJNYQPZIWUDbMDkqdhlg3jizOM s3Y5RjFamiX7QspJKVbkZreRam7yxMqUjNA7Gy195vGIU1B0r/CrW6JcuHqcTlhmIYRf 3SEfcv36DGvfznChiujZJhXbty5qqPORypjo8YXjoamuWV+/Ag7SItKEMKvsdHqQ+jhj ffetZgiH4Ak5srK4WSINTYndDID0WOfTlezg/bOoiTlIDXcP7PMmvBfv29DZQQ5on0HM BNtp5egQHLwAbxXkjFdvtOEOH0ct26RswUfn8GZBvNJT5gepYlTwNaPzANC6a9cVjjgW eXHQ== 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 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id g25-20020aa78759000000b006cc03f4e545si6912525pfo.394.2023.11.28.00.15.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 00:15:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; 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 2620:137:e000::3:4 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 27F4E82E7B20; Tue, 28 Nov 2023 00:15:37 -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 <rfc822;toshivichauhan@gmail.com> + 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 <rfc822;linux-kernel@vger.kernel.org>); 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 <linux-kernel@vger.kernel.org>; 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 <johan+linaro@kernel.org>) id 1r7tG3-00053n-2I; Tue, 28 Nov 2023 09:15:52 +0100 From: Johan Hovold <johan+linaro@kernel.org> To: "Lorenzo Pieralisi" <lpieralisi@kernel.org>, =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= <kw@linux.com>, "Bjorn Helgaas" <bhelgaas@google.com> Cc: Andy Gross <agross@kernel.org>, Bjorn Andersson <andersson@kernel.org>, Konrad Dybcio <konrad.dybcio@linaro.org>, Manivannan Sadhasivam <mani@kernel.org>, Rob Herring <robh@kernel.org>, Nirmal Patel <nirmal.patel@linux.intel.com>, Jonathan Derrick <jonathan.derrick@linux.dev>, linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold <johan+linaro@kernel.org> 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: <linux-kernel.vger.kernel.org> 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:40 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783794861352873107 X-GMAIL-MSGID: 1783794861352873107 |
Series |
PCI: Fix deadlocks when enabling ASPM
|
|
Message
Johan Hovold
Nov. 28, 2023, 8:15 a.m. UTC
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 <lkp@intel.com> 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(-)
Comments
Hi PCI maintainers, On Tue, Nov 28, 2023 at 09:15:06AM +0100, Johan Hovold wrote: > 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 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 Could we get this merged for 6.7-rc5? Even if the risk of a deadlock is not that great, this bug prevents using lockdep on Qualcomm platforms so that more locking issues can potentially make their way into the kernel. And for Qualcomm platforms, this is a regression in 6.7-rc1. Johan #regzbot introduced: 9f4f3dfad8cf
On Tue, Nov 28, 2023 at 09:15:06AM +0100, Johan Hovold wrote: > 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 <lkp@intel.com> > > > 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(-) Applied to for-linus for v6.7, thanks, Johan!
Linux regression tracking (Thorsten Leemhuis)
Dec. 10, 2023, 12:35 p.m. UTC |
#3
Addressed
Unaddressed
[TLDR: This mail in primarily relevant for Linux kernel regression tracking. See link in footer if these mails annoy you.] On 07.12.23 14:25, Johan Hovold wrote: > On Tue, Nov 28, 2023 at 09:15:06AM +0100, Johan Hovold wrote: >> 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 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 > > Could we get this merged for 6.7-rc5? Even if the risk of a deadlock is > not that great, this bug prevents using lockdep on Qualcomm platforms so > that more locking issues can potentially make their way into the kernel. > > And for Qualcomm platforms, this is a regression in 6.7-rc1. > > #regzbot introduced: 9f4f3dfad8cf Fixes are now here: https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git/log/?h=for-linus #regzbot fix: 075268be58232b0a2ae #regzbot ignore-activity Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat) -- Everything you wanna know about Linux kernel regression tracking: https://linux-regtracking.leemhuis.info/about/#tldr That page also explains what to do if mails like this annoy you.
Hi Bjorn, On Fri, Dec 08, 2023 at 11:53:12AM -0600, Bjorn Helgaas wrote: > On Tue, Nov 28, 2023 at 09:15:06AM +0100, Johan Hovold wrote: > > 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 > Applied to for-linus for v6.7, thanks, Johan! I've noticed that you're pretty keen on amending commit messages. For this series, for example, I noticed that you added an American comma after "e.g." even though this is not expected in British English that I (try to) use. This risks introducing inconsistencies and frankly I see no reason for this kind of editing. British English is not an error. :) You also added a plus sign after the stable kernel versions in the comments after the CC-stable tags even though this is not the right notation for this (see the stable kernel rules). I'm more OK with you preferring to use function names over free text in commit messages even if that is not my preferred style. But generally I find it a bit odd that you insist on rewriting commit messages like this and would prefer if you did not (especially since there's no record of you having done this in the commits themselves). Fixing typos and grammar issues, or rewriting bad commit messages, is another thing of course. Johan
On Mon, Dec 11, 2023 at 06:35:46PM +0100, Johan Hovold wrote: > Hi Bjorn, > > On Fri, Dec 08, 2023 at 11:53:12AM -0600, Bjorn Helgaas wrote: > > On Tue, Nov 28, 2023 at 09:15:06AM +0100, Johan Hovold wrote: > > > > 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 > > > Applied to for-linus for v6.7, thanks, Johan! > > I've noticed that you're pretty keen on amending commit messages. > > For this series, for example, I noticed that you added an American comma > after "e.g." even though this is not expected in British English that I > (try to) use. This risks introducing inconsistencies and frankly I see no > reason for this kind of editing. British English is not an error. :) > > You also added a plus sign after the stable kernel versions in the > comments after the CC-stable tags even though this is not the right > notation for this (see the stable kernel rules). Fixed, sorry.
On Mon, Dec 11, 2023 at 12:11:53PM -0600, Bjorn Helgaas wrote: > On Mon, Dec 11, 2023 at 06:35:46PM +0100, Johan Hovold wrote: > > I've noticed that you're pretty keen on amending commit messages. > > > > For this series, for example, I noticed that you added an American comma > > after "e.g." even though this is not expected in British English that I > > (try to) use. This risks introducing inconsistencies and frankly I see no > > reason for this kind of editing. British English is not an error. :) > > > > You also added a plus sign after the stable kernel versions in the > > comments after the CC-stable tags even though this is not the right > > notation for this (see the stable kernel rules). > > Fixed, sorry. Thanks! Johan