vhost: fix IOTLB on NUMA realloc
authorMaxime Coquelin <maxime.coquelin@redhat.com>
Thu, 12 Oct 2017 15:38:50 +0000 (17:38 +0200)
committerThomas Monjalon <thomas@monjalon.net>
Fri, 13 Oct 2017 20:08:21 +0000 (22:08 +0200)
In case of NUMA reallocation, virtqueue's iotlb list is broken,
has its head changes but first iotlb entry in the list still points
to the previous head pointer.

Also, in case of reallocation, we want the IOTLB cache mempool to be
on the new socket.

This patch perform a full re-init of the IOTLB cache when mempool
already exists, and calls the IOTLB cache init function in case
the virtqueue is being reallocated on a new socket.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Jens Freimann <jfreimann@redhat.com>
lib/librte_vhost/iotlb.c
lib/librte_vhost/vhost_user.c

index 05c278040f2d2a71006662951f77536912c17661..b74cc6a78f8d340ec721cb741236dde1402d3177 100644 (file)
@@ -309,7 +309,6 @@ vhost_user_iotlb_init(struct virtio_net *dev, int vq_index)
                 */
                vhost_user_iotlb_cache_remove_all(vq);
                vhost_user_iotlb_pending_remove_all(vq);
-               return 0;
        }
 
 #ifdef RTE_LIBRTE_VHOST_NUMA
index 9acac6125b98e92800c77e7048991b36c4d14bd1..1dfb234ca16b8b20101d8bb1e0ec6ee5c147826f 100644 (file)
@@ -314,6 +314,9 @@ out:
        dev->virtqueue[index] = vq;
        vhost_devices[dev->vid] = dev;
 
+       if (old_vq != vq)
+               vhost_user_iotlb_init(dev, index);
+
        return dev;
 }
 #else