QEMU-Devel Archive mirror
 help / color / mirror / Atom feed
From: Eugenio Perez Martin <eperezma@redhat.com>
To: Sahil <icegambit91@gmail.com>
Cc: qemu-level <qemu-devel@nongnu.org>,
	Stefano Garzarella <sgarzare@redhat.com>
Subject: Re: Intention to work on GSoC project
Date: Mon, 13 May 2024 16:23:40 +0200	[thread overview]
Message-ID: <CAJaqyWfbHgVA7f81C6phouSUEb7bVwXFRDWTHeie7Vax13zWZw@mail.gmail.com> (raw)
In-Reply-To: <2282965.iZASKD2KPV@valdaarhun>

On Mon, May 13, 2024 at 3:49 PM Sahil <icegambit91@gmail.com> wrote:
>
> Hi,
>
> On Wednesday, May 8, 2024 8:53:12 AM GMT+5:30 Sahil wrote:
> > Hi,
> >
> > On Tuesday, May 7, 2024 12:44:33 PM IST Eugenio Perez Martin wrote:
> > > [...]
> > >
> > > > Shall I start by implementing a mechanism to check if the feature bit
> > > > "VIRTIO_F_RING_PACKED" is set (using "virtio_vdev_has_feature")? And
> > > > if it's supported, "vhost_svq_add" should call "vhost_svq_add_packed".
> > > > Following this, I can then start implementing "vhost_svq_add_packed"
> > > > and progress from there.
> > > >
> > > > What are your thoughts on this?
> > >
> > > Yes, that's totally right.
> > >
> > > I recommend you to also disable _F_EVENT_IDX to start, so the first
> > > version is easier.
> > >
> > > Also, you can send as many incomplete RFCs as you want. For example,
> > > you can send a first version that only implements reading of the guest
> > > avail ring, so we know we're aligned on that. Then, we can send
> > > subsequents RFCs adding features on top.
> >
>
> I have started working on implementing packed virtqueue support in
> vhost-shadow-virtqueue.c. The changes I have made so far are very
> minimal. I have one confusion as well.
>
> In "vhost_svq_add()" [1], a structure of type "VhostShadowVirtqueue"
> is being used. My initial idea was to create a whole new structure (eg:
> VhostShadowVirtqueuePacked). But I realized that "VhostShadowVirtqueue"
> is being used in a lot of other places such as in "struct vhost_vdpa" [2]
> (in "vhost-vdpa.h"). So maybe this isn't a good idea.
>
> The problem is that "VhostShadowVirtqueue" has a member of type "struct
> vring" [3] which represents a split virtqueue [4]. My idea now is to instead
> wrap this member in a union so that the struct would look something like
> this.
>
> struct VhostShadowVirtqueue {
>         union {
>                 struct vring vring;
>                 struct packed_vring vring;
>         }
>         ...
> }
>
> I am not entirely sure if this is a good idea. It is similar to what's been done
> in linux's "drivers/virtio/virtio_ring.c" ("struct vring_virtqueue" [5]).
>
> I thought I would ask this first before continuing further.
>

That's right, this second option makes perfect sense.

VhostShadowVirtqueue should abstract both split and packed. You'll see
that some members are reused, while others are only used in one
version so they are placed after a union. They should follow the same
pattern, although it is not a problem if we need to divert a little
bit from the kernel's code.

Thanks!

> Thanks,
> Sahil
>
> [1] https://gitlab.com/qemu-project/qemu/-/blob/master/hw/virtio/vhost-shadow-virtqueue.c#L249
> [2] https://gitlab.com/qemu-project/qemu/-/blob/master/include/hw/virtio/vhost-vdpa.h#L69
> [3] https://gitlab.com/qemu-project/qemu/-/blob/master/hw/virtio/vhost-shadow-virtqueue.h#L52
> [4] https://gitlab.com/qemu-project/qemu/-/blob/master/include/standard-headers/linux/virtio_ring.h#L156
> [5] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/virtio/virtio_ring.c#n199
>
>



  reply	other threads:[~2024-05-13 14:24 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-25 21:38 Intention to work on GSoC project Sahil
2024-02-29  8:32 ` Stefano Garzarella
2024-02-29 19:02   ` Sahil
2024-03-01  7:40   ` Eugenio Perez Martin
2024-03-01 18:29     ` Sahil
2024-03-14 15:09       ` Eugenio Perez Martin
2024-03-15  7:14         ` Sahil
2024-03-15 11:27           ` Eugenio Perez Martin
2024-03-16 20:26             ` Sahil
2024-03-18 19:47               ` Sahil
2024-03-20 16:29                 ` Eugenio Perez Martin
2024-03-25 13:20                   ` Sahil
2024-04-01 18:23                     ` daleyoung4242
2024-04-02  4:58                       ` Sahil
2024-04-02 11:38                         ` Eugenio Perez Martin
2024-04-03 14:36                           ` Sahil
2024-04-03 18:37                             ` Eugenio Perez Martin
2024-04-04 19:06                               ` Sahil
2024-04-14 18:52                                 ` Sahil
2024-04-15  8:57                                   ` Eugenio Perez Martin
2024-04-15 19:42                                     ` Sahil
2024-04-16  8:41                                       ` Eugenio Perez Martin
2024-04-17  4:23                                         ` Sahil
2024-05-06 19:00                                           ` Sahil
2024-05-07  7:14                                             ` Eugenio Perez Martin
2024-05-08  3:23                                               ` Sahil
2024-05-13 13:49                                                 ` Sahil
2024-05-13 14:23                                                   ` Eugenio Perez Martin [this message]
2024-05-13 18:04                                                     ` Sahil
2024-03-20 15:57               ` Eugenio Perez Martin

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=CAJaqyWfbHgVA7f81C6phouSUEb7bVwXFRDWTHeie7Vax13zWZw@mail.gmail.com \
    --to=eperezma@redhat.com \
    --cc=icegambit91@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sgarzare@redhat.com \
    /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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).