supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
From: "Laurent Bercot" <ska-supervision@skarnet.org>
To: "Casper Ti. Vector" <caspervector@gmail.com>,
	supervision@list.skarnet.org
Subject: Re: mdevd / udevd issues, and the issue of "reverse" dependencies
Date: Mon, 10 Feb 2020 20:02:44 +0000	[thread overview]
Message-ID: <em60001543-4f1c-4a7c-b269-483aa7188257@elzian> (raw)
In-Reply-To: <20200210171943.tzjltctjry2iqysx@caspervector>

>This has obvious benefits, at least for now.  udevd does not have
>a readiness notification mechanism (polling for the existence of
>/run/udev/control surely does not count)

There is no fundamental reason why it doesn't. inotify works on tmpfs;
you don't need to poll for the existence of /run/udev/control, you can
inotifywait for its appearance.


>  and s6's fd-based mechanism does not integrate well with the shell

That is true, but I shamelessly chalk that up to the shell's
limitations: the shell can't create anonymous pipes outside of a
pipeline, and it can't make a pipeline without forking both the reader
and the writer. It's a terrible tool when you need semi-serious
plumbing work.


>  (Another issue, currently unsolved,
>is that mdevd does not have a "udevadm settle" equivalent, so that in
>theory we are not sure the basic devices are fully coldplugged when
>`mdevd-coldplug' exits.)

Funny you should mention that, it's the very problem I've been hitting
last week :)

It would be quite difficult to add a "udevadm settle" to mdevd. It
would require a communication channel with the outside (a fifodir?), and
heuristics to guesstimate when the coldplug starts and when it stops,
which I'm not sure could be made reliable in all cases. To be fully
reliable, the mechanism would need synchronization with the coldplugger,
and at this point we're well on our way to duplicating the bloat of
udevd.

However, depending on the kind of device you're waiting for, it may be
possible to avoid the race for that device. I needed to wait for a
network interface to appear after the coldplug, so I wrote a tool that
does just that: bcnm-waitif, in the bcnm package. (Documentation coming
soon.) So at least network interfaces are covered now.


>In the above, you have seen that I switched from `devd' depending on
>`devices' to the converse.  Suppose the problem of handling readiness in
>the shell could be done in a "magically simple" way, I would personally
>prefer the original way.

I don't understand why you'd prefer the original way. The natural and
normal way of proceeding is 1. start the daemon that processes the
uevents, 2. trigger the initial hardware scan that produces a big
batch of uevents. You don't need a temporary devd when you can just
start the real one; if the interfaces around the existing devd
implementations make it difficult to start properly, that's what should
be fixed.

--
Laurent



       reply	other threads:[~2020-02-10 20:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200210171943.tzjltctjry2iqysx@caspervector>
2020-02-10 20:02 ` Laurent Bercot [this message]
2020-02-11  1:41   ` Casper Ti. Vector
2020-02-10 17:19 Casper Ti. Vector

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=em60001543-4f1c-4a7c-b269-483aa7188257@elzian \
    --to=ska-supervision@skarnet.org \
    --cc=caspervector@gmail.com \
    --cc=supervision@list.skarnet.org \
    /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;
as well as URLs for NNTP newsgroup(s).