From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from atuin.qyliss.net (localhost [IPv6:::1]) by atuin.qyliss.net (Postfix) with ESMTP id 59C2F13A4C; Thu, 02 Oct 2025 10:34:49 +0000 (UTC) Received: by atuin.qyliss.net (Postfix, from userid 993) id 62F9F13A41; Thu, 02 Oct 2025 10:34:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on atuin.qyliss.net X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DMARC_MISSING,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=4.0.1 Received: from fhigh-a1-smtp.messagingengine.com (fhigh-a1-smtp.messagingengine.com [103.168.172.152]) by atuin.qyliss.net (Postfix) with ESMTPS id A18FB13A3D for ; Thu, 02 Oct 2025 10:34:45 +0000 (UTC) Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfhigh.phl.internal (Postfix) with ESMTP id A9D58140010B; Thu, 2 Oct 2025 06:34:44 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Thu, 02 Oct 2025 06:34:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alyssa.is; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1759401284; x=1759487684; bh=il1ZhyVGjw EvJnYnBHST25x/smui+TTRA1ohyS2EFv8=; b=BoMwDJgxpS6ROy3myIzZkQgTxQ TRCpKxMQ9Y9lLSH5FGOgWHUKBZL20IFmKr4R0CT60kGAquDLqZ/5bwuhs9H6D2wl cOGHA0PZbXzl9AhRQwU9AiiBdilKnz0GTUQCvD1rG/aohcSqeMf16hFBpZJlc9QK 8iz66oe6AptCQYge+ngoc3Unf0W/7u7shHxdErc0/qwzOPe38OQovGQrTrg4aa/b Vnat73VxyhrPDul4FLj8JnY2wguk8qmGQNCbA8F+nhoEJ41Vu+Ns9XKB4XDbZeC1 9IZvJcTsSOEuvJV2JTLk5pAuJl2yWys4dG3e44/M+2Ryw6/pkKLRlGB+SRug== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1759401284; x=1759487684; bh=il1ZhyVGjwEvJnYnBHST25x/smui+TTRA1o hyS2EFv8=; b=ItFJqePkeR68NKgRmiyPHom22FPyQfzgwPQQEesauh5tyMDmmqa eDVoS9Act84N2cTwQS7zx/qiUQbNeaRSiWTRekRDqmS0NUGYl7DqapBTDSz7PUFX xmm7rWvbTU7UTaTbKo7zNDei6GiylcRJxY+oqWxsLQAmpUQj6bQrDOdHezSRB0Nt RdHFsg4zpth1x+jgC0AKqvvg9O1Znq7x4YpwQ8cw/yzpg3X+EJ4urJq5HxR2BTx9 86huiRn2y5WzuCTovMrVVXxAOFqjeuAElDgvOTHVCEHIRrMtkEYumsk0unonH1Ar nhIs4xg/94uUcrfqVAtGqdK9a9b4mjoWOqg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggdekheejlecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpefhvfevufgjfhffkfggtgesghdtreertddtjeenucfhrhhomheptehlhihsshgrucft ohhsshcuoehhihesrghlhihsshgrrdhisheqnecuggftrfgrthhtvghrnhepvddttdekfe fhteefjeffiedtfeehgefhfeelteeljeettdevvdduheekffelueeinecuffhomhgrihhn pehsphgvtghtrhhumhdqohhsrdhorhhgpdhskhgrrhhnvghtrdhorhhgnecuvehluhhsth gvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhephhhisegrlhihshhsrgdr ihhspdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhope guvghmihhosggvnhhouhhrsehgmhgrihhlrdgtohhmpdhrtghpthhtohepuggvvhgvlhes shhpvggtthhruhhmqdhoshdrohhrgh X-ME-Proxy: Feedback-ID: i12284293:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 2 Oct 2025 06:34:43 -0400 (EDT) Received: by mbp.qyliss.net (Postfix, from userid 1000) id 420DA5FA4F49; Thu, 02 Oct 2025 12:34:41 +0200 (CEST) From: Alyssa Ross To: Demi Marie Obenour Subject: Re: [PATCH v3 2/2] host/rootfs: Switch to systemd-udevd In-Reply-To: <20250928-udev-v3-2-bb0e9612c415@gmail.com> References: <20250928-udev-v3-0-bb0e9612c415@gmail.com> <20250928-udev-v3-2-bb0e9612c415@gmail.com> Date: Thu, 02 Oct 2025 12:34:40 +0200 Message-ID: <87ikgxwq0v.fsf@alyssa.is> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Message-ID-Hash: 24SAIJ3RP6KFIWOAZ4AG6W4YX2Z2MY63 X-Message-ID-Hash: 24SAIJ3RP6KFIWOAZ4AG6W4YX2Z2MY63 X-MailFrom: hi@alyssa.is X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-devel.spectrum-os.org-0; header-match-devel.spectrum-os.org-1; header-match-devel.spectrum-os.org-2; header-match-devel.spectrum-os.org-3; header-match-devel.spectrum-os.org-4; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Spectrum OS Development X-Mailman-Version: 3.3.9 Precedence: list List-Id: Patches and low-level development discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Every time it's time to review this I feel intimidated, and then I end up once again being pleasantly surprised by how nice and small it is. Demi Marie Obenour writes: > The dependency on /dev/dri/card0 being present is eliminated, and > whatever devices the user has are now picked up by the compositor. New > dependencies are added to ensure that udev coldplug has finished before > any non-trivial services are started. systemd-udev-trigger.service runs > 'udevadm trigger' and has Before=3Dsysinit.target, so anything that is not > an early boot service can assume 'udevadm trigger' has run. Sorry if we already discussed this =E2=80=94 I thought I remembered bringin= g it up but can't find it now, so maybe I didn't =E2=80=94 but I've found in the= past that Weston does need /dev/dri/card0 to exist before it's started, even with udev, in the release/checks/wayland NixOS test =E2=80=94 see commit ab= 5a00b ("release/checks/wayland: add missing dependency"). Before that, the test intermittently failed, so to make sure we're not introducing a similar intermittent fault here, I'd like to understand why that's different, if it is. Do NixOS tests start running before coldplug, for example? If so, that suggests it might be okay for us to run things before coldplug too. > --- > host/rootfs/Makefile | 36 +++---- > host/rootfs/default.nix | 118 ++++++++-------= ------ > host/rootfs/image/etc/mdev.conf | 7 -- > host/rootfs/image/etc/mdev/listen | 11 -- > host/rootfs/image/etc/mdev/wait | 14 --- > host/rootfs/image/etc/s6-rc/card0/type.license | 2 - > host/rootfs/image/etc/s6-rc/card0/up | 4 - > host/rootfs/image/etc/s6-rc/kvm/timeout-up | 1 - > host/rootfs/image/etc/s6-rc/kvm/timeout-up.license | 2 - > host/rootfs/image/etc/s6-rc/kvm/type | 1 - > host/rootfs/image/etc/s6-rc/kvm/type.license | 2 - > host/rootfs/image/etc/s6-rc/kvm/up | 4 - > host/rootfs/image/etc/s6-rc/mdevd-coldplug/type | 1 - > host/rootfs/image/etc/s6-rc/mdevd-coldplug/up | 4 - > .../image/etc/s6-rc/mdevd/notification-fd.license | 2 - > host/rootfs/image/etc/s6-rc/mdevd/run | 5 - > .../contents.d/systemd-udevd-coldplug} | 0 > .../dependencies.d/systemd-udevd} | 0 > .../s6-rc/{card0 =3D> systemd-udevd-coldplug}/type | 0 > .../type.license | 0 > .../image/etc/s6-rc/systemd-udevd-coldplug/up | 3 + > .../kvm =3D> systemd-udevd/flag-essential} | 0 You said you were going to drop this? https://spectrum-os.org/lists/archives/spectrum-devel/3bc30fa7-3f40-4373-bb= 7a-1c9119d8b939@gmail.com > .../s6-rc/{mdevd =3D> systemd-udevd}/notification-fd | 0 > .../s6-rc/systemd-udevd/notification-fd.license | 2 + > host/rootfs/image/etc/s6-rc/systemd-udevd/run | 13 +++ > .../image/etc/s6-rc/{mdevd =3D> systemd-udevd}/type | 0 > .../s6-rc/{mdevd =3D> systemd-udevd}/type.license | 0 > .../contents.d/systemd-udevd-coldplug} | 0 > host/rootfs/image/etc/s6-rc/vm-env/type.license | 2 - Mistake? > .../vmm-env/contents.d/systemd-udevd-coldplug | 0 > .../weston/dependencies.d/systemd-udevd-coldplug | 0 > .../image/etc/udev/rules.d/99-spectrum.rules | 19 ++++ > host/rootfs/image/usr/bin/run-vmm | 3 + > host/rootfs/image/usr/bin/systemd-udevd | 1 + > .../{etc/mdev/net/add =3D> usr/libexec/net-add} | 0 > 35 files changed, 100 insertions(+), 157 deletions(-) > > diff --git a/host/rootfs/image/etc/s6-rc/systemd-udevd/run b/host/rootfs/= image/etc/s6-rc/systemd-udevd/run > new file mode 100644 > index 0000000000000000000000000000000000000000..8d0fd046e2d38aef9c0010fa4= 0aa7b9a57c76373 > --- /dev/null > +++ b/host/rootfs/image/etc/s6-rc/systemd-udevd/run > @@ -0,0 +1,13 @@ > +#!/bin/execlineb -P > +# SPDX-License-Identifier: EUPL-1.2+ > +# SPDX-FileCopyrightText: 2025 Demi Marie Obenour > +s6-setlock -d 4 /run/sd-notify-wrapper/systemd-udevd.lock Why do we need to specify a descriptor here? > +if { rm -f /run/sd-notify-wrapper/systemd-udevd.sock } "Note that path will be deleted if it already exists at program start time." https://skarnet.org/software/s6/s6-ipcserver-socketbinder.html > +background { > + s6-ipcserver-socketbinder -b0 -m -a 0600 /run/sd-notify-wrapper/syste= md-udevd.sock > + fdmove 1 3 > + sd-notify-adapter > +} > +fdclose 3 > +export NOTIFY_SOCKET /run/sd-notify-wrapper/systemd-udevd.sock > +systemd-udevd > diff --git a/host/rootfs/image/etc/udev/rules.d/99-spectrum.rules b/host/= rootfs/image/etc/udev/rules.d/99-spectrum.rules > new file mode 100644 > index 0000000000000000000000000000000000000000..f9047d5dabe493f21b5f27d6e= f7d44b31f9d741b > --- /dev/null > +++ b/host/rootfs/image/etc/udev/rules.d/99-spectrum.rules > @@ -0,0 +1,19 @@ > +# SPDX-License-Identifier: EUPL-1.2+ > +# SPDX-FileCopyrightText: 2025 Demi Marie Obenour > + > +# systemd-udevd has a built-in module loading feature, > +# but it seems to not work for some reason or another. > +# This works. > +ACTION!=3D"remove", ENV{MODALIAS}!=3D"", RUN+=3D"/usr/bin/modprobe -q $e= nv{MODALIAS}" > +# systemd-udevd unsets PATH, so fix that. > +ACTION=3D=3D"remove", GOTO=3D"spectrum-end" > +ENV{PCI_CLASS}!=3D"2????", GOTO=3D"spectrum-end" > + > +# net-add unbinds and rebinds the driver, so avoid calling > +# it more than once. > +IMPORT{db}=3D"SPECTRUM_DRIVER_ASSIGNED" > +ENV{SPECTRUM_DRIVER_ASSIGNED}=3D=3D"yes", GOTO=3D"spectrum-end" > +# systemd-udevd unsets PATH, so fix that. > +RUN+=3D"/usr/bin/env PATH=3D/usr/bin /usr/libexec/net-add" > +ENV{SPECTRUM_DRIVER_ASSIGNED}=3D"yes" > +LABEL=3D"spectrum-end" I'd rather this was protected against in net-add, in the way I outlined before, because that would also protect against it being run from elsewhere. > diff --git a/host/rootfs/image/usr/bin/run-vmm b/host/rootfs/image/usr/bi= n/run-vmm > index bcb6cdaf6646da6bb4970fe97f5ef03badbd66a6..00d8b0ee75311855f0b2c0686= b66616c747b68c0 100755 > --- a/host/rootfs/image/usr/bin/run-vmm > +++ b/host/rootfs/image/usr/bin/run-vmm > @@ -53,4 +53,7 @@ unexport ! > fdmove -c 3 0 > redirfd -r 0 /dev/null >=20=20 > +# Do this last so that udev has as much > +# time to set up KVM as possible. > +if { udevadm wait /dev/kvm } Doesn't need the comment IMO. Lots of this stuff is deliberately ordered already. > cloud-hypervisor --api-socket fd=3D3 > diff --git a/host/rootfs/image/usr/bin/systemd-udevd b/host/rootfs/image/= usr/bin/systemd-udevd > new file mode 120000 > index 0000000000000000000000000000000000000000..b7887eaf6dd3279116ba61d61= 3bd467598089597 > --- /dev/null > +++ b/host/rootfs/image/usr/bin/systemd-udevd > @@ -0,0 +1 @@ > +udevadm > \ No newline at end of file Do we want to just put it in usrPackages, so we get both /usr/bin/udevadm and /usr/lib/systemd/systemd-udevd without having to do anything else? --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEARYKAB0WIQRV/neXydHjZma5XLJbRZGEIw/wogUCaN5VQAAKCRBbRZGEIw/w opPEAP9zgZFCayCSjJhbfIVYPeZND4DvpODlbnflXCp+oYw69QEA1OHyJnbk7ndf Nm+fWZxNOy7at79Kkz1tBFoEvktFpQU= =qFHj -----END PGP SIGNATURE----- --=-=-=--