From: Demi Marie Obenour <demiobenour@gmail.com>
To: Alyssa Ross <hi@alyssa.is>, devel@spectrum-os.org
Cc: Yureka Lilian <yureka@cyberchaos.dev>
Subject: Re: [PATCH 2/2] host/rootfs: /etc/mdev/net/add: make idempotent
Date: Sun, 2 Nov 2025 15:08:17 -0500 [thread overview]
Message-ID: <3c52923a-bda9-4eb2-a33b-d41a5d7b90f6@gmail.com> (raw)
In-Reply-To: <20251102150018.1242022-2-hi@alyssa.is>
[-- Attachment #1.1.1: Type: text/plain, Size: 1782 bytes --]
On 11/2/25 10:00, Alyssa Ross wrote:
> udev actions needs to be idempotent, so when we switch to udev, we
> have the choice of making this script idempotent, or doing goto hacks
> to stop udev running it more than once. I like this better.
>
> assign-devices is already idempotent, so all we need to do to achieve
> idempotency is avoid unbinding and rebinding the driver if it's
> already the right one.
>
> Link: https://spectrum-os.org/lists/archives/spectrum-devel/87ikgxwq0v.fsf@alyssa.is
> Signed-off-by: Alyssa Ross <hi@alyssa.is>
Reviewed-by: Demi Marie Obenour <demiobenour@gmail.com>
> ---
> host/rootfs/image/etc/mdev/net/add | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/host/rootfs/image/etc/mdev/net/add b/host/rootfs/image/etc/mdev/net/add
> index f343779..62c152e 100755
> --- a/host/rootfs/image/etc/mdev/net/add
> +++ b/host/rootfs/image/etc/mdev/net/add
> @@ -1,6 +1,6 @@
> #!/bin/execlineb -P
> # SPDX-License-Identifier: EUPL-1.2+
> -# SPDX-FileCopyrightText: 2021 Alyssa Ross <hi@alyssa.is>
> +# SPDX-FileCopyrightText: 2021, 2025 Alyssa Ross <hi@alyssa.is>
>
> # Assign the whole IOMMU group containing this device to the network
> # VM.
> @@ -12,6 +12,13 @@ importas -i devpath DEVPATH
> foreground {
> pipeline { ls -1 /sys${devpath}/iommu_group/devices }
> forstdin -pE device
> + if -t {
> + backtick -E driver_name {
> + backtick -E driver_path { readlink /sys/bus/pci/devices/${device}/driver }
> + basename -- $driver_path
> + }
> + test $driver_name != vfio-pci
> + }
> foreground {
> redirfd -w 2 /dev/null
> redirfd -w 1 /sys/bus/pci/devices/${device}/driver/unbind
--
Sincerely,
Demi Marie Obenour (she/her/hers)
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 7253 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2025-11-02 20:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-02 15:00 [PATCH 1/2] host/rootfs: assign-devices: silence errors Alyssa Ross
2025-11-02 15:00 ` [PATCH 2/2] host/rootfs: /etc/mdev/net/add: make idempotent Alyssa Ross
2025-11-02 20:08 ` Demi Marie Obenour [this message]
2025-11-02 20:49 ` Alyssa Ross
2025-11-02 20:09 ` [PATCH 1/2] host/rootfs: assign-devices: silence errors Demi Marie Obenour
2025-11-02 20:49 ` Alyssa Ross
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=3c52923a-bda9-4eb2-a33b-d41a5d7b90f6@gmail.com \
--to=demiobenour@gmail.com \
--cc=devel@spectrum-os.org \
--cc=hi@alyssa.is \
--cc=yureka@cyberchaos.dev \
/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.
Code repositories for project(s) associated with this public inbox
https://spectrum-os.org/git/crosvm
https://spectrum-os.org/git/doc
https://spectrum-os.org/git/mktuntap
https://spectrum-os.org/git/nixpkgs
https://spectrum-os.org/git/spectrum
https://spectrum-os.org/git/ucspi-vsock
https://spectrum-os.org/git/www
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).