X-Original-To: alpine-devel@mail.alpinelinux.org Delivered-To: alpine-devel@mail.alpinelinux.org Received: from mail.alpinelinux.org (dallas-a1.alpinelinux.org [127.0.0.1]) by mail.alpinelinux.org (Postfix) with ESMTP id 1E2BFDC053F; Mon, 27 Jul 2015 10:07:49 +0000 (UTC) Received: from ncopa-desktop.alpinelinux.org (unknown [79.160.13.133]) (using TLSv1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: n@tanael.org) by mail.alpinelinux.org (Postfix) with ESMTPSA id 8ADAEDC04B8; Mon, 27 Jul 2015 10:07:48 +0000 (UTC) Date: Mon, 27 Jul 2015 12:07:44 +0200 From: Natanael Copa To: Christoph Lohmann <20h@r-36.net> Cc: alpine-devel@lists.alpinelinux.org Subject: Re: [alpine-devel] udev replacement in Alpine Linux Message-ID: <20150727120744.4ffdfa0b@ncopa-desktop.alpinelinux.org> In-Reply-To: <20150726103211.3A0FF1025EE9D@r-36.net> References: <20150726103211.3A0FF1025EE9D@r-36.net> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-alpine-linux-musl) X-Mailinglist: alpine-devel Precedence: list List-Id: Alpine Development List-Unsubscribe: List-Post: List-Help: List-Subscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: ClamAV using ClamSMTP On Sun, 26 Jul 2015 12:10:26 +0200 Christoph Lohmann <20h@r-36.net> wrote: > Greetings. >=20 > Alan Pillay was asking me to join in on the discussion about Alpine Lin* > ux needing a udev replacement to strive more towards a KISS future of > this distribution. Hi, Thanks for joing the discussion. =20 > I am the author of nldev and nlmon, which I am using personally on my > Laptop. During this development my goal was to have a KISS solution to > the udev mess and its abstraction layers. Well, the idea never complete* > ly finished due to me being satisfied with what nldev and nlmon do and > no reason to write the biggest threat to motivation: a libudev replace* > ment. Thanks for joining. I have been doing some experiments and are using nldev code as base. > I*m just describing how device management in Linux works now: [snip]... My conclusion is that /proc/sys/kernel/hotplug is a dead end for two reasons: 1) serialization. You can get race conditions. busybox mdev has some workarounds for those but I think it is ugly. It is better solved with netlink. 2) performance. You can get a lot of forks during boot. Yes I know some people does not care if the box take 60 seconds to boot. I do care, and I believe it can be solved and still keep things simple. However, using netlink has the drawback that it requires a forever running daemon, and normally you only need it during bootup, and after that, you need it seldomly, when you plug in an usb disk, a mouse or similar. > The KISS way I imagined would be this way: nldev not just > executing mdev, but it caching the configuration file for the > speedup. That*s what smdev tries to do but it does not implement all > of the busybox mdev.conf syntax.=20 Here is what I have been thinking, and what came out of a long discussion on busybox mailing list. Implement the netlink daemon as a socket activator. When there is a new event, fork/exec the handler and pass over the socket. The handler reads the events from the socket and handles them. Set a timout on the socket and exit when there are no events withing one or two seconds. The socket activator takes over again. I have this implemented, based on nldev code: http://git.alpinelinux.org/cgit/user/ncopa/nlplug/tree/ > For compatibility reasons the > libudev*compat needs to be ripped off into a separate project so you > don*t infect smdev with systemd code. The libudev compatibility is > especially needed for X.org and dynamic uevent device discovery. This makes sense yes. I am interested in libudev comaptibility, but have not looked too much into it. I don't need full ABI compatibility, but it would be very helpful to make it easy to port current applictions who uses libudev. > What needs to be done for solving this udev problem once and for all > and have a modular replacement: > * Send in patches to smdev to have the complete busybox syntax > mdev.conf implemented so all the mdev.conf examples out there can be > reused. > * Create a repository with all kind of mdev scripts so they can be > reused. > * Rip off libudev-compat from vdev and have it a separate package, if > needed. Alternatively, we could make an alternative xorg config backend. It does not look too difficult: http://cgit.freedesktop.org/xorg/xserver/tree/config/udev.c > Please don*t use vdev. It does not follow the KISS principles and > uses C++. The namespace for gid/uid is a big hack which should be > in the kernel, as it is in Plan 9. C++ is a no-go. > I invite all interested developers to join suckless in its strive > for a better KISS future and send patches to hackers@suckless.org > for the smdev[0] project or to implement the libudev*compat or join > discussions on dev@suckless.org. I think it might make sense to do the mdev.conf parsing and event handlig from either busybox or toybox. Those toolboxes also have things like modprobe and blkid, which should make it possible to load modaliases without fork/exec and find root=3D... on /proc/cmdline. (very useful from initramfs) =20 > Sincerely, >=20 > Christoph Lohmann >=20 > [0] http://git.suckless.org/smdev/ --- Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org Help: alpine-devel+help@lists.alpinelinux.org ---