From 097691fc182def4ef73e7ae24facf04e64d600e0 Mon Sep 17 00:00:00 2001 From: Changpeng Liu Date: Mon, 5 Sep 2022 10:05:16 +0800 Subject: [PATCH] vhost: do `rte_vhost_vring_call` from spdk context Currently we will call `rte_vhost_vring_call` in the DPDK "vhost-events" thread context when starting the device, and DPDK vhost library already holds all VQ's access lock when starting device, with new DPDK/dpdk@c573699 commit, it will cause deadlock to call `rte_vhost_vring_call` in "vhost-events" context, so here we increase 1 to `used_req_cnt` to make sure one more `rte_vhost_vring_call` will be executed later in SPDK thread context. Signed-off-by: Jim Harris Signed-off-by: Changpeng Liu Change-Id: Iab53941942335744bf25ab6e9b8747bd08b0c698 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14328 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Dong Yi Reviewed-by: Shuhei Matsumoto Reviewed-by: Tomasz Zawadzki --- lib/vhost/rte_vhost_user.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/vhost/rte_vhost_user.c b/lib/vhost/rte_vhost_user.c index 21c9ec549..eae22895c 100644 --- a/lib/vhost/rte_vhost_user.c +++ b/lib/vhost/rte_vhost_user.c @@ -1051,7 +1051,11 @@ start_device(int vid) * so q->vring.desc can replace q->vring.desc_packed. */ if (q->vring.desc != NULL && q->vring.size > 0) { - rte_vhost_vring_call(vsession->vid, q->vring_idx); + /* Make sure a successful call of + * `rte_vhost_vring_call` will happen + * after starting the device. + */ + q->used_req_cnt += 1; } }