From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202502 header.b=eTzp2IBT; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id E7E635A0274 for ; Mon, 10 Feb 2025 05:05:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202502; t=1739160293; bh=vuOHkNBZClLOl9ILdSLFb57HhFMvDoQZZ2RsffNg86w=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=eTzp2IBTQZuGIMM7wYQaEOREGMz+wI1zu29+iRFcsPCtbgBqauJB1ruFWiIFr1grU WtmPghSsx4nggZZdX1NolvB5ri4g88ZlLsO855LdTUdWmTK1fMjuh8h+KNi+AJVNVU 9hmrs8DSjClTtv074U2j3e8pXIIZwSWjirQagZmgS0cRASwNXz+ybTGzA0dm1l1bri 5kvtnSBIm89TysRWBj2rW60MGsZhulYfocWGon4uquxfhAi5A2JAAdtpdIJZjEBfAd WMaOEs5zPANqzSX6cbEPQbJDHofWvqlKQ3qi+qIih+h9RPmOQyPIVb6fmce6/NzE5J WfQVh4uXAaxYA== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4YrrZF1806z4wcD; Mon, 10 Feb 2025 15:04:53 +1100 (AEDT) Date: Mon, 10 Feb 2025 14:43:35 +1100 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH v13 4/6] vhost_user: Make source quit after reporting migration state Message-ID: References: <20250209222005.1640077-1-sbrivio@redhat.com> <20250209222005.1640077-5-sbrivio@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="/DysZLy/J8vsUmjD" Content-Disposition: inline In-Reply-To: <20250209222005.1640077-5-sbrivio@redhat.com> Message-ID-Hash: 5SD256RF5OLJOSD5YBKCHARM5P7N7GPD X-Message-ID-Hash: 5SD256RF5OLJOSD5YBKCHARM5P7N7GPD X-MailFrom: dgibson@gandalf.ozlabs.org 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: --/DysZLy/J8vsUmjD Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Feb 09, 2025 at 11:20:03PM +0100, Stefano Brivio wrote: > This will close all the sockets we currently have open in repair mode, > and completes our migration tasks as source. If the hypervisor wants > to have us back at this point, somebody needs to restart us. >=20 > Signed-off-by: Stefano Brivio > --- > vhost_user.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) >=20 > diff --git a/vhost_user.c b/vhost_user.c > index 256c8ab..9115fb5 100644 > --- a/vhost_user.c > +++ b/vhost_user.c > @@ -998,6 +998,9 @@ static bool vu_send_rarp_exec(struct vu_dev *vdev, > return false; > } > =20 > +/* If set, quit when we get a VHOST_USER_CHECK_DEVICE_STATE, after reply= ing */ > +static bool quit_on_device_state =3D false; We don't actually need this global, because we have c->migrate_target. > + > /** > * vu_set_device_state_fd_exec() - Set the device state migration channel > * @vdev: vhost-user device > @@ -1025,6 +1028,9 @@ static bool vu_set_device_state_fd_exec(struct vu_d= ev *vdev, > migrate_request(vdev->context, msg->fds[0], > direction =3D=3D VHOST_USER_TRANSFER_STATE_DIRECTION_LOAD); > =20 > + if (direction =3D=3D VHOST_USER_TRANSFER_STATE_DIRECTION_SAVE) > + quit_on_device_state =3D true; > + > /* We don't provide a new fd for the data transfer */ > vmsg_set_reply_u64(msg, VHOST_USER_VRING_NOFD_MASK); > =20 > @@ -1203,4 +1209,10 @@ void vu_control_handler(struct vu_dev *vdev, int f= d, uint32_t events) > =20 > if (reply_requested) > vu_send_reply(fd, &msg); > + > + if (quit_on_device_state && > + msg.hdr.request =3D=3D VHOST_USER_CHECK_DEVICE_STATE) { We probably also only want to quit when the migration is successful. We can't determine that in all cases, but we can at least check device_state_result. Patch coming. > + info("Migration complete, exiting"); > + _exit(EXIT_SUCCESS); > + } > } --=20 David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson --/DysZLy/J8vsUmjD Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmepdeYACgkQzQJF27ox 2GcuDA/8DDfSbI7rCzl98CiweiOnCNur6nhPVwdqxVfTODTKz97Kb4zP8j7Mcamn lElInygEzd95aIxQA0HAz5ZXjFyyffaEBkBTZH/yebI1XCMTMLnR+zCBUjZoBQqe DPhEjyTQLNL3uGhdz/TGIq1G566kPdIh2pJ7qlN3tWOsKK9aiu0G+bJIkzvROHJF fz3R9I0xa68MCeaHht2wrXGDC41DO3s/968DVj94kk+mbJcWhqbgqTijRYqZuJo9 d4Az2a2Yk0Ki5z0ouKhgJCTZl1BT7bPXofHrjC2IznxVIfPacxh/wTTKxnsANZZ+ HKgg1zi38NvivuPjE4XXNC6PtHAnjYNjpUKngV0MGSHlTbBDrF039fzcw8bSiKv+ jhInsO4PHXYp/PWZd76ueZ1LkWAzmj77ZW8ia45jmFVIc6X+YMcbEJhmewfIVF/A JMPyrztNOuTBeF6kV0BitW16PRblSDdcYkLL+OSzUQ+twlHtgjYXwkuxhTEbi6kH gEviHf/eAChj0BR6MQBPYkadtr36s0kSqRwfn5Y8ckfDJprnWIAT0uc1XNybvxbc pl60fhIucvU90llRxivLewf1MX3/vJf/JyeRefd1C1fdb0pTyUfss9kSBM2XTiRO QQQppWCtThGnqSDr6QsZCGcslq0GowTQUpn2f+ibvhjYRvQTV6M= =3Uzj -----END PGP SIGNATURE----- --/DysZLy/J8vsUmjD--