public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Laurent Vivier <lvivier@redhat.com>
Cc: passt-dev@passt.top
Subject: Re: [PATCH 2/5] vhost-user: introduce virtio API
Date: Sat, 6 Jul 2024 09:53:19 +1000	[thread overview]
Message-ID: <ZoiHb_Zp02XgUu_T@zatzit> (raw)
In-Reply-To: <eb2a69bf-c01b-4a6f-8931-12d55268153b@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 3077 bytes --]

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.
> > > 
> > > Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> > > ---
> > >   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
> > > 
> ...
> > > 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
> > > +
> > 
> > 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.
> 
> I'm updating that

Ok.

> > > +/* some parts copied from QEMU subprojects/libvhost-user/libvhost-user.c */
> > 
> > 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.
> 
> As the orignal code in QEMU don't change a lot I chose to update it to match
> passt coding style. I'm adding the function headers. What else is missing?

From 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-user.h */
> > > +
> > > +#ifndef VIRTIO_H
> > > +#define VIRTIO_H
> > > +
> > > +#include <stdbool.h>
> > > +#include <linux/vhost_types.h>
> > > +
> > > +#define VIRTQUEUE_MAX_SIZE 1024
> > > +
> > > +#define vu_panic(vdev, ...)		\
> > > +	do {				\
> > > +		(vdev)->broken = true;	\
> > > +		err( __VA_ARGS__ );	\
> > 
> > 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.
> > 
> 
> I agree.
> 
> Thanks,
> Laurent
> 

-- 
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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2024-07-05 23:53 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-21 14:56 [PATCH 0/5] Add vhost-user support to passt. (part 3) Laurent Vivier
2024-06-21 14:56 ` [PATCH 1/5] packet: replace struct desc by struct iovec Laurent Vivier
2024-06-24  2:48   ` David Gibson
2024-07-04 15:52     ` Laurent Vivier
2024-07-05  1:28       ` David Gibson
2024-06-21 14:56 ` [PATCH 2/5] vhost-user: introduce virtio API Laurent Vivier
2024-06-24  2:56   ` David Gibson
2024-07-05 15:06     ` Laurent Vivier
2024-07-05 23:53       ` David Gibson [this message]
2024-06-21 14:56 ` [PATCH 3/5] vhost-user: introduce vhost-user API Laurent Vivier
2024-06-24  3:02   ` David Gibson
2024-07-11 12:07     ` Laurent Vivier
2024-06-21 14:56 ` [PATCH 4/5] iov: add iov_count() Laurent Vivier
2024-06-24  3:03   ` David Gibson
2024-06-24  6:59     ` Laurent Vivier
2024-06-21 14:56 ` [PATCH 5/5] vhost-user: add vhost-user Laurent Vivier
2024-06-24  5:05   ` David Gibson
2024-07-12 14:49     ` Laurent Vivier
2024-07-15  0:37       ` David Gibson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZoiHb_Zp02XgUu_T@zatzit \
    --to=david@gibson.dropbear.id.au \
    --cc=lvivier@redhat.com \
    --cc=passt-dev@passt.top \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).