From nobody Sat Sep 26 21:37:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1789408499; cv=none; d=zohomail.com; s=zohoarc; b=MKFIOgVxk38F/9exGAckagRCvv5UqHEj1Cp2xS6ebNAvrV/Ft/TW0KV0c6LB4NfNqDr1DhL9aurOs5huLE1UohXzyjG71s3H/yPLUk1rHQ0nNagV8YG8vAH2x0mHkE4Kgqo6AsgWh+GCiapnb7clOwyi8Lvw9utKcbQZCiQ8Cb8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789408499; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=xCrbn2dhFVtP0JzTAdE2S3sCGopvnDv2Q5b6BMTFkEc=; b=aAY1syUfihkRF9AsGjlqnw60CxUhMoXuPIHZEKbp/zYWv2gH9XplbTo1JJZSBg6gOcB/C0uJEsf2VE8NaxlHAdiEXn8tfmQ+NQ5CxmoOhBxRBAHbFDdbHGUD3CiQRFgYdn/7S/Hwh7BXF9K1Gwq2AjBr6ovaRcqHUCuGcOMELtw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 178940849848132.20761733297843; Mon, 14 Sep 2026 10:54:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6At4-00051P-FJ; Mon, 14 Sep 2026 13:54:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x6Asf-0004vB-0j for qemu-devel@nongnu.org; Mon, 14 Sep 2026 13:54:16 -0400 Received: from forwardcorp1a.mail.yandex.net ([2a02:6b8:c0e:500:1:45:d181:df01]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x6AsX-0000Ih-GP for qemu-devel@nongnu.org; Mon, 14 Sep 2026 13:54:11 -0400 Received: from mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net [IPv6:2a02:6b8:c18:1d16:0:640:f28c:0]) by forwardcorp1a.mail.yandex.net (postfix) with ESMTPS id 30507C0ACD; Mon, 14 Sep 2026 20:53:56 +0300 (MSK) Received: from i115954770.yandex-team.ru (unknown [2a02:6bf:8080:a2b::1:d]) by mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net (smtpcorp) with ESMTPSA id rrX9s30iEKo0-eKlKd2LG; Mon, 14 Sep 2026 20:53:55 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1789408435; bh=xCrbn2dhFVtP0JzTAdE2S3sCGopvnDv2Q5b6BMTFkEc=; h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From; b=RwA8HmQfT5+izHoAY6ej4Uk9m04UQkHe5StPamqnNrPK88IRUSj5jDSJ+hU23w/9i P7PN6X6nOtJyiekMgGJIQKjgcWKPKWHX7CnTF1n3HTwUIA1diuHRhBpSy035/GZbSC wiYZLtxOxq2zHNKe6GVZchoPVj39XVAMqIbEVhpU= Authentication-Results: mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: mst@redhat.com, jasowang@redhat.com Cc: pbonzini@redhat.com, zhao1.liu@intel.com, peterx@redhat.com, farosas@suse.de, qemu-devel@nongnu.org, vsementsov@yandex-team.ru Subject: [PATCH 1/5] tests/functional: add test_tap_migration Date: Mon, 14 Sep 2026 20:53:47 +0300 Message-ID: <20260914175351.393680-2-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260914175351.393680-1-vsementsov@yandex-team.ru> References: <20260914175351.393680-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2a02:6b8:c0e:500:1:45:d181:df01; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1a.mail.yandex.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1789408502216158500 Content-Type: text/plain; charset="utf-8" Add test for a new local-migration migration of virtio-net/tap, with fd passing through UNIX socket. Signed-off-by: Vladimir Sementsov-Ogievskiy --- tests/functional/x86_64/meson.build | 1 + tests/functional/x86_64/test_tap_migration.py | 425 ++++++++++++++++++ 2 files changed, 426 insertions(+) create mode 100755 tests/functional/x86_64/test_tap_migration.py diff --git a/tests/functional/x86_64/meson.build b/tests/functional/x86_64/= meson.build index 0353b2af8e1..62541492397 100644 --- a/tests/functional/x86_64/meson.build +++ b/tests/functional/x86_64/meson.build @@ -51,4 +51,5 @@ tests_x86_64_system_thorough =3D [ 'virtio_balloon', 'virtio_gpu', 'rebuild_vmfd', + 'tap_migration', ] diff --git a/tests/functional/x86_64/test_tap_migration.py b/tests/function= al/x86_64/test_tap_migration.py new file mode 100755 index 00000000000..a34bd94fd25 --- /dev/null +++ b/tests/functional/x86_64/test_tap_migration.py @@ -0,0 +1,425 @@ +#!/usr/bin/env python3 +# +# Functional test that tests TAP local migration +# with fd passing +# +# Copyright (c) Yandex Technologies LLC, 2026 +# +# SPDX-License-Identifier: GPL-2.0-or-later + +import os +import time +import subprocess +from subprocess import run +import signal +import ctypes +import ctypes.util +import unittest +from contextlib import contextmanager, ExitStack + +from qemu_test import ( + LinuxKernelTest, + Asset, + exec_command_and_wait_for_pattern, + skipIfMissingCommands, +) +from qemu_test.decorators import skipWithoutSudo + + +GUEST_IP =3D "192.168.100.2" +GUEST_IP_MASK =3D f"{GUEST_IP}/24" +GUEST_MAC =3D "d6:0d:75:f8:0f:b7" +HOST_IP =3D "192.168.100.1" +HOST_IP_MASK =3D f"{HOST_IP}/24" +TAP_ID =3D "tap0" +TAP_ID2 =3D "tap1" +TAP_MAC =3D "e6:1d:44:b5:03:5d" +NETNS =3D f"qemu_test_ns_{os.getpid()}" + + +def ip(args, check=3DTrue) -> None: + """Run ip command with sudo""" + run(["sudo", "ip"] + args, check=3Dcheck) + + +@contextmanager +def switch_netns(netns_name): + libc =3D ctypes.CDLL(ctypes.util.find_library("c")) + netns_path =3D f"/var/run/netns/{netns_name}" + + def switch_to_fd(fd, check: bool =3D False): + """Switch to netns by file descriptor""" + sys_setns =3D 308 + clone_newnet =3D 0x40000000 + ret =3D libc.syscall(sys_setns, fd, clone_newnet) + if check and ret !=3D 0: + raise RuntimeError("syscall SETNS failed") + + with ExitStack() as stack: + original_netns_fd =3D os.open("/proc/self/ns/net", os.O_RDONLY) + stack.callback(os.close, original_netns_fd) + + ip(["netns", "add", netns_name]) + stack.callback(ip, ["netns", "del", netns_name], check=3DFalse) + + new_netns_fd =3D os.open(netns_path, os.O_RDONLY) + stack.callback(os.close, new_netns_fd) + + switch_to_fd(new_netns_fd) + stack.callback(switch_to_fd, original_netns_fd, check=3DFalse) + + yield + + +def del_tap(tap_name: str =3D TAP_ID) -> None: + ip(["tuntap", "del", tap_name, "mode", "tap", "multi_queue"], check=3D= False) + + +def init_tap(tap_name: str =3D TAP_ID, with_ip: bool =3D True) -> None: + ip(["tuntap", "add", "dev", tap_name, "mode", "tap", "multi_queue"]) + if with_ip: + ip(["link", "set", "dev", tap_name, "address", TAP_MAC]) + ip(["addr", "add", HOST_IP_MASK, "dev", tap_name]) + ip(["link", "set", tap_name, "up"]) + + +def switch_network_to_tap2() -> None: + ip(["link", "set", TAP_ID2, "down"]) + ip(["link", "set", TAP_ID, "down"]) + ip(["addr", "delete", HOST_IP_MASK, "dev", TAP_ID]) + ip(["link", "set", "dev", TAP_ID2, "address", TAP_MAC]) + ip(["addr", "add", HOST_IP_MASK, "dev", TAP_ID2]) + ip(["link", "set", TAP_ID2, "up"]) + + +def parse_ping_line(line: str) -> float: + # suspect lines like + # [1748524876.590509] 64 bytes from 94.245.155.3 \ + # (94.245.155.3): icmp_seq=3D1 ttl=3D250 time=3D101 ms + spl =3D line.split() + return float(spl[0][1:-1]) + + +def parse_ping_output(out) -> float: + lines =3D [x for x in out.split("\n") if x.startswith("[")] + + max_gap =3D 0.0 + prev_timestamp =3D None + + for line in lines: + if "no ans" not in line: + # This is a successful ping line + try: + timestamp =3D parse_ping_line(line) + if prev_timestamp is not None: + gap =3D timestamp - prev_timestamp + if gap > max_gap: + max_gap =3D gap + prev_timestamp =3D timestamp + except (IndexError, ValueError): + # Skip malformed lines + continue + + assert prev_timestamp is not None, "No successful pings found" + assert max_gap > 0.0, "Need at least two successful pings to calculate= gap" + + return max_gap + + +def wait_migration_finish(source_vm, target_vm): + migr_events =3D ( + ("MIGRATION", {"data": {"status": "completed"}}), + ("MIGRATION", {"data": {"status": "failed"}}), + ) + + source_e =3D source_vm.events_wait(migr_events)["data"] + target_e =3D target_vm.events_wait(migr_events)["data"] + + source_s =3D source_vm.cmd("query-status")["status"] + target_s =3D target_vm.cmd("query-status")["status"] + + assert ( + source_e["status"] =3D=3D "completed" + and target_e["status"] =3D=3D "completed" + and source_s =3D=3D "postmigrate" + and target_s =3D=3D "paused" + ), f"""Migration failed: + SRC status: {source_s} + SRC event: {source_e} + TGT status: {target_s} + TGT event:{target_e}""" + + +@skipIfMissingCommands("ip", "ping") +@skipWithoutSudo() +class TAPFdMigration(LinuxKernelTest): + ASSET_ALPINE_ISO =3D Asset( + ( + "https://dl-cdn.alpinelinux.org/" + "alpine/v3.22/releases/x86_64/alpine-standard-3.22.1-x86_64.is= o" + ), + "96d1b44ea1b8a5a884f193526d92edb4676054e9fa903ad2f016441a0fe13089", + ) + + @classmethod + def setUpClass(cls): + super().setUpClass() + + # The test namespace has no external connectivity. + cls.ASSET_ALPINE_ISO.fetch() + + try: + cls.netns_context =3D switch_netns(NETNS) + cls.netns_context.__enter__() + except (OSError, subprocess.CalledProcessError) as e: + raise unittest.SkipTest(f"can't switch network namespace: {e}") + + @classmethod + def tearDownClass(cls): + if hasattr(cls, "netns_context"): + cls.netns_context.__exit__(None, None, None) + super().tearDownClass() + + def setUp(self): + super().setUp() + + self.require_accelerator("kvm") + self.set_machine("q35") + + self.setup_shared_memory() + + init_tap() + + self.outer_ping_proc =3D None + + def tearDown(self): + with ExitStack() as stack: + stack.callback(super().tearDown) + + if self.shm_path: + stack.callback(lambda p: (os.unlink(p) if os.path.exists(p) + else None), + self.shm_path) + self.shm_path =3D None + + stack.callback(del_tap, TAP_ID2) + stack.callback(del_tap, TAP_ID) + + if self.outer_ping_proc: + self.stop_outer_ping() + + def start_outer_ping(self) -> None: + assert self.outer_ping_proc is None + self.outer_ping_log =3D self.scratch_file("ping.log") + with open(self.outer_ping_log, "w", encoding=3D"utf-8") as f: + self.outer_ping_proc =3D subprocess.Popen( + ["sudo", "ping", "-i", "0", "-O", "-D", GUEST_IP], + text=3DTrue, + stdout=3Df, + ) + + def stop_outer_ping(self) -> str: + assert self.outer_ping_proc + self.outer_ping_proc.send_signal(signal.SIGINT) + + self.outer_ping_proc.communicate(timeout=3D5) + self.outer_ping_proc =3D None + + with open(self.outer_ping_log, encoding=3D"utf-8") as f: + return f.read() + + def stop_ping_and_check(self): + ping_res =3D self.stop_outer_ping() + + disconnect_time =3D parse_ping_output(ping_res) + if disconnect_time > 0.5: + self.fail(f"long disconnect time: {disconnect_time}") + + def one_ping_from_guest(self, vm) -> None: + exec_command_and_wait_for_pattern( + self, + f"ping -c 1 -W 1 {HOST_IP}", + "1 packets transmitted, 1 packets received", + "1 packets transmitted, 0 packets received", + vm=3Dvm, + ) + self.wait_for_console_pattern("# ", vm=3Dvm) + + def one_ping_from_host(self) -> None: + run( + ["ping", "-c", "1", "-W", "1", GUEST_IP], + stdout=3Dsubprocess.DEVNULL, + check=3DTrue, + ) + + def setup_shared_memory(self): + self.shm_path =3D f"/dev/shm/qemu_test_{os.getpid()}" + + try: + with open(self.shm_path, "wb") as f: + f.write(b"\0" * (1024 * 1024 * 1024)) # 1GB + except OSError as e: + self.fail(f"Failed to create shared memory file: {e}") + + def prepare_vm(self, vm, shm_path, incoming): + if not vm: + vm =3D self.vm + + vm.set_console() + vm.add_args("-accel", "kvm") + vm.add_args("-device", "pcie-pci-bridge,id=3Dpci.1,bus=3Dpcie.0") + vm.add_args("-m", "1G") + vm.add_args("-net", "none") + + vm.add_args( + "-object", + f"memory-backend-file,id=3Dram0,size=3D1G,mem-path=3D{shm_path= },share=3Don", + ) + vm.add_args("-machine", "memory-backend=3Dram0") + + vm.add_args( + "-drive", + f"file=3D{self.ASSET_ALPINE_ISO.fetch()},media=3Dcdrom,format= =3Draw", + ) + + vm.add_args("-S") + + if incoming: + vm.add_args("-incoming", "defer") + + def add_virtio_net( + self, vm, vhost: bool, tap_name: str, local: bool, incoming: bool + ): + netdev_params =3D { + "id": "netdev.1", + "vhost": vhost, + "type": "tap", + "queues": 4, + "script": "no", + "downscript": "no", + "x-permit-local-migration": local, + } + + if not (local and incoming): + netdev_params["vnet_hdr"] =3D True + netdev_params["ifname"] =3D tap_name + + vm.cmd("netdev_add", netdev_params) + + vm.cmd( + "device_add", + driver=3D"virtio-net-pci", + romfile=3D"", + id=3D"vnet.1", + netdev=3D"netdev.1", + mq=3DTrue, + vectors=3D18, + bus=3D"pci.1", + mac=3DGUEST_MAC, + disable_legacy=3D"off", + ) + + def set_migration_capabilities(self, vm, local): + vm.cmd( + "migrate-set-capabilities", + { + "capabilities": [ + {"capability": "events", "state": True}, + {"capability": "x-ignore-shared", "state": True}, + ] + }, + ) + vm.cmd("migrate-set-parameters", {"local": local}) + + def setup_guest_network(self) -> None: + exec_command_and_wait_for_pattern(self, "ip addr", "# ") + exec_command_and_wait_for_pattern( + self, + f"ip addr add {GUEST_IP_MASK} dev eth0 && " + "ip link set eth0 up && echo OK", + "OK", + ) + self.wait_for_console_pattern("# ") + + def migrate(self, vm, mig_sock): + vm.cmd("migrate", uri=3Df"unix:{mig_sock}") + + def do_test_tap_fd_migration(self, vhost, local=3DTrue): + socket_dir =3D self.socket_dir() + mig_sock =3D os.path.join(socket_dir.name, "mig.sock") + + # Setup second TAP if needed + if not local: + del_tap(TAP_ID2) + init_tap(TAP_ID2, with_ip=3DFalse) + + self.prepare_vm(self.vm, self.shm_path, False) + self.vm.launch() + self.set_migration_capabilities(self.vm, local=3Dlocal) + self.add_virtio_net(self.vm, vhost, TAP_ID, local, incoming=3DFals= e) + + self.vm.cmd("cont") + self.wait_for_console_pattern("login:") + exec_command_and_wait_for_pattern(self, "root", "# ") + + self.setup_guest_network() + + self.one_ping_from_guest(self.vm) + self.one_ping_from_host() + self.start_outer_ping() + + # Get some successful pings before migration + time.sleep(0.5) + + target_vm =3D self.get_vm(name=3D"target") + self.prepare_vm(target_vm, self.shm_path, True) + + target_vm.launch() + if not local: + tap_name =3D TAP_ID2 + else: + tap_name =3D TAP_ID + self.set_migration_capabilities(target_vm, local=3Dlocal) + self.add_virtio_net(target_vm, vhost, tap_name, local, incoming=3D= True) + + target_vm.cmd("migrate-incoming", {"uri": f"unix:{mig_sock}"}) + + self.log.info("Starting migration") + self.migrate(self.vm, mig_sock) + + self.log.info("Waiting for migration completion") + wait_migration_finish(self.vm, target_vm) + + # Switch network to tap1 if not using local-migration + if not local: + switch_network_to_tap2() + + target_vm.cmd("cont") + + self.log.info("Verifying PING on target VM after migration") + + # Keep the stopped source alive while checking the target. + time.sleep(0.3) + self.stop_ping_and_check() + + self.one_ping_from_guest(target_vm) + self.one_ping_from_host() + + self.vm.shutdown() + target_vm.shutdown() + + def test_tap_fd_migration(self): + self.do_test_tap_fd_migration(False) + + def test_tap_fd_migration_vhost(self): + self.do_test_tap_fd_migration(True) + + def test_tap_new_tap_migration(self): + self.do_test_tap_fd_migration(False, local=3DFalse) + + def test_tap_new_tap_migration_vhost(self): + self.do_test_tap_fd_migration(True, local=3DFalse) + + +if __name__ =3D=3D "__main__": + LinuxKernelTest.main() --=20 2.43.0 From nobody Sat Sep 26 21:37:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1789408504; cv=none; d=zohomail.com; s=zohoarc; b=dRlOCNgHoRijl0iaA+52eYrdCOJtX93CZr9VjqtyAV15li/P32Szt4E0YoTznTEd6/UdnsxkoLji9xDCahIz84xLSfdjEADnVgkNfzNxw4Ob8a85KNYqbSGUloV6SOjMKtp5Fj84N8BVmAIipOIOTPnH9vz+qK+1z4p2F1qQtM0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789408504; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=hF/+wVRAyIB/gBpuoyjJv9bboAzjjKe0ul2q5jIbrWA=; b=BrCshV0fzVaFVdEGRCX9Fh2VxdgQ4S4R3OBG6aL6ohcaucEinj3uU1+OvO9Sr/S0NmnAljRUleokIQhNAZL10Gx5U2shSUUVi09de2qjDnPpEuK78+I7UwP1BpHCQClhyehyIqe1iOojxyoAND5BoodboogInNQpfBq98gZR/ig= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1789408504437924.616522589764; Mon, 14 Sep 2026 10:55:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6At2-0004zg-Jv; Mon, 14 Sep 2026 13:54:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x6Asf-0004vD-1a for qemu-devel@nongnu.org; Mon, 14 Sep 2026 13:54:16 -0400 Received: from forwardcorp1a.mail.yandex.net ([2a02:6b8:c0e:500:1:45:d181:df01]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x6AsX-0000Ii-Gb for qemu-devel@nongnu.org; Mon, 14 Sep 2026 13:54:12 -0400 Received: from mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net [IPv6:2a02:6b8:c18:1d16:0:640:f28c:0]) by forwardcorp1a.mail.yandex.net (postfix) with ESMTPS id 31F7FC0ACF; Mon, 14 Sep 2026 20:53:57 +0300 (MSK) Received: from i115954770.yandex-team.ru (unknown [2a02:6bf:8080:a2b::1:d]) by mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net (smtpcorp) with ESMTPSA id rrX9s30iEKo0-gWyxg7YT; Mon, 14 Sep 2026 20:53:56 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1789408436; bh=hF/+wVRAyIB/gBpuoyjJv9bboAzjjKe0ul2q5jIbrWA=; h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From; b=K6hbpwTi1SN6AMDi12PCESMf8vfE1E3b9/ACDfCAhCOCbqsceGOK4D/4Z0Kel0dQA DZlSDRvAdoqke/FIGAfWTN+Zw6WlzRrN2qrskjffMJwNjXkDfxSi6+0gQy2zyJ3egu TGizeNjuTTeS+Ssn+7shFEVdKtYXmYQQXjAXxsxc= Authentication-Results: mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: mst@redhat.com, jasowang@redhat.com Cc: pbonzini@redhat.com, zhao1.liu@intel.com, peterx@redhat.com, farosas@suse.de, qemu-devel@nongnu.org, vsementsov@yandex-team.ru Subject: [PATCH 2/5] net/tap: tap_post_load(): poll only on success Date: Mon, 14 Sep 2026 20:53:48 +0300 Message-ID: <20260914175351.393680-3-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260914175351.393680-1-vsementsov@yandex-team.ru> References: <20260914175351.393680-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2a02:6b8:c0e:500:1:45:d181:df01; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1a.mail.yandex.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1789408507726158500 Content-Type: text/plain; charset="utf-8" We shouldn't call tap_read_poll() if s->fd < 0. Let's move tap_read_poll() to the end, after check and vhost initialization. Fixes: c4d884bb54441 "net/tap: support local migration with virtio-net" Signed-off-by: Vladimir Sementsov-Ogievskiy --- net/tap.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/tap.c b/net/tap.c index d71e3dd1175..8039b4e388c 100644 --- a/net/tap.c +++ b/net/tap.c @@ -490,8 +490,6 @@ static bool tap_post_load(void *opaque, int version_id,= Error **errp) ERRP_GUARD(); TAPState *s =3D opaque; =20 - tap_read_poll(s, true); - if (s->fd < 0) { error_setg(errp, "FD was not loaded during incoming migration"); return false; @@ -503,6 +501,7 @@ static bool tap_post_load(void *opaque, int version_id,= Error **errp) return false; } =20 + tap_read_poll(s, true); return true; } =20 --=20 2.43.0 From nobody Sat Sep 26 21:37:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1789408489; cv=none; d=zohomail.com; s=zohoarc; b=dn3D7Ny+/Mss9zQWhbqoQc1L5cnEMtqwoOVK5frq3uOlFmdgncX0IecJmJ6zGpIKrn43roiqgL1d5O3MC1NmeDcNOz6Hpgl56j3BvNJc8UvrxUm9e9HxLxIiizYWMZq4M90zKVtfsR1IHES6zIswFsaIGT5PU5hggbnWRdNGWWw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789408489; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=6go+1Xcg8Pl3hrmsUD3GeF4Vmhuk1XeJThFFcM2XAOA=; b=n1ZQ+UzsED+WMz60W3+KTSULunHmK80KPTJyfDKiB3QLfG9D8dQEmRrtaL/LYjRahyjABSDfmWxProJIUN7GwJreXyxMy1YUnxG40JrXAofUxTxY5fKIcPnXPvGPtoCrvsUxn9MwG6zDUvrjJgSONKgifNsot3ba+V+yEQhmv3I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1789408488541922.3352373998649; Mon, 14 Sep 2026 10:54:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6Ass-0004wd-2P; Mon, 14 Sep 2026 13:54:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x6Asf-0004vA-0e for qemu-devel@nongnu.org; Mon, 14 Sep 2026 13:54:16 -0400 Received: from forwardcorp1a.mail.yandex.net ([178.154.239.72]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x6AsX-0000Im-Gi for qemu-devel@nongnu.org; Mon, 14 Sep 2026 13:54:12 -0400 Received: from mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net [IPv6:2a02:6b8:c18:1d16:0:640:f28c:0]) by forwardcorp1a.mail.yandex.net (postfix) with ESMTPS id 5F922C0AD5; Mon, 14 Sep 2026 20:53:58 +0300 (MSK) Received: from i115954770.yandex-team.ru (unknown [2a02:6bf:8080:a2b::1:d]) by mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net (smtpcorp) with ESMTPSA id rrX9s30iEKo0-ywIJsNmr; Mon, 14 Sep 2026 20:53:57 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1789408437; bh=6go+1Xcg8Pl3hrmsUD3GeF4Vmhuk1XeJThFFcM2XAOA=; h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From; b=NdVPFl1PFy3vnHOR3sY7fw0UZimyIs6A10JF6/raOjkvJqveD2fYoYIiW/T7hMQSO /AlvyyO5MvX+PnLIatW0UAW0snwu8JixBUUDC3BCYfXpmzsBu4pkKvyVGOUyVgGJRE q1nXsh3OCx5xsWAhx4pOJmKZbJqlpUjOCtqI8jRE= Authentication-Results: mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: mst@redhat.com, jasowang@redhat.com Cc: pbonzini@redhat.com, zhao1.liu@intel.com, peterx@redhat.com, farosas@suse.de, qemu-devel@nongnu.org, vsementsov@yandex-team.ru Subject: [PATCH 3/5] hw/net: finish backend initialization earler for local migration Date: Mon, 14 Sep 2026 20:53:49 +0300 Message-ID: <20260914175351.393680-4-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260914175351.393680-1-vsementsov@yandex-team.ru> References: <20260914175351.393680-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=178.154.239.72; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1a.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1789408492610158500 Content-Type: text/plain; charset="utf-8" Thanks to pririty, backend is migrated before the virtio-net itself. So we can finish the releate initialization already in .pre_load, not postponing it to .post_load. Fixes: bb71b1bffe58df "virtio-net: support local migration of backend" Signed-off-by: Vladimir Sementsov-Ogievskiy --- hw/net/virtio-net.c | 40 +++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 19f453fb7df..4794496b964 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -3250,13 +3250,28 @@ static void virtio_net_get_features(VirtIODevice *v= dev, uint64_t *features, } } =20 +static bool virtio_net_pre_load_device(void *opaque, Error **errp) +{ + ERRP_GUARD(); + VirtIONet *n =3D opaque; + VirtIODevice *vdev =3D VIRTIO_DEVICE(n); + + if (n->peers_wait_incoming) { + /* MIG_PRI_BACKEND ensures the peers have already been loaded. */ + n->peers_wait_incoming =3D false; + peer_test_vnet_hdr(n); + virtio_net_get_features(vdev, vdev->host_features_ex, errp); + } + + return !*errp; +} + static int virtio_net_post_load_device(void *opaque, int version_id) { VirtIONet *n =3D opaque; VirtIODevice *vdev =3D VIRTIO_DEVICE(n); int i, link_down; bool has_tunnel_hdr =3D virtio_has_tunnel_hdr(vdev->guest_features_ex); - Error *local_err =3D NULL; =20 trace_virtio_net_post_load_device(); virtio_net_set_mrg_rx_bufs(n, n->mergeable_rx_bufs, @@ -3314,20 +3329,6 @@ static int virtio_net_post_load_device(void *opaque,= int version_id) } =20 virtio_net_commit_rss_config(n); - - /* - * If live-migration is enabled for some backend, than backend - * has already been migrated at higher priority (MIG_PRI_BACKEND) - * and virtio_net_vnet_post_load() has already called - * peer_test_vnet_hdr(). Recompute host_features so that virtio-net - * reflects the capabilities of the restored backend. - */ - virtio_net_get_features(vdev, &vdev->host_features, &local_err); - if (local_err) { - error_report_err(local_err); - return -EINVAL; - } - return 0; } =20 @@ -3478,14 +3479,6 @@ static int virtio_net_vnet_post_load(void *opaque, i= nt version_id) { struct VirtIONetMigTmp *tmp =3D opaque; =20 - /* - * If live-migration is enabled for some backend, than backend - * has already been migrated at higher priority (MIG_PRI_BACKEND), - * so n->has_vnet_hdr can be refreshed from the live backend right - * here. - */ - peer_test_vnet_hdr(tmp->parent); - if (tmp->has_vnet_hdr && !peer_has_vnet_hdr(tmp->parent)) { error_report("virtio-net: saved image requires vnet_hdr=3Don"); return -EINVAL; @@ -3674,6 +3667,7 @@ static const VMStateDescription vmstate_virtio_net_de= vice =3D { .name =3D "virtio-net-device", .version_id =3D VIRTIO_NET_VM_VERSION, .minimum_version_id =3D VIRTIO_NET_VM_VERSION, + .pre_load_errp =3D virtio_net_pre_load_device, .post_load =3D virtio_net_post_load_device, .fields =3D (const VMStateField[]) { VMSTATE_UINT8_ARRAY(mac, VirtIONet, ETH_ALEN), --=20 2.43.0 From nobody Sat Sep 26 21:37:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1789408534; cv=none; d=zohomail.com; s=zohoarc; b=kGFRffwT3sLRWA/0zNvA32q4tX6Of8gWTNi9httQdkF/OSBZn9U4EKarefSRtx7afM3XrM/f/haMhgaXhvU2alUxT/vbKOzDx3VR3p1coYx7wRjuLLcqBgLzNnl73fwXiOPzrHgL3JFFCzzlIs+J6zpjD25cjqGKvFgYP0tsvm4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789408534; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=d9AnM66mqO8oIMlMxdaUulQaT5duuxNJhwTGP7V00og=; b=K25pbvUN3fL4Jagcf50MoFojvPEneLVA+EDw0Ij60d8Xg7nZCAIR8mB8qVti8sS5oVgjepDWE10I/56w6drgvZSrfZHd1GSS6l+1XNUs3llFWhsrzV1w2C/sWvrWVOz/naD3SK4dsL7bFA7525Kt8lINVnopYD8j/VJyfahyyvQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1789408533806245.08083611148038; Mon, 14 Sep 2026 10:55:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6At6-00051o-5v; Mon, 14 Sep 2026 13:54:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x6Asf-0004vE-2L for qemu-devel@nongnu.org; Mon, 14 Sep 2026 13:54:16 -0400 Received: from forwardcorp1a.mail.yandex.net ([178.154.239.72]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x6AsX-0000Iz-GC for qemu-devel@nongnu.org; Mon, 14 Sep 2026 13:54:12 -0400 Received: from mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net [IPv6:2a02:6b8:c18:1d16:0:640:f28c:0]) by forwardcorp1a.mail.yandex.net (postfix) with ESMTPS id F2814C0AD9; Mon, 14 Sep 2026 20:53:58 +0300 (MSK) Received: from i115954770.yandex-team.ru (unknown [2a02:6bf:8080:a2b::1:d]) by mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net (smtpcorp) with ESMTPSA id rrX9s30iEKo0-32cOVHRM; Mon, 14 Sep 2026 20:53:58 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1789408438; bh=d9AnM66mqO8oIMlMxdaUulQaT5duuxNJhwTGP7V00og=; h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From; b=jgYyD0fsL+PSW1LNhnsft4d0+Qzg4VCaSr9kkErJrji2VXZjgOuhewUtPNTIRL7JQ SuNjMCyOzA/114oVYaxzzZcqM8blkzFmu8WgYkikd4O5WEsJ9v+W8wGgkur4XS1a8m 6Uk3CP19pJeoy6lGxeCDp6HE83kuOjpT/XgP6Q5o= Authentication-Results: mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: mst@redhat.com, jasowang@redhat.com Cc: pbonzini@redhat.com, zhao1.liu@intel.com, peterx@redhat.com, farosas@suse.de, qemu-devel@nongnu.org, vsementsov@yandex-team.ru Subject: [PATCH 4/5] net/tap: move vmstate initialization to new_tap() Date: Mon, 14 Sep 2026 20:53:50 +0300 Message-ID: <20260914175351.393680-5-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260914175351.393680-1-vsementsov@yandex-team.ru> References: <20260914175351.393680-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=178.154.239.72; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1a.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1789408535871158500 Content-Type: text/plain; charset="utf-8" Otherwise, incoming_fds case in net_init_tap() is not covered, and the mechanism will not work for outgoing local migration, if VM start life from incoming local migration. Fixes: 98a0c2127070 "net/tap: disable read polling for stopped VM" Signed-off-by: Vladimir Sementsov-Ogievskiy --- net/tap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/tap.c b/net/tap.c index 8039b4e388c..9f829f49c1e 100644 --- a/net/tap.c +++ b/net/tap.c @@ -623,6 +623,9 @@ static TAPState *new_tap(NetClientState *peer, =20 s->queue_index =3D queue_index; =20 + s->enable_poll_on_resume =3D false; + s->vmstate =3D qemu_add_vm_change_state_handler(tap_vm_state_change, s= ); + if (has_permit_local_migration) { s->permit_local_migration =3D permit_local_migration; } @@ -968,9 +971,6 @@ static bool net_init_tap_one(const NetdevTapOptions *ta= p, NetClientState *peer, int sndbuf =3D (tap->has_sndbuf && tap->sndbuf) ? MIN(tap->sndbuf, INT_MAX) : INT= _MAX; =20 - s->enable_poll_on_resume =3D false; - s->vmstate =3D qemu_add_vm_change_state_handler(tap_vm_state_change, s= ); - if (!tap_set_sndbuf(fd, sndbuf, sndbuf_required ? errp : NULL) && sndbuf_required) { goto failed; --=20 2.43.0 From nobody Sat Sep 26 21:37:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1789408492; cv=none; d=zohomail.com; s=zohoarc; b=Dch4Ub3ocA53kkAUkXwUfJgNpu1OgKLJJ1BIsl0e3RVE/q9/9kSWVz6t2PC7OMsEVL30wk6QfcRH6ZffKYPz3aAqrvXM4SJmrM2sFnxEjzVkPvGfAHMN1E/GTkGT8stg7z/JAjRqVrwdRe0rr4AdrE/los65KJTshHV4vLakEL8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789408492; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=n+e2IXBuUcWHhYQRPFahM3pBkgqbE2CLCIGOrDjhA2U=; b=Da18hy8hS+v44A6swdLwtuWBaIeG0u+CQaq/hSM7yCfVgpwfqTInF2AxxIbUWwWQ/KyUoAYaGoN7lgraNNfk+H9n0reUTT7r1Hwe0/NEy1Ygvz6speVpTFbHZ/81EUAKLDmjR6X25Qgc4yhXzxO6e0e8TNreZHkj9UPg3OKLRCY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1789408492183886.9641617083479; Mon, 14 Sep 2026 10:54:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6At0-0004zJ-ND; Mon, 14 Sep 2026 13:54:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x6Asd-0004uy-4E for qemu-devel@nongnu.org; Mon, 14 Sep 2026 13:54:16 -0400 Received: from forwardcorp1a.mail.yandex.net ([178.154.239.72]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x6AsX-0000J5-Gc for qemu-devel@nongnu.org; Mon, 14 Sep 2026 13:54:10 -0400 Received: from mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net [IPv6:2a02:6b8:c18:1d16:0:640:f28c:0]) by forwardcorp1a.mail.yandex.net (postfix) with ESMTPS id 8A355C0ADC; Mon, 14 Sep 2026 20:53:59 +0300 (MSK) Received: from i115954770.yandex-team.ru (unknown [2a02:6bf:8080:a2b::1:d]) by mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net (smtpcorp) with ESMTPSA id rrX9s30iEKo0-oNmFtq3C; Mon, 14 Sep 2026 20:53:59 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1789408439; bh=n+e2IXBuUcWHhYQRPFahM3pBkgqbE2CLCIGOrDjhA2U=; h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From; b=nlLI5JNJ8NY7qKPtSfSKcjtFhFVdQ6UHt7xELofpw3RO89FOvSDJKpH7jgDOsrb24 kcwSybGvzAtk7DtJNbDtnZ0n0FRa8GNz9m6THbuHuHJbTDg+sTyCsZc7/vpzMTElyj 6R11sfTOdW3GqHrTQtyqPLw9JkAHSzWNUiPnOP7w= Authentication-Results: mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: mst@redhat.com, jasowang@redhat.com Cc: pbonzini@redhat.com, zhao1.liu@intel.com, peterx@redhat.com, farosas@suse.de, qemu-devel@nongnu.org, vsementsov@yandex-team.ru Subject: [PATCH 5/5] net/tap: net_init_tap_one(): fix failure path Date: Mon, 14 Sep 2026 20:53:51 +0300 Message-ID: <20260914175351.393680-6-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260914175351.393680-1-vsementsov@yandex-team.ru> References: <20260914175351.393680-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=178.154.239.72; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1a.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1789408493571158500 Content-Type: text/plain; charset="utf-8" We should "goto failed" here, to delete net client, same as for previous failure path in the function. Fixes: 69036a855492 "net/tap: move vhost initialization to tap_setup_vhost(= )" Signed-off-by: Vladimir Sementsov-Ogievskiy --- net/tap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/tap.c b/net/tap.c index 9f829f49c1e..acccabca562 100644 --- a/net/tap.c +++ b/net/tap.c @@ -996,7 +996,7 @@ static bool net_init_tap_one(const NetdevTapOptions *ta= p, NetClientState *peer, s->vhostfd =3D vhostfd; s->vhost_busyloop_timeout =3D tap->has_poll_us ? tap->poll_us : 0; if (!tap_setup_vhost(s, errp)) { - return false; + goto failed; } =20 return true; --=20 2.43.0