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

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

> 
>> +/* 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?

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


  reply	other threads:[~2024-07-05 15:06 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 [this message]
2024-07-05 23:53       ` David Gibson
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=eb2a69bf-c01b-4a6f-8931-12d55268153b@redhat.com \
    --to=lvivier@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --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).