From: Sahil Siddiq <icegambit91@gmail.com>
To: eperezma@redhat.com, sgarzare@redhat.com
Cc: mst@redhat.com, qemu-devel@nongnu.org, Sahil Siddiq <sahilcdq@proton.me>
Subject: [RFC v2 0/3] Add packed virtqueue to shadow virtqueue
Date: Fri, 26 Jul 2024 15:28:19 +0530 [thread overview]
Message-ID: <20240726095822.104017-1-sahilcdq@proton.me> (raw)
Hi,
I have made some progress in this project and thought I would
send these changes first before continuing. I split patch v1 [1]
into two commits (#1 and #2) to make it easy to review. There are
very few changes in the first commit. The second commit has not
changes.
There are a few things that I am not entirely sure of in commit #3.
Q1.
In virtio_ring.h [2], new aliases with memory alignment enforcement
such as "vring_desc_t" have been created. I am not sure if this
is required for the packed vq descriptor ring (vring_packed_desc)
as well. I don't see a type alias that enforces memory alignment
for "vring_packed_desc" in the linux kernel. I haven't used any
alias either.
Q2.
I see that parts of the "vhost-vdpa" implementation is based on
the assumption that SVQ uses the split vq format. For example,
"vhost_vdpa_svq_map_rings" [3], calls "vhost_svq_device_area_size"
which is specific to split vqs. The "vhost_vring_addr" [4] struct
is also specific to split vqs.
My idea is to have a generic "vhost_vring_addr" structure that
wraps around split and packed vq specific structures, rather
than using them directly in if-else conditions wherever the
vhost-vdpa functions require their usage. However, this will
involve checking their impact in several other places where this
struct is currently being used (eg.: "vhost-user", "vhost-backend",
"libvhost-user").
Is this approach alright or is there a better alternative? I would
like to get your thoughts on this before working on this portion of
the project.
Thanks,
Sahil
[1] https://lists.nongnu.org/archive/html/qemu-devel/2024-06/msg03417.html
[2] https://gitlab.com/qemu-project/qemu/-/blob/master/include/standard-headers/linux/virtio_ring.h#L149
[3] https://gitlab.com/qemu-project/qemu/-/blob/master/hw/virtio/vhost-vdpa.c#L1178
[4] https://gitlab.com/qemu-project/qemu/-/blob/master/include/standard-headers/linux/vhost_types.h#L30
Changes v1 -> v2:
* Split commit from RFC v1 into two commits.
* vhost-shadow-virtqueue.c
(vhost_svq_add_packed):
- Merge with "vhost_svq_vring_write_descs_packed()"
- Remove "num == 0" check
(vhost_svq_add): Use "is_packed" to check vq format.
(vhost_svq_get_vring_addr): Rename function.
(vhost_svq_get_vring_addr_packed): New function but is yet to be implemented.
(vhost_svq_memory_packed): New function.
(vhost_svq_start): Support packed vq format.
* vhost-shadow-virtqueue.h
(struct VhostShadowVirtqueue): New member "is_packed"
(vhost_svq_get_vring_addr): Renamed function.
(vhost_svq_get_vring_addr_packed): New function.
(vhost_svq_memory_packed): Likewise.
* vhost-vdpa.c
(vhost_svq_get_vring_addr): Rename function.
Sahil Siddiq (3):
vhost: Introduce packed vq and add buffer elements
vhost: Data structure changes to support packed vqs
vhost: Allocate memory for packed vring.
hw/virtio/vhost-shadow-virtqueue.c | 161 ++++++++++++++++++++++++++---
hw/virtio/vhost-shadow-virtqueue.h | 76 +++++++++-----
hw/virtio/vhost-vdpa.c | 4 +-
3 files changed, 198 insertions(+), 43 deletions(-)
--
2.45.2
next reply other threads:[~2024-07-26 9:59 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-26 9:58 Sahil Siddiq [this message]
2024-07-26 9:58 ` [RFC v2 1/3] vhost: Introduce packed vq and add buffer elements Sahil Siddiq
2024-07-26 13:48 ` Eugenio Perez Martin
2024-07-28 17:37 ` Sahil
2024-07-29 8:21 ` Eugenio Perez Martin
2024-08-02 11:26 ` Sahil
2024-07-26 9:58 ` [RFC v2 2/3] vhost: Data structure changes to support packed vqs Sahil Siddiq
2024-07-26 9:58 ` [RFC v2 3/3] vhost: Allocate memory for packed vring Sahil Siddiq
2024-07-26 14:28 ` Eugenio Perez Martin
2024-07-28 13:41 ` Sahil
2024-07-26 13:40 ` [RFC v2 0/3] Add packed virtqueue to shadow virtqueue Eugenio Perez Martin
2024-07-26 17:11 ` Sahil
2024-07-26 18:25 ` Eugenio Perez Martin
2024-07-28 16:42 ` Sahil
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=20240726095822.104017-1-sahilcdq@proton.me \
--to=icegambit91@gmail.com \
--cc=eperezma@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=sahilcdq@proton.me \
--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 NNTP newsgroup(s).