Re: [PATCH 3/3] vhost_vdpa: support PACKED when setting-getting vring_base

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


On 4/22/23 11:40 PM, Jason Wang wrote:
On Sat, Apr 22, 2023 at 3:57 AM Shannon Nelson <shannon.nelson@xxxxxxx> wrote:

Use the right structs for PACKED or split vqs when setting and
getting the vring base.

Signed-off-by: Shannon Nelson <shannon.nelson@xxxxxxx>
  drivers/vhost/vdpa.c | 19 +++++++++++++++----
  1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
index 599b8cc238c7..2543ae9d5939 100644
--- a/drivers/vhost/vdpa.c
+++ b/drivers/vhost/vdpa.c
@@ -585,7 +585,12 @@ static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cmd,
                 if (r)
                         return r;

-               vq->last_avail_idx = vq_state.split.avail_index;
+               if (vhost_has_feature(vq, VIRTIO_F_RING_PACKED)) {
+                       vq->last_avail_idx = vq_state.packed.last_avail_idx;
+                       vq->last_used_idx = vq_state.packed.last_used_idx;

I wonder if the compiler will guarantee a piggyback for the wrap
counter here? If not, should we explicitly packing wrap counter?

Yes, good catch, I'll add the wrap counter.

Virtualization mailing list

[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux