From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752974AbcGTA23 (ORCPT ); Tue, 19 Jul 2016 20:28:29 -0400 Received: from cloudserver094114.home.net.pl ([79.96.170.134]:51443 "HELO cloudserver094114.home.net.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1752304AbcGTA20 (ORCPT ); Tue, 19 Jul 2016 20:28:26 -0400 From: "Rafael J. Wysocki" To: Lukas Wunner Cc: "Rafael J. Wysocki" , Marek Szyprowski , "linux-pm@vger.kernel.org" , Linux Kernel Mailing List , "open list:AMD IOMMU (AMD-VI)" , linux-samsung-soc@vger.kernel.org, "linux-arm-kernel@lists.infradead.org" , Joerg Roedel , Inki Dae , Kukjin Kim , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Ulf Hansson , Mark Brown , Greg Kroah-Hartman , "Rafael J. Wysocki" , Andreas Noever , linux-pci@vger.kernel.org Subject: Re: [PATCH v2 02/10] driver core: Functional dependencies tracking support Date: Wed, 20 Jul 2016 02:33:18 +0200 Message-ID: <1975118.iO8UCAENoH@vostro.rjw.lan> User-Agent: KMail/4.11.5 (Linux/4.5.0-rc1+; KDE/4.11.5; x86_64; ; ) In-Reply-To: <20160617140738.GA1809@wunner.de> References: <1466144820-6286-1-git-send-email-m.szyprowski@samsung.com> <20160617140738.GA1809@wunner.de> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="utf-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Friday, June 17, 2016 04:07:38 PM Lukas Wunner wrote: > On Fri, Jun 17, 2016 at 02:54:56PM +0200, Rafael J. Wysocki wrote: > > On Fri, Jun 17, 2016 at 12:36 PM, Lukas Wunner wrote: > > > On Fri, Jun 17, 2016 at 08:26:52AM +0200, Marek Szyprowski wrote: > > > > From: "Rafael J. Wysocki" > > > We also have such a functional dependency for Thunderbolt on Macs: > > > On resume from system sleep, the PCIe hotplug ports may not resume > > > before the thunderbolt driver has reestablished the PCI tunnels. > > > Currently this is enforced by quirk_apple_wait_for_thunderbolt() > > > in drivers/pci/quirks.c. It would be good if we could represent > > > this dependency using something like Rafael's approach instead of > > > open coding it, however one detail in Rafael's patches is problematic: > > > > > > > New links are added by calling device_link_add() which may happen > > > > either before the consumer device is probed or when probing it, in > > > > which case the caller needs to ensure that the driver of the > > > > supplier device is present and functional and the DEVICE_LINK_PROBE_TIME > > > > flag should be passed to device_link_add() to reflect that. > > > > > > The thunderbolt driver cannot call device_link_add() before the > > > PCIe hotplug ports are bound to a driver unless we amend portdrv > > > to return -EPROBE_DEFER for Thunderbolt hotplug ports on Macs > > > if the thunderbolt driver isn't loaded. > > > > > > It would therefore be beneficial if device_link_add() can be > > > called even *after* the consumer is bound. > > > > I don't quite follow. > > > > Who's the provider and who's the consumer here? > > thunderbolt.ko is the supplier. But it binds to the children of the ports that are supposed to be its consumers? Why is that even expected to work? Thanks, Rafael From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Return-Path: From: "Rafael J. Wysocki" To: Lukas Wunner Subject: Re: [PATCH v2 02/10] driver core: Functional dependencies tracking support Date: Wed, 20 Jul 2016 02:33:18 +0200 Message-ID: <1975118.iO8UCAENoH@vostro.rjw.lan> In-Reply-To: <20160617140738.GA1809@wunner.de> References: <1466144820-6286-1-git-send-email-m.szyprowski@samsung.com> <20160617140738.GA1809@wunner.de> MIME-Version: 1.0 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Krzysztof Kozlowski , linux-samsung-soc@vger.kernel.org, "Rafael J. Wysocki" , "linux-pm@vger.kernel.org" , Bartlomiej Zolnierkiewicz , Greg Kroah-Hartman , Joerg Roedel , "Rafael J. Wysocki" , Linux Kernel Mailing List , Inki Dae , "open list:AMD IOMMU \(AMD-VI\)" , Kukjin Kim , Mark Brown , linux-pci@vger.kernel.org, Andreas Noever , Ulf Hansson , "linux-arm-kernel@lists.infradead.org" , Marek Szyprowski Content-Type: text/plain; charset="us-ascii" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+bjorn=helgaas.com@lists.infradead.org List-ID: On Friday, June 17, 2016 04:07:38 PM Lukas Wunner wrote: > On Fri, Jun 17, 2016 at 02:54:56PM +0200, Rafael J. Wysocki wrote: > > On Fri, Jun 17, 2016 at 12:36 PM, Lukas Wunner wrote: > > > On Fri, Jun 17, 2016 at 08:26:52AM +0200, Marek Szyprowski wrote: > > > > From: "Rafael J. Wysocki" > > > We also have such a functional dependency for Thunderbolt on Macs: > > > On resume from system sleep, the PCIe hotplug ports may not resume > > > before the thunderbolt driver has reestablished the PCI tunnels. > > > Currently this is enforced by quirk_apple_wait_for_thunderbolt() > > > in drivers/pci/quirks.c. It would be good if we could represent > > > this dependency using something like Rafael's approach instead of > > > open coding it, however one detail in Rafael's patches is problematic: > > > > > > > New links are added by calling device_link_add() which may happen > > > > either before the consumer device is probed or when probing it, in > > > > which case the caller needs to ensure that the driver of the > > > > supplier device is present and functional and the DEVICE_LINK_PROBE_TIME > > > > flag should be passed to device_link_add() to reflect that. > > > > > > The thunderbolt driver cannot call device_link_add() before the > > > PCIe hotplug ports are bound to a driver unless we amend portdrv > > > to return -EPROBE_DEFER for Thunderbolt hotplug ports on Macs > > > if the thunderbolt driver isn't loaded. > > > > > > It would therefore be beneficial if device_link_add() can be > > > called even *after* the consumer is bound. > > > > I don't quite follow. > > > > Who's the provider and who's the consumer here? > > thunderbolt.ko is the supplier. But it binds to the children of the ports that are supposed to be its consumers? Why is that even expected to work? Thanks, Rafael _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Rafael J. Wysocki" Subject: Re: [PATCH v2 02/10] driver core: Functional dependencies tracking support Date: Wed, 20 Jul 2016 02:33:18 +0200 Message-ID: <1975118.iO8UCAENoH@vostro.rjw.lan> References: <1466144820-6286-1-git-send-email-m.szyprowski@samsung.com> <20160617140738.GA1809@wunner.de> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7Bit Return-path: Received: from cloudserver094114.home.net.pl ([79.96.170.134]:51443 "HELO cloudserver094114.home.net.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1752304AbcGTA20 (ORCPT ); Tue, 19 Jul 2016 20:28:26 -0400 In-Reply-To: <20160617140738.GA1809@wunner.de> Sender: linux-pm-owner@vger.kernel.org List-Id: linux-pm@vger.kernel.org To: Lukas Wunner Cc: "Rafael J. Wysocki" , Marek Szyprowski , "linux-pm@vger.kernel.org" , Linux Kernel Mailing List , "open list:AMD IOMMU (AMD-VI)" , linux-samsung-soc@vger.kernel.org, "linux-arm-kernel@lists.infradead.org" , Joerg Roedel , Inki Dae , Kukjin Kim , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Ulf Hansson , Mark Brown , Greg Kroah-Hartman , "Rafael J. Wysocki" , Andreas Noever , linux-pci@vger.kernel.org On Friday, June 17, 2016 04:07:38 PM Lukas Wunner wrote: > On Fri, Jun 17, 2016 at 02:54:56PM +0200, Rafael J. Wysocki wrote: > > On Fri, Jun 17, 2016 at 12:36 PM, Lukas Wunner wrote: > > > On Fri, Jun 17, 2016 at 08:26:52AM +0200, Marek Szyprowski wrote: > > > > From: "Rafael J. Wysocki" > > > We also have such a functional dependency for Thunderbolt on Macs: > > > On resume from system sleep, the PCIe hotplug ports may not resume > > > before the thunderbolt driver has reestablished the PCI tunnels. > > > Currently this is enforced by quirk_apple_wait_for_thunderbolt() > > > in drivers/pci/quirks.c. It would be good if we could represent > > > this dependency using something like Rafael's approach instead of > > > open coding it, however one detail in Rafael's patches is problematic: > > > > > > > New links are added by calling device_link_add() which may happen > > > > either before the consumer device is probed or when probing it, in > > > > which case the caller needs to ensure that the driver of the > > > > supplier device is present and functional and the DEVICE_LINK_PROBE_TIME > > > > flag should be passed to device_link_add() to reflect that. > > > > > > The thunderbolt driver cannot call device_link_add() before the > > > PCIe hotplug ports are bound to a driver unless we amend portdrv > > > to return -EPROBE_DEFER for Thunderbolt hotplug ports on Macs > > > if the thunderbolt driver isn't loaded. > > > > > > It would therefore be beneficial if device_link_add() can be > > > called even *after* the consumer is bound. > > > > I don't quite follow. > > > > Who's the provider and who's the consumer here? > > thunderbolt.ko is the supplier. But it binds to the children of the ports that are supposed to be its consumers? Why is that even expected to work? Thanks, Rafael From mboxrd@z Thu Jan 1 00:00:00 1970 From: rjw@rjwysocki.net (Rafael J. Wysocki) Date: Wed, 20 Jul 2016 02:33:18 +0200 Subject: [PATCH v2 02/10] driver core: Functional dependencies tracking support In-Reply-To: <20160617140738.GA1809@wunner.de> References: <1466144820-6286-1-git-send-email-m.szyprowski@samsung.com> <20160617140738.GA1809@wunner.de> Message-ID: <1975118.iO8UCAENoH@vostro.rjw.lan> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Friday, June 17, 2016 04:07:38 PM Lukas Wunner wrote: > On Fri, Jun 17, 2016 at 02:54:56PM +0200, Rafael J. Wysocki wrote: > > On Fri, Jun 17, 2016 at 12:36 PM, Lukas Wunner wrote: > > > On Fri, Jun 17, 2016 at 08:26:52AM +0200, Marek Szyprowski wrote: > > > > From: "Rafael J. Wysocki" > > > We also have such a functional dependency for Thunderbolt on Macs: > > > On resume from system sleep, the PCIe hotplug ports may not resume > > > before the thunderbolt driver has reestablished the PCI tunnels. > > > Currently this is enforced by quirk_apple_wait_for_thunderbolt() > > > in drivers/pci/quirks.c. It would be good if we could represent > > > this dependency using something like Rafael's approach instead of > > > open coding it, however one detail in Rafael's patches is problematic: > > > > > > > New links are added by calling device_link_add() which may happen > > > > either before the consumer device is probed or when probing it, in > > > > which case the caller needs to ensure that the driver of the > > > > supplier device is present and functional and the DEVICE_LINK_PROBE_TIME > > > > flag should be passed to device_link_add() to reflect that. > > > > > > The thunderbolt driver cannot call device_link_add() before the > > > PCIe hotplug ports are bound to a driver unless we amend portdrv > > > to return -EPROBE_DEFER for Thunderbolt hotplug ports on Macs > > > if the thunderbolt driver isn't loaded. > > > > > > It would therefore be beneficial if device_link_add() can be > > > called even *after* the consumer is bound. > > > > I don't quite follow. > > > > Who's the provider and who's the consumer here? > > thunderbolt.ko is the supplier. But it binds to the children of the ports that are supposed to be its consumers? Why is that even expected to work? Thanks, Rafael