Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4516446rdb; Tue, 12 Dec 2023 01:27:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IHVNHNlwXvEPnL5Rh/aPwcqNfLJxHRR4f33vyltiqZfc3RRc/9lJ0kp3EkB5RPjT5pKYeJ7 X-Received: by 2002:aa7:830f:0:b0:6ce:558e:de91 with SMTP id bk15-20020aa7830f000000b006ce558ede91mr2465119pfb.46.1702373225577; Tue, 12 Dec 2023 01:27:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702373225; cv=none; d=google.com; s=arc-20160816; b=beWvllNvic2Xh0gz76QqFui0ZsB7kKQBqsP085d01wwKUIEG6m6WCNNN1GWfiX0rJW Eik3Z+jBJU7MIKrvdXYY8L0fj0WqVert/pEujewdlEoTTatCGqK0xz1vil4sGwAOIi6u gm1q6dis/NDE9MYq2zTirQFgDy7A6+x72nuG1SyT9D9vKze7q08l555dfcQ16COf4ZbC +cT18krgzZEgd8mRBs6PSaZFV9HgSJKAv/EengMWusk32nZCGPNQhIkAupjckH/JUVAw Hp1KiNwVtS/Ad0Vbcir+SDqxA22CPMWFek4HJ6pV1m6Fi0gPBUQP+qKWtP1IaAyd0Uai G9aQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=ECUsk0Bxvqo4ojEF/e1TqUwJp1wrBvYG9xy+dGaheig=; fh=EGs+zHKlr32DYzzADth5HMzN9yCbScE5ybAgROVUMTw=; b=f9MhIHgDSAKVN5SAU1SuXtwMZxKI0qCSKyLQLEwaOMZKzFCcblFzkMntdeJnmuW+Oh tAuoU57MAM2Kt7Gjd8eD6EyP5UJCuW6d+N+vdIq715afR0Ae6L9dZ9v3Yagxqkqzn5aI SO3sMz8I3WgovBLiJFpVIFmsoyEvIuEK9DvzkDJqZA7eINuRrxXP+SoAhWvlTbKOZP8Q RS5ryaRc9IpUqbgn6+4kAzAJvt2H1C4rpt83Zsm5LoGz8quu8hmNAl6ZPEX1ozOwx8Cp H2IRC3m0zCzs9megARgh5Z8II0N1GZfCzdtvFcLMn7mKjfUfEkmg5/570J/jZfJ6CR2x ZtbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=jsm7tUKQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id a11-20020a634d0b000000b005c66d14abd5si7422673pgb.521.2023.12.12.01.27.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 01:27:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=jsm7tUKQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 52255809E8B7; Tue, 12 Dec 2023 01:27:00 -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 S1346260AbjLLJ0O (ORCPT + 99 others); Tue, 12 Dec 2023 04:26:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346324AbjLLJZr (ORCPT ); Tue, 12 Dec 2023 04:25:47 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82939EA; Tue, 12 Dec 2023 01:25:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1702373153; x=1733909153; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=J7oOLumnJZHBFS2dqddnZ8wo64mptqlvLB8nSpsJYv4=; b=jsm7tUKQb/17tVcTfBJUGHMxhyHTV/1s5erm7YNYBAe3bUZT2SmMQRBf RjMnzH5ma+IgxltPs8935aK2X2T5lOfEFJ+wW1w/v1gYq6QfxsPSXVyG3 u5GOPI/JKeNet5zinQ9PP1dmwIReMm4e+I8B3eLhbXcHwnKYU9T2AN1yz 9fo+D8wK+HXgzd57YNGH0/35XtMTCzBEclFyAkeAKYK2L6lWKSl1sYvp7 CEshtN69QtTnRi2VX5JWU3uQC+IQQeDr3gCKFHHYAgkFFnevgPhBxsWqX m8e0qRT3dM+rcjxjYD1ms//8Pn3ubgG7xxp4M7PWKE8tdAeD9rfYjLkeO A==; X-IronPort-AV: E=McAfee;i="6600,9927,10921"; a="1930671" X-IronPort-AV: E=Sophos;i="6.04,269,1695711600"; d="scan'208";a="1930671" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Dec 2023 01:25:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10921"; a="843847927" X-IronPort-AV: E=Sophos;i="6.04,269,1695711600"; d="scan'208";a="843847927" Received: from tdietric-mobl.ger.corp.intel.com ([10.252.32.93]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Dec 2023 01:25:46 -0800 Date: Tue, 12 Dec 2023 11:25:44 +0200 (EET) From: =?ISO-8859-15?Q?Ilpo_J=E4rvinen?= To: Bjorn Helgaas cc: Johan Hovold , Johan Hovold , Lorenzo Pieralisi , =?ISO-8859-2?Q?Krzysztof_Wilczy=F1ski?= , 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, LKML , 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 In-Reply-To: <20231208173932.GA798089@bhelgaas> Message-ID: References: <20231208173932.GA798089@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,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, 12 Dec 2023 01:27:00 -0800 (PST) On Fri, 8 Dec 2023, Bjorn Helgaas wrote: > 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. I know these were already applied but I want to correct one small misconcept that seems to be floating around thanks the misleading name... pci_enable_link_state() is not really a pair/mirror of pci_disable_link_state() despite its name. It would be better called pci_set_default_link_state() to better match what it does. -- i.