From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 794FC5A004E for ; Sat, 06 Jul 2024 01:53:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1720223606; bh=3Pqwf3uJuaG8TX+0FcN2/9Cxe/KJ1yR7WO1NUX38kMY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=flVsOlOYasyzEsECKoMaxIQbu0Lv7xjbmZ7xae9iJt7dFC3Vk5y/WXFAosVvLaYc6 RNRy/7mZ8+sVk3gGlxgYg0vJLRaKforpAHh1xi7fqrMnQ4uddlld+SaJ6KnrUrRUpV QF5k5gCQYPPNjWFOnu/6+oWdnLawqULEhCbbESODvoU9Z12IiewdhNFvpJMvxYswRw RQw8H5wZznIxkAm7TDzp4OHIYgDe2nYJGifTLlmnPFZMW5QhgdDuJ7oPBTR/eTVTIT QcHdmC+0VJI2M1s/XFLDmDGIDVa/9CmZRvlpnDvF9wdKAtnSHlcaAN2pKhUreFKB9N yjcIVg+gkzK8w== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4WG9MB67znz4x1P; Sat, 6 Jul 2024 09:53:26 +1000 (AEST) Date: Sat, 6 Jul 2024 09:53:19 +1000 From: David Gibson To: Laurent Vivier Subject: Re: [PATCH 2/5] vhost-user: introduce virtio API Message-ID: References: <20240621145640.1914287-1-lvivier@redhat.com> <20240621145640.1914287-3-lvivier@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="bijT1RsqkZJ5iH6a" Content-Disposition: inline In-Reply-To: Message-ID-Hash: 6AXHSKOFT5MPLOYR3GYFXEKP3BK457UF X-Message-ID-Hash: 6AXHSKOFT5MPLOYR3GYFXEKP3BK457UF 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: --bijT1RsqkZJ5iH6a Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jul 05, 2024 at 05:06:12PM +0200, Laurent Vivier wrote: > On 24/06/2024 04:56, David Gibson wrote: > > On Fri, Jun 21, 2024 at 04:56:37PM +0200, Laurent Vivier wrote: > > > Add virtio.c and virtio.h that define the functions needed > > > to manage virtqueues. > > >=20 > > > Signed-off-by: Laurent Vivier > > > --- > > > Makefile | 4 +- > > > util.h | 11 ++ > > > virtio.c | 446 ++++++++++++++++++++++++++++++++++++++++++++++++++++= +++ > > > virtio.h | 123 +++++++++++++++ > > > 4 files changed, 582 insertions(+), 2 deletions(-) > > > create mode 100644 virtio.c > > > create mode 100644 virtio.h > > >=20 > ... > > > diff --git a/virtio.c b/virtio.c > > > new file mode 100644 > > > index 000000000000..50ec8b5119ed > > > --- /dev/null > > > +++ b/virtio.c > > > @@ -0,0 +1,446 @@ > > > +// SPDX-License-Identifier: GPL-2.0-or-later > > > + > >=20 > > Needs an actual "Copyright" invocation as well as the SPDX stuff. > > Which, yes, is a bit fiddly given that it's largely taken from qemu. >=20 > I'm updating that Ok. > > > +/* some parts copied from QEMU subprojects/libvhost-user/libvhost-us= er.c */ > >=20 > > So, there are obvious stylistic differences between this and the rest > > of the passt code for that reason. As I think I said on an earlier > > draft, I think we need to go fully one way or the other: either a) > > rewrite this entirely in passt style or b) change the whole thing so > > little that it's trivial to pull in new versions from qemu. This > > seems to be somewhere in the middle. >=20 > As the orignal code in QEMU don't change a lot I chose to update it to ma= tch > passt coding style. I'm adding the function headers. What else is missing? =46rom memory: - No braces for one line blocks - snake_case instead of CamelCase - Don't use typedefs for structures or unions - Tabs instead of spaces > ... > > > diff --git a/virtio.h b/virtio.h > > > new file mode 100644 > > > index 000000000000..61398bb432bc > > > --- /dev/null > > > +++ b/virtio.h > > > @@ -0,0 +1,123 @@ > > > +// SPDX-License-Identifier: GPL-2.0-or-later > > > +// > > > +/* come parts copied from QEMU subprojects/libvhost-user/libvhost-us= er.h */ > > > + > > > +#ifndef VIRTIO_H > > > +#define VIRTIO_H > > > + > > > +#include > > > +#include > > > + > > > +#define VIRTQUEUE_MAX_SIZE 1024 > > > + > > > +#define vu_panic(vdev, ...) \ > > > + do { \ > > > + (vdev)->broken =3D true; \ > > > + err( __VA_ARGS__ ); \ > >=20 > > Wouldn't it be simpler to just use die() in place of vu_panic(). This > > is trying to keep the program running even if the vu device is broken, > > but if our channel to the guest is broken, I don't think passt is > > really worth saving. > >=20 >=20 > I agree. >=20 > Thanks, > Laurent >=20 --=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 --bijT1RsqkZJ5iH6a Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmaIh14ACgkQzQJF27ox 2GdQag/9FGngawBE6Nd6eApiVTbGP6QMHvWEtxVZifdaUeYXJFZYKWMn/7opV1DA SGNCGUecWE1b9w57qzXX1dNYaNZfLp1knTOy/VW7N2bKBSe2lM3Kbe/dCYYKM24U DYZRo7MazdedqTbvIW7fRaBIl3oj8pKUa76a3EJfZJbQqLveTXi/fy6EEpNUi5x5 RnG81U+EaffXgJZET9iZluvcU7huvj0omzTXMTwa+dPyjUkwDS1cEkeZPC3iAsbz sLzaoAcgXeIHJR1PqSm9oho/GnwQ+2BP0mW9wgLFfAoUb2xT1CYIz3nwiaCoAKPk XjJuE02+T6WdN5YC2qTAn0AsCtKgdzlG3km8C958GXF7AkXPuG41P1780dC0cHK0 J+VUEZL01MJdWYZEZzHQYi74lWRWjZLv45kp6ov/jwdl/P7q+NtOUllAozV58Z/r 5KkQrgKYCMROrFF6gmxIvZe4ByfdQ74DPwivgKrZWCVE2Vu+As5f5N2xtwBvUu9T 21EUAkZVYXtF2Akg1rxBvCnw2wsavMH00cpxPA1Kx1AeVHmsvX4OXYAWhcw5+yRc VNEy9s5kMx/v2stZS5GKMWsidiakRLZi1n6Ic9dGWtfTaJkuo9R7VWXytASuudTL LXMZmmQdEE/+x+kTfSjSlYuFVn+zD32gDylDPyg4PEhrsqGzKaE= =KZhQ -----END PGP SIGNATURE----- --bijT1RsqkZJ5iH6a--