From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Thierry Reding <treding@nvidia.com>
Cc: Linux PM list <linux-pm@vger.kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Alan Stern <stern@rowland.harvard.edu>,
Grant Likely <grant.likely@linaro.org>,
Mark Brown <broonie@kernel.og>, Rob Herring <robh@kernel.org>,
Tomeu Vizoso <tomeu.vizoso@collabora.com>,
Dmitry Torokhov <dtor@google.com>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Michael Turquette <mturquette@baylibre.com>
Subject: Re: [RFD] Functional dependencies between devices
Date: Mon, 09 Nov 2015 22:42:04 +0100 [thread overview]
Message-ID: <2017403.WqCaz90jK6@vostro.rjw.lan> (raw)
In-Reply-To: <20151109123202.GC23941@ulmo.nvidia.com>
[-- Attachment #1: Type: text/plain, Size: 3314 bytes --]
On Monday, November 09, 2015 01:32:04 PM Thierry Reding wrote:
> On Tue, Oct 27, 2015 at 04:24:14PM +0100, Rafael J. Wysocki wrote:
> [...]
> > There's a question about what if the supplier device is being unbound before
> > the consumer one (for example, as a result of a hotplug event). My current
> > view on that is that the consumer needs to be force-unbound in that case too,
> > but I guess I may be persuaded otherwise given sufficiently convincing
> > arguments.
>
> I think this would be a huge step towards making the kernel more robust
> with little driver or subsystem code having to be duplicated. Currently
> most provider/consumer subsystems are fragile in that there isn't proper
> reference counting. Many subsystems will happily allow you to remove any
> of the provider, regardless of whether or not it has consumers. Most of
> the subsystems will make sure that modules can't be unloaded, but beyond
> that won't be able to prevent drivers from being unbound (either when a
> device is unplugged or unbound via sysfs). Even with proper reference
> counting there is no easy way to deal with devices going away (you'd
> need some sort of revoke semantics implemented for all providers, and
> consumers must be able to handle that situation gracefully).
>
> Implementing a force-unbind policy would make this a whole lot easier.
> Dangling resources will automatically become a thing of the past. The
> downside of course is that force-unbinding consumers may not always be
> the most user-friendly course of action. Consider an SD/MMC slot that
> uses a GPIO as card-detect pin. Unbinding the provider of the GPIO
> would cause the SD/ MMC controller to be unbound, hence unmounting the
> filesystem that it provided. That filesystem might have been the root
> filesystem.
Well, the problem is that device_release_driver() cannot fail, so it
pretty much has to unbind everything that is not going to work after the
driver is unbound from the device.
> We discussed similar use-cases a while back and you proposed making the
> force-unbind policy be two-staged: reject unbind (-EBUSY) if there are
> any consumers, and force-unbind consumers if the provider was forcibly
> unbound (or caused by hot-unplug of the backing device). That sounds
> like a good compromise to me.
That can be done for bus types having device_offline/online() support,
but the number of these is quite limited at this point.
The "offline" operation, as opposed to device_release_driver(), can return
an error code to indicate that the device cannot be taken offline at this
time. So, if offlining a supplier would require offlining all consumers
of it, that may be made fail in certain situation. However, that would
require quite a bit of additional structure (and complexity) in pretty
much all bus types, so I wouldn't start with it at least.
> That said I can also imagine subsystems where a reliable mechanism is in
> place to properly hotplug and -unplug providers. The good thing about
> the functional dependencies mechanism you propose here is that it's an
> optional mechanism that drivers use from ->probe(). Subsystems where a
> better mechanism exists can simply choose to do without functional
> dependencies.
I actually think that those things are at least partly orthogonal.
Thanks,
Rafael
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2015-11-09 21:12 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-27 15:24 Rafael J. Wysocki
2015-10-27 15:20 ` Tomeu Vizoso
2015-10-28 2:15 ` Rafael J. Wysocki
2015-10-28 14:26 ` Tomeu Vizoso
2015-10-28 15:54 ` Rafael J. Wysocki
2015-10-29 0:18 ` Mark Brown
2015-10-29 14:03 ` Tomeu Vizoso
2015-10-29 14:31 ` Alan Stern
2015-10-31 2:23 ` Rafael J. Wysocki
2015-10-31 15:22 ` Alan Stern
2015-10-29 0:15 ` Mark Brown
2015-10-31 2:13 ` Rafael J. Wysocki
2015-10-31 2:40 ` Mark Brown
2015-10-30 9:50 ` Linus Walleij
2015-10-30 22:52 ` Greg Kroah-Hartman
2016-01-07 14:55 ` Tomeu Vizoso
2016-01-07 21:29 ` Greg Kroah-Hartman
2016-01-08 7:28 ` Tomeu Vizoso
2016-01-08 15:15 ` Greg Kroah-Hartman
2015-11-09 12:32 ` Thierry Reding
2015-11-09 21:42 ` Rafael J. Wysocki [this message]
2015-11-17 12:44 ` Andrzej Hajda
2015-11-18 2:17 ` Rafael J. Wysocki
2015-11-19 9:08 ` Andrzej Hajda
2015-11-19 22:04 ` Rafael J. Wysocki
2015-11-20 1:11 ` Rafael J. Wysocki
2015-11-24 14:57 ` Andrzej Hajda
2015-11-24 16:28 ` Rafael J. Wysocki
2015-11-30 7:16 ` Andrzej Hajda
2015-11-17 12:49 ` Andrzej Hajda
2015-11-17 13:55 ` Mark Brown
2015-11-19 6:50 ` Andrzej Hajda
2015-11-21 14:04 ` Mark Brown
2015-11-24 13:56 ` Andrzej Hajda
2015-11-19 13:18 ` Thierry Reding
2015-11-21 13:26 ` Mark Brown
2015-11-17 20:31 ` Alan Stern
2015-11-17 22:47 ` Mark Brown
2016-01-14 1:52 ` [RFC][PATCH 0/5] " Rafael J. Wysocki
2016-01-14 1:53 ` [RFC][PATCH 1/5] driver core: Add a wrapper around __device_release_driver() Rafael J. Wysocki
2016-01-14 1:54 ` [RFC][PATCH 2/5] driver core: Functional dependencies tracking support Rafael J. Wysocki
2016-06-08 12:48 ` Mark Brown
2016-06-08 18:12 ` Rafael J. Wysocki
2016-06-08 18:35 ` Mark Brown
2016-06-08 20:48 ` Rafael J. Wysocki
2016-06-08 22:24 ` Mark Brown
2016-01-14 1:55 ` [RFC][PATCH 3/5] PM core: Make async suspend/resume of devices use device links Rafael J. Wysocki
2016-06-08 12:59 ` Mark Brown
2016-01-14 1:56 ` [RFC][PATCH 4/5] PM core: Make runtime PM " Rafael J. Wysocki
2016-01-14 1:56 ` [RFC][PATCH 5/5] PM core: Optimize the use of device links for runtime PM Rafael J. Wysocki
2016-01-14 14:19 ` [RFC][PATCH 0/5] Functional dependencies between devices Tomeu Vizoso
2016-01-15 0:44 ` Rafael J. Wysocki
2016-06-08 12:15 ` Mark Brown
2016-06-08 17:24 ` Rafael J. Wysocki
2016-06-08 17:33 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2017403.WqCaz90jK6@vostro.rjw.lan \
--to=rjw@rjwysocki.net \
--cc=broonie@kernel.og \
--cc=dtor@google.com \
--cc=geert@linux-m68k.org \
--cc=grant.likely@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=robh@kernel.org \
--cc=stern@rowland.harvard.edu \
--cc=tomeu.vizoso@collabora.com \
--cc=treding@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®