vhost: fix missing cache logging NUMA realloc
authorMaxime Coquelin <maxime.coquelin@redhat.com>
Tue, 29 Jun 2021 16:11:29 +0000 (18:11 +0200)
committerChenbo Xia <chenbo.xia@intel.com>
Wed, 30 Jun 2021 11:32:13 +0000 (13:32 +0200)
When the guest allocates virtqueues on a different NUMA node
than the one the Vhost metadata are allocated, both the Vhost
device struct and the virtqueues struct are reallocated.

However, reallocating the log cache on the new NUMA node was
not done. This patch fixes this by reallocating it if it has
been allocated already, which means a live-migration is
on-going.

Fixes: 1818a63147fb ("vhost: move dirty logging cache out of virtqueue")
Cc: stable@dpdk.org
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
lib/vhost/vhost_user.c

index 5fb055e..82adf80 100644 (file)
@@ -545,6 +545,16 @@ numa_realloc(struct virtio_net *dev, int index)
                        vq->batch_copy_elems = new_batch_copy_elems;
                }
 
+               if (vq->log_cache) {
+                       struct log_cache_entry *log_cache;
+
+                       log_cache = rte_realloc_socket(vq->log_cache,
+                                       sizeof(struct log_cache_entry) * VHOST_LOG_CACHE_NR,
+                                       0, newnode);
+                       if (log_cache)
+                               vq->log_cache = log_cache;
+               }
+
                rte_free(old_vq);
        }