From 2725b5191eccae3d444cb98497dc29bbcdea6c21 Mon Sep 17 00:00:00 2001 From: Darek Stojaczyk Date: Mon, 25 Feb 2019 09:55:59 +0100 Subject: [PATCH] virtio/user: don't send SET_VRING_ADDR after updating the memory table Our internal rte_vhost lib requires SET_VRING_ADDR to flush a pending SET_MEM_TABLE. On the other hand, the upstream rte_vhost will invalidate the entire queue upon receiving SET_VRING_ADDR message, so we mustn't send it at runtime. Both behaviors are strictly implementation specific, but this message isn't needed by the spec, so send it only if vhost was compiled with our internal lib. Change-Id: I200b99a1dd5124bdebd104e69ae1b012a974ab6f Signed-off-by: Darek Stojaczyk Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/446087 Tested-by: SPDK CI Jenkins Reviewed-by: Changpeng Liu Reviewed-by: Jim Harris Reviewed-by: Ben Walker --- lib/virtio/virtio_user.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/virtio/virtio_user.c b/lib/virtio/virtio_user.c index d9975eec1..006df120d 100644 --- a/lib/virtio/virtio_user.c +++ b/lib/virtio/virtio_user.c @@ -165,13 +165,19 @@ virtio_user_map_notify(void *cb_ctx, struct spdk_mem_map *map, return ret; } - /* We have to send SET_VRING_ADDR to make rte_vhost flush a pending - * SET_MEM_TABLE... +#ifdef SPDK_CONFIG_VHOST_INTERNAL_LIB + /* Our internal rte_vhost lib requires SET_VRING_ADDR to flush a pending + * SET_MEM_TABLE. On the other hand, the upstream rte_vhost will invalidate + * the entire queue upon receiving SET_VRING_ADDR message, so we mustn't + * send it here. Both behaviors are strictly implementation specific, but + * this message isn't needed from the point of the spec, so send it only + * if vhost is compiled with our internal lib. */ ret = virtio_user_queue_setup(vdev, virtio_user_set_vring_addr); if (ret < 0) { return ret; } +#endif /* Since we might want to use that mapping straight away, we have to * make sure the guest has already processed our SET_MEM_TABLE message.