From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933628AbcFQMzG (ORCPT ); Fri, 17 Jun 2016 08:55:06 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:36744 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751309AbcFQMzD (ORCPT ); Fri, 17 Jun 2016 08:55:03 -0400 MIME-Version: 1.0 In-Reply-To: <20160617103620.GA1626@wunner.de> References: <1466144820-6286-1-git-send-email-m.szyprowski@samsung.com> <1466144820-6286-3-git-send-email-m.szyprowski@samsung.com> <20160617103620.GA1626@wunner.de> From: "Rafael J. Wysocki" Date: Fri, 17 Jun 2016 14:54:56 +0200 X-Google-Sender-Auth: 5shlnEQgU3k5n2R5C7tBDKzVlpE Message-ID: Subject: Re: [PATCH v2 02/10] driver core: Functional dependencies tracking support To: Lukas Wunner Cc: 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 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 Fri, Jun 17, 2016 at 12:36 PM, Lukas Wunner wrote: > Hi Marek, > > On Fri, Jun 17, 2016 at 08:26:52AM +0200, Marek Szyprowski wrote: >> From: "Rafael J. Wysocki" >> >> Currently, there is a problem with handling cases where functional >> dependencies between devices are involved. >> >> What I mean by a "functional dependency" is when the driver of device >> B needs both device A and its driver to be present and functional to >> be able to work. This implies that the driver of A needs to be >> working for B to be probed successfully and it cannot be unbound from >> the device before the B's driver. This also has certain consequences >> for power management of these devices (suspend/resume and runtime PM >> ordering). >> >> Add support for representing those functional dependencies between >> devices to allow the driver core to track them and act on them in >> certain cases where they matter. > > Rafael has indicated that he intends to respin this series: > https://lkml.org/lkml/2016/6/8/1061 That's OK. > 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? Thanks, Rafael 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: Fri, 17 Jun 2016 14:54:56 +0200 Message-ID: References: <1466144820-6286-1-git-send-email-m.szyprowski@samsung.com> <1466144820-6286-3-git-send-email-m.szyprowski@samsung.com> <20160617103620.GA1626@wunner.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20160617103620.GA1626-JFq808J9C/izQB+pC5nmwQ@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Lukas Wunner Cc: Krzysztof Kozlowski , linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, "Rafael J. Wysocki" , "linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , Greg Kroah-Hartman , Bartlomiej Zolnierkiewicz , Linux Kernel Mailing List , Inki Dae , "open list:AMD IOMMU (AMD-VI)" , Kukjin Kim , Mark Brown , Andreas Noever , Ulf Hansson , "linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org" List-Id: linux-pm@vger.kernel.org On Fri, Jun 17, 2016 at 12:36 PM, Lukas Wunner wrote: > Hi Marek, > > On Fri, Jun 17, 2016 at 08:26:52AM +0200, Marek Szyprowski wrote: >> From: "Rafael J. Wysocki" >> >> Currently, there is a problem with handling cases where functional >> dependencies between devices are involved. >> >> What I mean by a "functional dependency" is when the driver of device >> B needs both device A and its driver to be present and functional to >> be able to work. This implies that the driver of A needs to be >> working for B to be probed successfully and it cannot be unbound from >> the device before the B's driver. This also has certain consequences >> for power management of these devices (suspend/resume and runtime PM >> ordering). >> >> Add support for representing those functional dependencies between >> devices to allow the driver core to track them and act on them in >> certain cases where they matter. > > Rafael has indicated that he intends to respin this series: > https://lkml.org/lkml/2016/6/8/1061 That's OK. > 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? Thanks, Rafael From mboxrd@z Thu Jan 1 00:00:00 1970 From: rafael@kernel.org (Rafael J. Wysocki) Date: Fri, 17 Jun 2016 14:54:56 +0200 Subject: [PATCH v2 02/10] driver core: Functional dependencies tracking support In-Reply-To: <20160617103620.GA1626@wunner.de> References: <1466144820-6286-1-git-send-email-m.szyprowski@samsung.com> <1466144820-6286-3-git-send-email-m.szyprowski@samsung.com> <20160617103620.GA1626@wunner.de> Message-ID: To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Fri, Jun 17, 2016 at 12:36 PM, Lukas Wunner wrote: > Hi Marek, > > On Fri, Jun 17, 2016 at 08:26:52AM +0200, Marek Szyprowski wrote: >> From: "Rafael J. Wysocki" >> >> Currently, there is a problem with handling cases where functional >> dependencies between devices are involved. >> >> What I mean by a "functional dependency" is when the driver of device >> B needs both device A and its driver to be present and functional to >> be able to work. This implies that the driver of A needs to be >> working for B to be probed successfully and it cannot be unbound from >> the device before the B's driver. This also has certain consequences >> for power management of these devices (suspend/resume and runtime PM >> ordering). >> >> Add support for representing those functional dependencies between >> devices to allow the driver core to track them and act on them in >> certain cases where they matter. > > Rafael has indicated that he intends to respin this series: > https://lkml.org/lkml/2016/6/8/1061 That's OK. > 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? Thanks, Rafael