[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 11/14] vdpa: block migration if device has unsupported feature
From: |
Eugenio Pérez |
Subject: |
[PATCH v3 11/14] vdpa: block migration if device has unsupported features |
Date: |
Wed, 15 Feb 2023 18:38:47 +0100 |
A vdpa net device must initialize with SVQ in order to be migratable at
this moment, and initialization code verifies some conditions. If the
device is not initialized with the x-svq parameter, it will not expose
_F_LOG so the vhost subsystem will block VM migration from its
initialization.
Next patches change this, so we need to verify migration conditions
differently.
QEMU only supports a subset of net features in SVQ, and it cannot
migrate state that cannot track or restore in the destination. Add a
migration blocker if the device offer an unsupported feature.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
v3: add mirgation blocker properly so vhost_dev can handle it.
---
net/vhost-vdpa.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index 9312329167..b26b611b6c 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -807,7 +807,8 @@ static NetClientState *net_vhost_vdpa_init(NetClientState
*peer,
int nvqs,
bool is_datapath,
bool svq,
- struct vhost_vdpa_iova_range iova_range)
+ struct vhost_vdpa_iova_range iova_range,
+ uint64_t features)
{
NetClientState *nc = NULL;
VhostVDPAState *s;
@@ -830,7 +831,10 @@ static NetClientState *net_vhost_vdpa_init(NetClientState
*peer,
s->vhost_vdpa.shadow_vqs_enabled = svq;
s->vhost_vdpa.iova_range = iova_range;
s->vhost_vdpa.shadow_data = svq;
- if (!is_datapath) {
+ if (queue_pair_index == 0) {
+ vhost_vdpa_net_valid_svq_features(features,
+ &s->vhost_vdpa.migration_blocker);
+ } else if (!is_datapath) {
s->cvq_cmd_out_buffer = qemu_memalign(qemu_real_host_page_size(),
vhost_vdpa_net_cvq_cmd_page_len());
memset(s->cvq_cmd_out_buffer, 0, vhost_vdpa_net_cvq_cmd_page_len());
@@ -963,7 +967,7 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char
*name,
for (i = 0; i < queue_pairs; i++) {
ncs[i] = net_vhost_vdpa_init(peer, TYPE_VHOST_VDPA, name,
vdpa_device_fd, i, 2, true, opts->x_svq,
- iova_range);
+ iova_range, features);
if (!ncs[i])
goto err;
}
@@ -971,7 +975,7 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char
*name,
if (has_cvq) {
nc = net_vhost_vdpa_init(peer, TYPE_VHOST_VDPA, name,
vdpa_device_fd, i, 1, false,
- opts->x_svq, iova_range);
+ opts->x_svq, iova_range, features);
if (!nc)
goto err;
}
--
2.31.1
- [PATCH v3 00/14] Dynamically switch to vhost shadow virtqueues at vdpa net migration, Eugenio Pérez, 2023/02/15
- [PATCH v3 01/14] vdpa net: move iova tree creation from init to start, Eugenio Pérez, 2023/02/15
- [PATCH v3 02/14] vdpa: stop svq at vhost_vdpa_dev_start(false), Eugenio Pérez, 2023/02/15
- [PATCH v3 03/14] vdpa: Negotiate _F_SUSPEND feature, Eugenio Pérez, 2023/02/15
- [PATCH v3 04/14] vdpa: add vhost_vdpa_suspend, Eugenio Pérez, 2023/02/15
- [PATCH v3 05/14] vdpa: move vhost reset after get vring base, Eugenio Pérez, 2023/02/15
- [PATCH v3 06/14] vdpa: rewind at get_base, not set_base, Eugenio Pérez, 2023/02/15
- [PATCH v3 07/14] vdpa net: allow VHOST_F_LOG_ALL, Eugenio Pérez, 2023/02/15
- [PATCH v3 08/14] vdpa: add vdpa net migration state notifier, Eugenio Pérez, 2023/02/15
- [PATCH v3 10/14] vdpa net: block migration if the device has CVQ, Eugenio Pérez, 2023/02/15
- [PATCH v3 11/14] vdpa: block migration if device has unsupported features,
Eugenio Pérez <=
- [PATCH v3 12/14] vdpa: block migration if dev does not have _F_SUSPEND, Eugenio Pérez, 2023/02/15
- [PATCH v3 13/14] vdpa: block migration if SVQ does not admit a feature, Eugenio Pérez, 2023/02/15
- [PATCH v3 14/14] vdpa: return VHOST_F_LOG_ALL in vhost-vdpa devices, Eugenio Pérez, 2023/02/15
- [PATCH v3 09/14] vdpa: disable RAM block discard only for the first device, Eugenio Pérez, 2023/02/15