From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Q6j713uL; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTPS id 3C6EC5A061C for ; Fri, 17 Jan 2025 14:38:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1737121116; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=taSFEb0sbID3gxyn4wJV28/0dFOTWrIjCJuoKjoqkA4=; b=Q6j713uLTEu5oy2hTk1AZd//ycb8X1U7TcTgKhMrbwdxcQEvl1uwGScfW79NQfH+Wkl1Gv 8BFHbcaQ31hvo0xbraRVR/+xHefSiCJToQ6REU0VH+CMayNx25gypNP2mkaF6HBTxYaQAF h23yP3mIzycL+ZZE6VXOOqIpdEVT7/8= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-605-tkEt7AbaMwmcIQfx6p_gTg-1; Fri, 17 Jan 2025 08:38:34 -0500 X-MC-Unique: tkEt7AbaMwmcIQfx6p_gTg-1 X-Mimecast-MFC-AGG-ID: tkEt7AbaMwmcIQfx6p_gTg Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-4361ac8b25fso10747525e9.2 for ; Fri, 17 Jan 2025 05:38:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737121112; x=1737725912; h=content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=taSFEb0sbID3gxyn4wJV28/0dFOTWrIjCJuoKjoqkA4=; b=NBvdfc6Dc6Qy5+P3n1cur//D5jNzzRoMdI6fiUNUaauUhwu8xTXrBYhSyXhHYEMrbv EwpwxoNRZjQJjD9mubA2XY4N6dRvx6H1rfrLCoXCgwUf380+7cKFd7GaiIDJusnyUcE7 Ya5jJo8IH4XVZewK8sWQQZvgZ5qWGqhsxcasla8+af44FwPmj2orwJlg9NP497wjbzMy c+GhftWnQHxItk3Z/98c+3Uak1iai3nlfnMRdBoUypbH383H/x7oeFOk6muD1pR6kgo4 InjyVjYIngEUodNdjCgRFbswoOzJFZrWdqAPkemC930Dpa5jg9Bq7ieZs7BhHknK9Xsn hxYQ== X-Gm-Message-State: AOJu0Yxn0dMC4EOjv2eRGJk6NlDX9mEMD6TS54UPlVnhq/gQVRpZV6xd Ry2ELF6cJjz/5sJtTX4WYHDpNkg+Bxn3M2uKiPI7zqah1ysYb+mFAZIUpNbGn/TiNo6cAJM0oKI Mjxz3wtoQ8NgaBVX4c/lPKXsub2yf3tM7P3jIRpNZj8TmfPikijPAP7mbqyX6qRAKM6G0xH2IL/ Bpb9tbLmlY8MgvO+LYssLPb48yutmkeJ1q X-Gm-Gg: ASbGncs1jYOAv4Ue/qLm+P+Itb26MU5v179EiYUgStW0nQIiJmemQtaUK6eODmxni34 h/P1L8chb4PYsPhkTJXY2KBDqlIbOP5aD+omBYCKE1Zoopd7UoQMtnu0yksn8bbKqPbfkGSfc++ dwgDBS2QsgdO7e6sqNGMHTT5HU+WiNvc3vudPdA2u8UfoUuV4597v7Dw9cjVAGA27L6tn5TrdgT +HF0bnkHNgfcl2JRRN9JzfO4RPNZWjtj7IqNUoTW8JwvhrNqBn7mIQeTgJ46xWS8U9X X-Received: by 2002:a05:600c:1987:b0:436:faf1:9da with SMTP id 5b1f17b1804b1-438913c68ebmr27662885e9.2.1737121112524; Fri, 17 Jan 2025 05:38:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IGBSuWFm5kmB6AVyZVZRboHYL2QGK/zmdi6EqYdhxvUTkdoVWXqWsTjPMAX5dGrFOV/Zkv5bA== X-Received: by 2002:a05:600c:1987:b0:436:faf1:9da with SMTP id 5b1f17b1804b1-438913c68ebmr27662545e9.2.1737121112032; Fri, 17 Jan 2025 05:38:32 -0800 (PST) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [2a10:fc81:a806:d6a9::1]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-437c7528076sm95746585e9.25.2025.01.17.05.38.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jan 2025 05:38:31 -0800 (PST) Date: Fri, 17 Jan 2025 14:38:29 +0100 From: Stefano Brivio To: Laurent Vivier Subject: Re: [PATCH 0/9] vhost-user: Migration support Message-ID: <20250117143829.7e861cac@elisabeth> In-Reply-To: References: <20241219111400.2352110-1-lvivier@redhat.com> <329e349d-f86c-479b-97ee-61397aa28c60@redhat.com> <20250117134445.5b341bdd@elisabeth> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: O4weIKt_USmaffbPWgQRfl0JgHgnj-M2_bxZKoDT7OI_1737121114 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: LWSZ23VYXES7WCGUT7CYPGMRVL3GXIPV X-Message-ID-Hash: LWSZ23VYXES7WCGUT7CYPGMRVL3GXIPV X-MailFrom: sbrivio@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Fri, 17 Jan 2025 14:27:38 +0100 Laurent Vivier wrote: > On 17/01/2025 13:44, Stefano Brivio wrote: > > On Fri, 17 Jan 2025 13:13:36 +0100 > > Laurent Vivier wrote: > > > >> On 19/12/2024 12:13, Laurent Vivier wrote: > >>> This series allows a QEMU guest to be migrated while it is connected > >>> to Passt using vhost-user interface. > >>> > >>> There are two parts: > >>> > >>> - first part enables the migration of QEMU without transferring the > >>> internal state of Passt. All connections are lost. > >>> > >>> This is done by implementing VHOST_USER_SET_LOG_FD and > >>> VHOST_USER_SET_LOG_BASE commands (and enabling > >>> VHOST_USER_PROTOCOL_F_LOG_SHMFD feature) > >>> > >>> "vhost-user: add VHOST_USER_SET_LOG_FD command" > >>> "vhost-user: add VHOST_USER_SET_LOG_BASE command" > >>> "vhost-user: Report to front-end we support VHOST_USER_PROTOCOL_F_LOG_SHMFD" > >>> > >>> - second part allows source Passt instance to send its internal > >>> state using QEMU migration channel to destination Passt instance. > >>> > >>> This is done implementing VHOST_USER_SET_DEVICE_STATE_FD and > >>> VHOST_USER_CHECK_DEVICE_STATE (and enabling > >>> VHOST_USER_PROTOCOL_F_DEVICE_STATE feature). > >>> > >>> "vhost-user: add VHOST_USER_CHECK_DEVICE_STATE command" > >>> "vhost-user: add VHOST_USER_SET_DEVICE_STATE_FD command" > >>> "vhost-user: Report to front-end we support VHOST_USER_PROTOCOL_F_DEVICE_STATE" > >>> > >>> For now, it only implements the function needed to transfer the > >>> state but no state is transferred. > >>> > >>> VHOST_USER_PROTOCOL_F_DEVICE_STATE is implemented in QEMU > >>> only for vhost-user-fs, to be able to use it with virtio-net > >>> I have proposed a patch upstream: > >>> > >>> https://patchew.org/QEMU/20241218143453.1573185-1-lvivier@redhat.com/ > >>> > >>> Laurent Vivier (9): > >>> virtio: Use const pointer for vu_dev > >>> vhost-user: update protocol features and commands list > >>> vhost-user: add VHOST_USER_SET_LOG_FD command > >>> vhost-user: Pass vu_dev to more virtio functions > >>> vhost-user: add VHOST_USER_SET_LOG_BASE command > >>> vhost-user: Report to front-end we support > >>> VHOST_USER_PROTOCOL_F_LOG_SHMFD > >>> vhost-user: add VHOST_USER_CHECK_DEVICE_STATE command > >>> vhost-user: add VHOST_USER_SET_DEVICE_STATE_FD command > >>> vhost-user: Report to front-end we support > >>> VHOST_USER_PROTOCOL_F_DEVICE_STATE > >>> > >>> epoll_type.h | 2 + > >>> passt.c | 4 + > >>> util.h | 3 + > >>> vhost_user.c | 251 ++++++++++++++++++++++++++++++++++++++++++++++++++- > >>> vhost_user.h | 50 +++++++++- > >>> virtio.c | 116 +++++++++++++++++++++--- > >>> virtio.h | 32 +++++-- > >>> vu_common.c | 59 +++++++++++- > >>> vu_common.h | 3 +- > >>> 9 files changed, 484 insertions(+), 36 deletions(-) > >>> > >> > >> Another point: > >> > >> vhost-user can ask backend (passt) to send a notification at the end of the migration on > >> the destination side to the network to update the network topology. Do we need this? > >> > >> This is VHOST_USER_SEND_RARP: > >> "Ask vhost user back-end to broadcast a fake RARP to notify the migration is terminated > >> for guest that does not support GUEST_ANNOUNCE. > >> > >> Only legal if feature bit VHOST_USER_F_PROTOCOL_FEATURES is present in > >> VHOST_USER_GET_FEATURES and protocol feature bit VHOST_USER_PROTOCOL_F_RARP is present in > >> VHOST_USER_GET_PROTOCOL_FEATURES. The first 6 bytes of the payload contain the mac address > >> of the guest to allow the vhost user back-end to construct and broadcast the fake RARP." > > > > This isn't really clear :( ...what does "fake RARP" even mean? RARP is > > a protocol, and an obsolete one, despite: > > > > https://en.wikipedia.org/wiki/Reverse_Address_Resolution_Protocol#Modern_Day_Uses > > > > Anyway, it comes from 3e866365e1eb ("vhost user: add rarp sending after > > live migration for legacy guest"). > > I think legacy is for guest that doesn't support VIRTIO_NET_F_GUEST_ANNOUNCE: > See "5.1.6.5.4 Gratuitous Packet Sending" > https://docs.oasis-open.org/virtio/virtio/v1.2/cs01/virtio-v1.2-cs01.html#x1-2560004 > > With VIRTIO_NET_F_GUEST_ANNOUNCE, QEMU notifies the guest kernel to send a packet to the > network > to update the configuration. > > In the guest kernel, it seems to be done by (it sends an ARP packet): > > /** > * __netdev_notify_peers - notify network peers about existence of @dev, > * to be called when rtnl lock is already held. > * @dev: network device > * > * Generate traffic such that interested network peers are aware of > * @dev, such as by generating a gratuitous ARP. This may be used when > * a device wants to inform the rest of the network about some sort of > * reconfiguration such as a failover event or virtual machine > * migration. > */ > void __netdev_notify_peers(struct net_device *dev) > { > ASSERT_RTNL(); > call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, dev); > call_netdevice_notifiers(NETDEV_RESEND_IGMP, dev); > } Sure, gratuitous ARP, makes sense. > On its side, QEMU always send a RARP packet (see qemu_announce_self_iter()) that is > catched in vhost_user_receive() to be changed into a VHOST_USER_SEND_RARP by > vhost_user_migration_done(). ...but why RARP? > > I have no idea what "legacy" means here, but I'm under the impression that > > somebody just needed a way to notify the guest of the finished migration > > (nothing related to networking) and, correct me if I'm wrong, the French > > word for "fake" is rather similar to the one for "dummy". > > Not the guest, the network. > The guest is notified with the GUEST_ANNOUNCE stuff (if supported) Hah, I see! So it's sent *outside*. And it's dummy, as I thought, not fake. > > So my understanding of it is that they would just send a dummy packet, > > and a RARP broadcast would be a good candidate because it's otherwise > > unused, but wouldn't raise any firewall alert. > > > > Or maybe "legacy" has something to do with VMware vSphere, and there was > > some guest previously running on VMware vSphere that needs a RARP packet > > to "proceed" with something after the migration. > > > > If that's the case, and if there's still something like that around, I > > guess that ideally we want it for compatibility, but it's *very* unlikely > > to ever bite us. > > > > So all in all I would say that if the implementation is very small and > > unproblematic we can hack up something in arp.c to build a RARP packet > > (example here: https://wiki.wireshark.org/RARP but that's a request, not > > a broadcast). Otherwise I wouldn't really care until somebody asks. > > It only depends on how passt will inform its neighbors about its new location in the > network after migration. But my feeling is passt doesn't need to do that as it shares the > IP address of the host and the guest MAC address is not shown beyond passt. Right, it's just a process running on the new host. And besides, we couldn't send it anyway, we can't craft packets like that. > So we can implement VHOST_USER_SEND_RARP with an empty function (at least to silence the > "Vhost user backend fails to broadcast fake RARP" message). Oh, sure, if it's so annoying. And we can't just keep VHOST_USER_PROTOCOL_F_RARP off in the feature flags? -- Stefano