Skip to content

vdpa-net: improve migration downtime through descriptor ASID and persistent IOTLB

Si-Wei Liu qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest40 patches 61 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/40linux-headers: add vhost_types.h and vhost.hinclude/standard-headers/linux/vhost_types.h linux-headers/linux/vhost.h+22 -02 replies
2/40vdpa: add vhost_vdpa_get_vring_desc_groupnet/vhost-vdpa.c+19 -01 reply
3/40vdpa: probe descriptor group index for data vqsnet/vhost-vdpa.c+89 -02 replies
4/40vdpa: piggyback desc_group index when probing isolated cvqnet/vhost-vdpa.c+17 -41 reply
5/40vdpa: populate desc_group from net_vhost_vdpa_initinclude/hw/virtio/vhost-vdpa.h net/vhost-vdpa.c+14 -23 replies
6/40vhost: make svq work with gpa without iova translationhw/virtio/vhost-shadow-virtqueue.c+23 -122 replies
7/40vdpa: move around vhost_vdpa_set_address_space_idnet/vhost-vdpa.c+18 -182 replies
8/40vdpa: add back vhost_vdpa_net_first_nc_vdpanet/vhost-vdpa.c+13 -22 replies
9/40vdpa: no repeat setting shadow_datanet/vhost-vdpa.c+1 -22 replies
10/40vdpa: assign svq descriptors a separate ASID when possiblehw/virtio/vhost-vdpa.c net/vhost-vdpa.c+57 -52 replies
11/40vdpa: factor out vhost_vdpa_last_devhw/virtio/vhost-vdpa.c+7 -22 replies
12/40vdpa: check map_thread_enabled before join maps threadhw/virtio/vhost-vdpa.c+1 -10 replies
13/40vdpa: ref counting VhostVDPASharedinclude/hw/virtio/vhost-vdpa.h net/vhost-vdpa.c+12 -41 reply
14/40vdpa: convert iova_tree to ref count basednet/vhost-vdpa.c+2 -72 replies
15/40vdpa: add svq_switching and flush_map to headerinclude/hw/virtio/vhost-vdpa.h+6 -01 reply
16/40vdpa: indicate SVQ switching via flagnet/vhost-vdpa.c+2 -01 reply
17/40vdpa: judge if map can be kept across resetnet/vhost-vdpa.c+40 -02 replies
18/40vdpa: unregister listener on last dev cleanuphw/virtio/vhost-vdpa.c+4 -12 replies
19/40vdpa: should avoid map flushing with persistent iotlbhw/virtio/trace-events hw/virtio/vhost-vdpa.c+21 -01 reply
20/40vdpa: avoid mapping flush across resethw/virtio/vhost-vdpa.c+2 -51 reply
21/40vdpa: vhost_vdpa_dma_batch_end_once renamehw/virtio/vhost-vdpa.c+3 -32 replies
22/40vdpa: factor out vhost_vdpa_map_batch_beginhw/virtio/trace-events hw/virtio/vhost-vdpa.c+17 -101 reply
23/40vdpa: vhost_vdpa_dma_batch_begin_once renamehw/virtio/vhost-vdpa.c+4 -41 reply
24/40vdpa: factor out vhost_vdpa_dma_batch_endhw/virtio/trace-events hw/virtio/vhost-vdpa.c+19 -131 reply
25/40vdpa: add asid to dma_batch_once APIhw/virtio/trace-events hw/virtio/vhost-vdpa.c+10 -82 replies
26/40vdpa: return int for dma_batch_once APIhw/virtio/vhost-vdpa.c+9 -50 replies
27/40vdpa: add asid to all dma_batch call siteshw/virtio/vhost-vdpa.c+9 -90 replies
28/40vdpa: support iotlb_batch_asidhw/virtio/vhost-vdpa.c include/hw/virtio/vhost-vdpa.h net/vhost-vdpa.c+21 -62 replies
29/40vdpa: expose API vhost_vdpa_dma_batch_oncehw/virtio/vhost-vdpa.c include/hw/virtio/vhost-vdpa.h+18 -62 replies
30/40vdpa: batch map/unmap op per svq pair basishw/virtio/vhost-vdpa.c+5 -01 reply
31/40vdpa: batch map and unmap around cvq svq start/stopnet/vhost-vdpa.c+7 -11 reply
32/40vdpa: factor out vhost_vdpa_net_get_nc_vdpanet/vhost-vdpa.c+9 -41 reply
33/40vdpa: batch multiple dma_unmap to a single call for vm stophw/virtio/vhost-vdpa.c include/hw/virtio/vhost-vdpa.h net/vhost-vdpa.c+80 -422 replies
34/40vdpa: fix network breakage after cancelling migrationhw/virtio/vhost-vdpa.c+6 -11 reply
35/40vdpa: add vhost_vdpa_set_address_space_id tracenet/trace-events net/vhost-vdpa.c+6 -02 replies
36/40vdpa: add vhost_vdpa_get_vring_base trace for svq modehw/virtio/trace-events hw/virtio/vhost-vdpa.c+3 -22 replies
37/40vdpa: add vhost_vdpa_set_dev_vring_base trace for svq modehw/virtio/trace-events hw/virtio/vhost-vdpa.c+5 -22 replies
38/40vdpa: add trace events for eval_flushnet/trace-events net/vhost-vdpa.c+9 -01 reply
39/40vdpa: add trace events for vhost_vdpa_net_load_cmdnet/trace-events net/vhost-vdpa.c+4 -01 reply
40/40vdpa: add trace event for vhost_vdpa_net_load_mqnet/trace-events net/vhost-vdpa.c+3 -02 replies

Reviews trailers per patch

16 of 40 patches have a Reviewed-by or Acked-by.

PatchEugenio PérezJason Wang
1/40
2/40A-b
3/40
4/40
5/40
6/40R-b
7/40R-b A-b
8/40R-b
9/40R-b A-b
10/40
11/40R-b A-b
12/40
13/40
14/40
15/40
16/40
17/40
18/40
19/40
20/40
21/40
22/40A-b
23/40
24/40
25/40
26/40
27/40
28/40
29/40
30/40A-b
31/40A-b
32/40A-b
33/40
34/40A-b
35/40R-b
36/40R-b A-b
37/40R-b A-b
38/40
39/40R-b
40/40R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 00/40] vdpa-net: improve migration downtime through descriptor ASID and persistent IOTLB

This patch series contain several enhancements to SVQ live migration downtime for vDPA-net hardware device, specifically on mlx5_vdpa. Currently it is based off of Eugenio's RFC v2 .load_setup series [1] to utilize the shared facility and reduce frictions in merging or duplicating code if at all possible.

It's stacked up in particular order as below, as the optimization for one on the top has to depend on others on the bottom. Here's a breakdown for what each part does respectively:

Patch # | Feature / optimization
---------V-------------------------------------------------------------------

35 - 40  | trace events
34       | migrate_cancel bug fix
21 - 33  | (Un)map batching at stop-n-copy to further optimize LM down time
11 - 20  | persistent IOTLB [3] to improve LM down time
02 - 10  | SVQ descriptor ASID [2] to optimize SVQ switching
01       | dependent linux headers

V

Let's first define 2 sources of downtime that this work is concerned with:

* SVQ switching downtime (Downtime #1): downtime at the start of migration. Time spent on teardown and setup for SVQ mode switching, and this downtime is regarded as the maxium time for an individual vdpa-net device. No memory transfer is involved during SVQ switching, hence no .

* LM downtime (Downtime #2): aggregated downtime for all vdpa-net devices on resource teardown and setup in the last stop-n-copy phase on source host.

With each part of the optimizations applied bottom up, the effective outcome in terms of down time (in seconds) performance can be observed in this table:

| Downtime #1 | Downtime #2
--------------------+-------------------+-------------------

Baseline QEMU       |     20s ~ 30s     |        20s
                    |                   |
Iterative map       |                   |
at destination[1]   |        5s         |        20s
                    |                   |
SVQ descriptor      |                   |
    ASID [2]        |        2s         |         5s
                    |                   |
                    |                   |
persistent IOTLB    |        2s         |         2s
      [3]           |                   |
                    |                   |
(Un)map batching    |                   |
at stop-n-copy      |      1.7s         |       1.5s 
before switchover   |                   |

(VM config: 128GB mem, 2 mlx5_vdpa devices, each w/ 4 data vqs)

Please find the details regarding each enhancement on the commit log.

Thanks,
-Siwei

[1] [RFC PATCH v2 00/10] Map memory at destination .load_setup in vDPA-net migration
https://lists.nongnu.org/archive/html/qemu-devel/2023-11/msg05711.html
[2] VHOST_BACKEND_F_DESC_ASID
https://lore.kernel.org/virtualization/[email protected]/
[3] VHOST_BACKEND_F_IOTLB_PERSIST
https://lore.kernel.org/virtualization/[email protected]/

---

Si-Wei Liu (40):
linux-headers: add vhost_types.h and vhost.h
vdpa: add vhost_vdpa_get_vring_desc_group
vdpa: probe descriptor group index for data vqs
vdpa: piggyback desc_group index when probing isolated cvq
vdpa: populate desc_group from net_vhost_vdpa_init
vhost: make svq work with gpa without iova translation
vdpa: move around vhost_vdpa_set_address_space_id
vdpa: add back vhost_vdpa_net_first_nc_vdpa
vdpa: no repeat setting shadow_data
vdpa: assign svq descriptors a separate ASID when possible
vdpa: factor out vhost_vdpa_last_dev
vdpa: check map_thread_enabled before join maps thread
vdpa: ref counting VhostVDPAShared
vdpa: convert iova_tree to ref count based
vdpa: add svq_switching and flush_map to header
vdpa: indicate SVQ switching via flag
vdpa: judge if map can be kept across reset
vdpa: unregister listener on last dev cleanup
vdpa: should avoid map flushing with persistent iotlb
vdpa: avoid mapping flush across reset
vdpa: vhost_vdpa_dma_batch_end_once rename
vdpa: factor out vhost_vdpa_map_batch_begin
vdpa: vhost_vdpa_dma_batch_begin_once rename
vdpa: factor out vhost_vdpa_dma_batch_end
vdpa: add asid to dma_batch_once API
vdpa: return int for dma_batch_once API
vdpa: add asid to all dma_batch call sites
vdpa: support iotlb_batch_asid
vdpa: expose API vhost_vdpa_dma_batch_once
vdpa: batch map/unmap op per svq pair basis
vdpa: batch map and unmap around cvq svq start/stop
vdpa: factor out vhost_vdpa_net_get_nc_vdpa
vdpa: batch multiple dma_unmap to a single call for vm stop
vdpa: fix network breakage after cancelling migration
vdpa: add vhost_vdpa_set_address_space_id trace
vdpa: add vhost_vdpa_get_vring_base trace for svq mode
vdpa: add vhost_vdpa_set_dev_vring_base trace for svq mode
vdpa: add trace events for eval_flush
vdpa: add trace events for vhost_vdpa_net_load_cmd
vdpa: add trace event for vhost_vdpa_net_load_mq

 hw/virtio/trace-events                       |   9 +-
 hw/virtio/vhost-shadow-virtqueue.c           |  35 ++-
 hw/virtio/vhost-vdpa.c                       | 156 +++++++---
 include/hw/virtio/vhost-vdpa.h               |  16 +
 include/standard-headers/linux/vhost_types.h |  13 +
 linux-headers/linux/vhost.h                  |   9 +
 net/trace-events                             |   8 +
 net/vhost-vdpa.c                             | 434 ++++++++++++++++++++++-----
 8 files changed, 558 insertions(+), 122 deletions(-)
Signature · 1 line
1.8.3.1