From nobody Fri Nov 22 08:05:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1718635289; cv=none; d=zohomail.com; s=zohoarc; b=Lg8Kw1XdWj4Ffeh+EKbDXw3XSv5h+rjTwgoq9YF4RZliOqHGJwbDiMPJ/PAEAROspDjorrfwvDC/IZLap13E01dsqVmlBOWtNpI1pCY/lcSkC7G8Xftn9I2X+XBNFfLwgtY6zqoSS7EqtIWYZf04DlbugjI2gHk3jWo+iHlbXqI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718635289; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=PuC0rrmLqc+ryhwI3RIlUNKMT7nejiT7aD4KbDKVFzk=; b=AGgzcb2JwctLhSxregyI3oCwy0PaLDyMcwgUdb64PxucG5Pn6tyl0JIkhvR/hB+r8iMsjoCnzeUYY26irYMoSWcZE/M0zGXpJ2OYShgeN8Kzuaml3YxHvU90wMiYlGTXjQcTzY1SVIWDMzgXA2U8VojYPrH9kfR/yPHDEbLIoXE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 171863528963746.33746001538066; Mon, 17 Jun 2024 07:41:29 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.742386.1149187 (Exim 4.92) (envelope-from ) id 1sJDXg-0007Go-Hx; Mon, 17 Jun 2024 14:41:08 +0000 Received: by outflank-mailman (output) from mailman id 742386.1149187; Mon, 17 Jun 2024 14:41:08 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sJDXg-0007Gh-F6; Mon, 17 Jun 2024 14:41:08 +0000 Received: by outflank-mailman (input) for mailman id 742386; Mon, 17 Jun 2024 14:41:07 +0000 Received: from mail.xenproject.org ([104.130.215.37]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sJDXf-0007Gb-K5 for xen-devel@lists.xenproject.org; Mon, 17 Jun 2024 14:41:07 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sJDXf-0000Fc-1u; Mon, 17 Jun 2024 14:41:07 +0000 Received: from lfbn-gre-1-246-234.w90-112.abo.wanadoo.fr ([90.112.203.234] helo=l14.home) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sJDXe-0003hN-NF; Mon, 17 Jun 2024 14:41:06 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xenproject.org; s=20200302mail; h=Content-Transfer-Encoding:MIME-Version: Message-Id:Date:Subject:Cc:To:From; bh=PuC0rrmLqc+ryhwI3RIlUNKMT7nejiT7aD4KbDKVFzk=; b=HSfljoc5uhBLD9x1pLkduKHPQ+ gEHWqCYCLOUcKDmamdaIAlAzkRdwGfBa8i7cfm58YwWilPOjNXZk8ZfPSbs7KeNhoEtCM4GJI6PXw uklLIQybxhZGn01WHmJ8+oALmUQZaPEmtdBbpBtU9mHnKcRukXk1Vc/O0dQkyiVMWePU=; From: Anthony PERARD To: xen-devel@lists.xenproject.org Cc: Luca Fancellu , Jan Beulich , Roger Pau Monne , Anthony PERARD Subject: [OSSTEST PATCH] preseed_base: Use "keep" NIC NamePolicy when "force-mac-address" Date: Mon, 17 Jun 2024 16:40:51 +0200 Message-Id: <20240617144051.29547-1-anthony@xenproject.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @xenproject.org) X-ZM-MESSAGEID: 1718635289982100001 Content-Type: text/plain; charset="utf-8" From: Anthony PERARD We have a few machine (arndale-*) that have a nic without mac address, so the kernel assign a random one. For those there's a flags "force-mac-address" which tells osstest to make it so that the machine changes the mac address to a predefined one at boot. This normally tells systemd rules to not use the mac address to rename the network interface as it a temporary mac, but that doesn't always work. (Machine installed by osstest should use the mac namepolicy otherwise, since 367166c32329 ("preseed_base, ts-host-install: Change NIC NamePolicy to "mac"")). Often, on the branch "linux-linus", so with more recent version of Linux, the network interface gets renamed sometime with the "mac" namepolicy which break networking. These are the kernel messages when the rename happen: > usb 1-3.2.4: new high-speed USB device number 4 using exynos-ehci > asix 1-3.2.4:1.0 (unnamed net_device) (uninitialized): invalid hw address= , using random > asix 1-3.2.4:1.0 (unnamed net_device) (uninitialized): PHY [usb-001:004:1= 0] driver [Asix Electronics AX88772A] (irq=3DPOLL) > asix 1-3.2.4:1.0 eth0: register 'asix' at usb-12110000.usb-3.2.4, ASIX AX= 88772 USB 2.0 Ethernet, 06:85:e5:95:f0:7c > usbcore: registered new device driver onboard-usb-dev > usb 1-3.2.4: USB disconnect, device number 4 > asix 1-3.2.4:1.0 eth0: unregister 'asix' usb-12110000.usb-3.2.4, ASIX AX8= 8772 USB 2.0 Ethernet > hub 1-3.2:1.0: USB hub found > hub 1-3.2:1.0: 4 ports detected > hub 1-3.2:1.0: USB hub found > hub 1-3.2:1.0: 4 ports detected > usb 1-3.2.4: new high-speed USB device number 5 using exynos-ehci > asix 1-3.2.4:1.0 (unnamed net_device) (uninitialized): PHY [usb-001:005:1= 0] driver [Asix Electronics AX88772A] (irq=3DPOLL) > Asix Electronics AX88772A usb-001:005:10: attached PHY driver (mii_bus:ph= y_addr=3Dusb-001:005:10, irq=3DPOLL) > asix 1-3.2.4:1.0 eth0: register 'asix' at usb-12110000.usb-3.2.4, ASIX AX= 88772 USB 2.0 Ethernet, 06:85:e5:95:f0:7c > asix 1-3.2.4:1.0 enx0685e595f07c: renamed from eth0 The "xenbr0" bridge is setup to use "eth0", because that was the name of the nic during setup, so with a new name for the main interface the bridge doesn't work. In order to avoid the issue, we will use the NamePolicy "keep" when there is a flag "force-mac-address", which keep the original name of the interface (eth0). That flags only works if there's a single network interface, so we can expect "eth0" to always be the same interface. Even if the problem so far exhibit only at runtime after rebooting under Xen (which is fixed by a change in preseed_base()), we will also add the policy change to the installer (change in ts-host-install), to be future proof. (The filename of the policy is to have it apply before "73-usb-net-by-mac.link" that is installed on the system.) Signed-off-by: Anthony PERARD --- Notes: CCing people mostly FYI rather than for review. =20 I would wait until the release of Xen before pushing that as the issue doesn't prevent progress of the xen-unstable branch, it just slow down a bit linux-linus, with maybe unnecessary retry. =20 I did run that, with config which hopefully replicates linux-linus branch and xen-unstable branch: =20 linux-linus: http://logs.test-lab.xenproject.org/osstest/logs/186363/ no regression =20 xen-unstable: http://logs.test-lab.xenproject.org/osstest/logs/186366/ Just one regression (test-amd64-amd64-qemuu-freebsd12-amd64) but isn't caused by the new patch. Osstest/Debian.pm | 14 +++++++++++++- ts-host-install | 16 +++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/Osstest/Debian.pm b/Osstest/Debian.pm index 3545f3fd..d974fea5 100644 --- a/Osstest/Debian.pm +++ b/Osstest/Debian.pm @@ -972,7 +972,19 @@ END # is going to be added to dom0's initrd, which is used by some gue= sts # (created with ts-debian-install). preseed_hook_installscript($ho, $sfx, - '/usr/lib/base-installer.d/', '05ifnamepolicy', <<'END'); + '/usr/lib/base-installer.d/', '05ifnamepolicy', + $ho->{Flags}{'force-mac-address'} ? <<'END' : <<'END'); +#!/bin/sh -e +linkfile=3D/target/etc/systemd/network/70-eth-keep-policy.link +mkdir -p `dirname $linkfile` +cat > $linkfile <{Suite} !~ m/lenny|squeeze|wheezy|jessie|stretch|buster/) { + if ($ho->{Flags}{'force-mac-address'}) { + # When we have to set a MAC address, make sure that the interface = keep + # the original name that the kernel give, "eth0". There should onl= y be + # one interface in the ysstem in this case, so no risk of mixup. + system_checked(qw(mkdir -p --), "$initrd_overlay.d/lib/systemd/net= work"); + file_simple_write_contents + ("$initrd_overlay.d/lib/systemd/network/70-eth-keep-policy.lin= k", + <{Suite} !~ m/lenny|squeeze|wheezy|jessie|stretch|buster/= ) { # Switch to more predictale nic name based on mac address, instead= of the # policy "onboard" which can try to set the same name ("eno1") to = two # differents nic, or "slot". New names are "enx$mac". --=20 Anthony PERARD