Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2494834rdb; Fri, 8 Dec 2023 09:39:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IGGKG44xdWQT8z6OvUqRqNCJ0U3yDktzVKDPdlFSHlzPGtVFZVs3idlQpdZD4XreUHolH/t X-Received: by 2002:aa7:8684:0:b0:6ce:725f:7da9 with SMTP id d4-20020aa78684000000b006ce725f7da9mr364795pfo.59.1702057180152; Fri, 08 Dec 2023 09:39:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702057180; cv=none; d=google.com; s=arc-20160816; b=kvtEWWiyUuA4eqPvClmjxYpsuhPPOmytVw+PDpUqO71tKjK0zjUY2Ol1dxXfFBXkwp 4wX4CTPgcXylpkEaeVmzIUESzZDq4uJf8II1xHyqcmSw7fLzuAg827KMMKXGUUhLzyTX D42kgx7WvwI/N1+IXjxKAonOPTeR886/Nf9JVdoD2niwMYG6xlrXGccxB2hLF//ihMov IBdDmW2yOkm0lZEf3go8UCVpgYRu8Gybg8Z/38UiJfG0PVsfeLM35n8w5QQgUQ+Ddu2E IrCJQvCYdryhdfNKmTEbZzCJZpEV6U5QRkapI52Yaqc82x05frgN5LRw44Il/OlQuuAR XhRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :message-id:subject:cc:to:from:date:dkim-signature; bh=GqSerCuA6whpCcoatLhRhElcGEnQ/YHQhB6PCHD/lPM=; fh=WRCvgIRFPy/rpTjKjWAaI35WvEwo9UP1GQWyfGE/fLA=; b=kQYILJY9zHZOh3yji0NeZvUcYnqRSmOS21aNysd1swKF1czRbiIbRzsBD44TQzJxwW 3aDujfnqweCiwdvichXbnm/DLYkHtzPdBRnwj2Zb0R9yk2zZ5Q5YKLadHFvWNvezuwlc 1LPlnGHhe9P/cit9gUbCDnheEouB3Mg3RCbLVDAvnBO1NHM9e9JLZucXsxMyTUaDlX4t eLhc3t+gubfshatrctLNXYmnkEwihIvNFSZEoqHNDAK524XJo178iWvnM8o/fWZYk0j6 hcWSjJdJK8eyJgHsWvs5cnYWQG/qKMhnD0RvJaXrRub/8qyvhsWaNN3xV8G3JDhA2f+e YT2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KTwcJWCd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id kq21-20020a056a004b1500b006ce7bda5f0fsi1860662pfb.314.2023.12.08.09.39.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 09:39:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KTwcJWCd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id D298B80AB1E0; Fri, 8 Dec 2023 09:39:38 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233504AbjLHRj3 (ORCPT + 99 others); Fri, 8 Dec 2023 12:39:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229811AbjLHRj2 (ORCPT ); Fri, 8 Dec 2023 12:39:28 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FE251994 for ; Fri, 8 Dec 2023 09:39:34 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A46BEC433C8; Fri, 8 Dec 2023 17:39:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702057173; bh=Z1QJunFWmvP8Ozi9c83wdN1Wu0Ksv55A8wwkLTDgsxE=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=KTwcJWCdXdJkedS9sruBSnLdKvns4uoenFlFRNHT1IyXZ5UgV0/e24pFD2gurpl7V qptyZ0rYWcTH+qGwzVFCUzyZrCXNDoeQO9L4TOFWt05no7tFPjjSTSfXiCdydoXe24 vmRgbwSZe2pyyoyB+rxHAvHib8HH5b8jGy3hBgimblIcWnpmqjkoX2l9QzMWG6wX6I Ix2iyoOlfS1LdZYMo/xrjVVVW7ylOcB7O5l7pG9SGl7SISnbNIt0CePsjL4c06Fujt HXWxLIkH3Lqu9AoIT/zO/mkFvLT7RcHLPFrtnjPxnHXvX1M32Cjr8fudI0KI5Fs7WF lfGmJcBeC4eCg== Date: Fri, 8 Dec 2023 11:39:32 -0600 From: Bjorn Helgaas To: Johan Hovold Cc: Johan Hovold , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Bjorn Helgaas , 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, stable@vger.kernel.org, Michael Bottini , "David E . Box" , Manivannan Sadhasivam , Kai-Heng Feng Subject: Re: [PATCH v2 1/6] PCI/ASPM: Add locked helper for enabling link state Message-ID: <20231208173932.GA798089@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Fri, 08 Dec 2023 09:39:39 -0800 (PST) On Fri, Dec 08, 2023 at 09:00:56AM +0100, Johan Hovold wrote: > On Thu, Dec 07, 2023 at 02:47:16PM -0600, Bjorn Helgaas wrote: > > On Tue, Nov 28, 2023 at 09:15:07AM +0100, Johan Hovold wrote: > > > Add a helper for enabling link states that can be used in contexts where > > > a pci_bus_sem read lock is already held (e.g. from pci_walk_bus()). > > > > > > This helper will be used to fix a couple of potential deadlocks where > > > the current helper is called with the lock already held, hence the CC > > > stable tag. > > > As far as I can see, we end up with pci_enable_link_state() defined > > but never called and pci_enable_link_state_locked() being called only > > by pcie-qcom.c and vmd.c. > > Correct, I mentioned this in the cover letter. Ah, right. I really don't like these exported locked/unlocked interfaces because pci_bus_sem is internal to the PCI core, and the caller shouldn't need to know or be able to specify whether it is held or not. They exist for now, but I think we should try to get rid of them. > > Can we just rename pci_enable_link_state() to > > pci_enable_link_state_locked() and assert that pci_bus_sem is held, so > > we don't end up with a function that's never used? > > That would work too. I went with adding a new helper to facilitate > stable backports and to mirror pci_disable_link_state(). The variants > are simple wrappers around the implementation so there's no real cost to > having the unused one. Makes good sense. There's no real machine cost to the unused one; I'm more concerned about the human cost here. > But it seems like you think there will never be a need to call this > helper outside of pci_walk_bus() and if so we can drop the unlocked > variant right away. > > Would you prefer basically squashing the first three patches and mark > the result for stable even though that patch will fail to apply to older > kernels as the Qualcomm bits went into -rc1? > > Or should I send a follow-on patch removing the unused helper after > merging this series? I think you did the right thing. Bjorn