[RFC v2 0/7] vDPA shadow virtqueue - notifications forwarding

Eugenio Pérez posted 7 patches 3 years, 2 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20210209153757.1653598-1-eperezma@redhat.com
Test checkpatch failed
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>
qapi/net.json                      |  22 ++++
hw/virtio/vhost-shadow-virtqueue.h |  33 +++++
include/hw/virtio/vhost.h          |   5 +
include/hw/virtio/virtio.h         |   1 +
hw/virtio/vhost-shadow-virtqueue.c | 205 +++++++++++++++++++++++++++++
hw/virtio/vhost.c                  | 159 +++++++++++++++++++++-
hw/virtio/virtio.c                 |   5 +
hw/virtio/meson.build              |   2 +-
8 files changed, 430 insertions(+), 2 deletions(-)
create mode 100644 hw/virtio/vhost-shadow-virtqueue.h
create mode 100644 hw/virtio/vhost-shadow-virtqueue.c
[RFC v2 0/7] vDPA shadow virtqueue - notifications forwarding
Posted by Eugenio Pérez 3 years, 2 months ago
This series enable vhost (And vhost-vdpa) notifications forwarding for
software assisted live migration, implemented through a shadow
virtqueue.

Shadow virtqueue is a new method of tracking memory for migration:
Instead of relay on vDPA device's dirty logging capability, SW assisted
LM intercepts dataplane, forwarding the descriptors between VM and
device.

In this migration mode, qemu offers a new (shadow) vring to the device
to read and write into, and forwards descriptors between host vring
and qemu one. On used buffer relay, qemu will mark the dirty memory as
with plain virtio-net devices. This way, devices does not need to have
dirty page logging capability.

This RFC series just enables just the notifications forwarding part,
not buffer forwarding/tracking.

It is based on the ideas of DPDK SW assisted LM, in the series of
DPDK's https://patchwork.dpdk.org/cover/48370/ , but will use memory in
qemu Virtual Address Space for rings, instead of in guest's.

Comments are welcome.

Thanks!

v2: Fix non matching comments on qapi/net.json (Eric).
    Delete virtio_queue_get_idx and use already available
        virtio_get_queue_index (Jason).
    Do not check on used notification enable flag, since we need to
        particularize for each virtqueue layout and IOMMU, and it is
        unlikely for this code to be in final version.
    Handle multiqueue devices.
    Delete trailing dot in previous errpr_setg argument

Main changes from previous RFC [1] are:
* Use QMP to enable. Can disable through QMP too.
* Do not use vhost_dev_{enable,disable}_notifiers, since they override
  the VM ioeventfd set, and could cause race conditions. Do never modify
  irqfd or ioeventfd used for the guest.

[1] https://patchew.org/QEMU/20201120185105.279030-1-eperezma@redhat.com/

Eugenio Pérez (7):
  vhost: Delete trailing dot in errpr_setg argument
  virtio: Add virtio_queue_host_notifier_status
  vhost: Save masked_notifier state
  vhost: Add VhostShadowVirtqueue
  vhost: Add x-vhost-enable-shadow-vq qmp
  vhost: Route guest->host notification through shadow virtqueue
  vhost: Route host->guest notification through shadow virtqueue

 qapi/net.json                      |  22 ++++
 hw/virtio/vhost-shadow-virtqueue.h |  33 +++++
 include/hw/virtio/vhost.h          |   5 +
 include/hw/virtio/virtio.h         |   1 +
 hw/virtio/vhost-shadow-virtqueue.c | 205 +++++++++++++++++++++++++++++
 hw/virtio/vhost.c                  | 159 +++++++++++++++++++++-
 hw/virtio/virtio.c                 |   5 +
 hw/virtio/meson.build              |   2 +-
 8 files changed, 430 insertions(+), 2 deletions(-)
 create mode 100644 hw/virtio/vhost-shadow-virtqueue.h
 create mode 100644 hw/virtio/vhost-shadow-virtqueue.c

-- 
2.27.0


Re: [RFC v2 0/7] vDPA shadow virtqueue - notifications forwarding
Posted by no-reply@patchew.org 3 years, 2 months ago
Patchew URL: https://patchew.org/QEMU/20210209153757.1653598-1-eperezma@redhat.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 20210209153757.1653598-1-eperezma@redhat.com
Subject: [RFC v2 0/7] vDPA shadow virtqueue - notifications forwarding

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 * [new tag]         patchew/1612868085-72809-1-git-send-email-bmeng.cn@gmail.com -> patchew/1612868085-72809-1-git-send-email-bmeng.cn@gmail.com
 * [new tag]         patchew/1612950879-49023-1-git-send-email-bmeng.cn@gmail.com -> patchew/1612950879-49023-1-git-send-email-bmeng.cn@gmail.com
 * [new tag]         patchew/1612956141-63712-1-git-send-email-bmeng.cn@gmail.com -> patchew/1612956141-63712-1-git-send-email-bmeng.cn@gmail.com
Switched to a new branch 'test'
0c0f4f0 vhost: Route host->guest notification through shadow virtqueue
ad1a0b1 vhost: Route guest->host notification through shadow virtqueue
abfe6ae vhost: Add x-vhost-enable-shadow-vq qmp
b3b7544 vhost: Add VhostShadowVirtqueue
cc4e481 vhost: Save masked_notifier state
5237982 virtio: Add virtio_queue_host_notifier_status
fd946d9 vhost: Delete trailing dot in errpr_setg argument

=== OUTPUT BEGIN ===
1/7 Checking commit fd946d9a576c (vhost: Delete trailing dot in errpr_setg argument)
ERROR: Missing Signed-off-by: line(s)

total: 1 errors, 0 warnings, 8 lines checked

Patch 1/7 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

2/7 Checking commit 523798209c6a (virtio: Add virtio_queue_host_notifier_status)
3/7 Checking commit cc4e48155cfa (vhost: Save masked_notifier state)
4/7 Checking commit b3b75447560c (vhost: Add VhostShadowVirtqueue)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#32: 
new file mode 100644

total: 0 errors, 1 warnings, 95 lines checked

Patch 4/7 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
5/7 Checking commit abfe6ae82846 (vhost: Add x-vhost-enable-shadow-vq qmp)
6/7 Checking commit ad1a0b1c0b05 (vhost: Route guest->host notification through shadow virtqueue)
7/7 Checking commit 0c0f4f08a1ef (vhost: Route host->guest notification through shadow virtqueue)
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20210209153757.1653598-1-eperezma@redhat.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
Re: [RFC v2 0/7] vDPA shadow virtqueue - notifications forwarding
Posted by Eugenio Perez Martin 3 years, 2 months ago
Jason,

Correct me if I'm wrong. Based on this series, is your proposal to
move the touched functions in vhost.c [1] to vhost_ops, so they will
become backend-dependent operations, and then develop shadow vq
backend to intercept them?

Other code would also move to that new backend, like the setup/teardown.

[1] vhost_virtqueue_mask and vhost_dev_disable_notifiers