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 CE42022215; Sun, 02 Nov 2025 15:00:42 +0000 (UTC) Received: by atuin.qyliss.net (Postfix, from userid 993) id BB8752216D; Sun, 02 Nov 2025 15:00:39 +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 fout-b6-smtp.messagingengine.com (fout-b6-smtp.messagingengine.com [202.12.124.149]) by atuin.qyliss.net (Postfix) with ESMTPS id A23F522194 for ; Sun, 02 Nov 2025 15:00:38 +0000 (UTC) Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfout.stl.internal (Postfix) with ESMTP id 2077B1D00145; Sun, 2 Nov 2025 10:00:37 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Sun, 02 Nov 2025 10:00:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alyssa.is; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm2; t=1762095636; x= 1762182036; bh=QElDFlE+/huNMJjB5RqJrxbLCfQchWY6YxveaxUdpro=; b=F YEFK1P9XL1LKQi+tiGAHXcgbUFNWILSP+oqWBoWI1pIo6gI0EfKnJMeQKv9j/CIy zwCCLWSh6dtuxH7ZQR7t3IySu9X72vjHLJfzTaJ+1h6gtTk5fWprJw+bXrTx0ty0 mYRMhnVwjnsdP/3OSVDnXBNihTz83+uw+Bb9ODXDFsEZ81JD60JphPzPdgS6+/PJ rxaZqG4dri4ls/s51GCDqwpw1tA+JYYsZ1ncQB4KJRCeOgDFEDABAKhhKdIntwkb OhCnLWbD5uX64mP8nS4clFxIU0HW6vttN/dJEsO6nDJ8Wwcq51lTpOWIYdq06Off XykDSjmvl6mU6nOqSm/Lw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :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=fm3; t=1762095636; x=1762182036; bh=Q ElDFlE+/huNMJjB5RqJrxbLCfQchWY6YxveaxUdpro=; b=bqB1jvjLi2ul0jFxB J2bzeMl8jTCxyVOqT2PeXM3XjDYxtbmhVWiVjmjO6rMD6xwCn2PZU22RQa9HQKV2 eXy6n+GoxSwdcTZFb2gS43UMuUYD8xoWlpD8yyyeHc4ZMYnf7iP6MAfvorIJIHjZ thPZ9Yz55lUQ+D4o99U5orpizhSy81CLHm79d8Lw8O1Xqs/bO/J1z2fpZZWCdTuk NDaXqMhqhYEtZA9v9MP55FElRvSE+4wKhcuTynEDISMZEmUtvoCrU72UppUBRegA YD6OfLWPAGxVIVgW8f6S0dIOA6SRzsaY95aFMZne0Gba7CeD0C3IjVZ7PFzd3ggQ MYoCg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddujeehheeiucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomheptehlhihsshgr ucftohhsshcuoehhihesrghlhihsshgrrdhisheqnecuggftrfgrthhtvghrnheptefhge eiffffleetudeuledtleeutefhueetveeiteeugfegfeduvdelgfdtfedvnecuffhomhgr ihhnpehsphgvtghtrhhumhdqohhsrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhephhhisegrlhihshhsrgdrihhspdhnsggprhgtphht thhopeefpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopeihuhhrvghkrgestgihsg gvrhgthhgrohhsrdguvghvpdhrtghpthhtohepuggvmhhiohgsvghnohhurhesghhmrghi lhdrtghomhdprhgtphhtthhopeguvghvvghlsehsphgvtghtrhhumhdqohhsrdhorhhg X-ME-Proxy: Feedback-ID: i12284293:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 2 Nov 2025 10:00:36 -0500 (EST) Received: by mbp.qyliss.net (Postfix, from userid 1000) id 1F4D663CDB3F; Sun, 02 Nov 2025 16:00:35 +0100 (CET) From: Alyssa Ross To: devel@spectrum-os.org Subject: [PATCH 2/2] host/rootfs: /etc/mdev/net/add: make idempotent Date: Sun, 2 Nov 2025 16:00:18 +0100 Message-ID: <20251102150018.1242022-2-hi@alyssa.is> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251102150018.1242022-1-hi@alyssa.is> References: <20251102150018.1242022-1-hi@alyssa.is> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: V7TUMSGQ4Z4P37QAVTPIRTC7OWYFHC65 X-Message-ID-Hash: V7TUMSGQ4Z4P37QAVTPIRTC7OWYFHC65 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: Demi Marie Obenour , Yureka Lilian 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: 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 --- 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 +# SPDX-FileCopyrightText: 2021, 2025 Alyssa Ross # 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 -- 2.51.0