From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marvin Liu Subject: [PATCH v2] examples/vhost: workaround qemu abort Date: Wed, 25 Jul 2018 17:56:54 +0800 Message-ID: <20180725095654.66498-1-yong.liu@intel.com> References: <20180724151649.44490-1-yong.liu@intel.com> Cc: Marvin Liu To: tiwei.bie@intel.com, dev@dpdk.org Return-path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 9362A160 for ; Wed, 25 Jul 2018 04:12:02 +0200 (CEST) In-Reply-To: <20180724151649.44490-1-yong.liu@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Current qemu vhost net ring start has a dependency on feature bit VHOST_USER_F_PROTOCOL_FEATURES. If vhost device start without it, stop action will be skipped. Consequently, same ioevent fd will be added twice after reloading driver and then cause qemu abort. However, ring should be initialized in an enabled state when this feature bit not negotiated. Work around qemu issue by enabling this feature bit in vhost user backend. Signed-off-by: Marvin Liu diff --git a/examples/vhost/main.c b/examples/vhost/main.c index 2175c1186..4b87331fc 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -1519,8 +1519,12 @@ main(int argc, char *argv[]) "vhost driver register failure.\n"); } - if (builtin_net_driver) + if (builtin_net_driver) { rte_vhost_driver_set_features(file, VIRTIO_NET_FEATURES); + /* Workaround for qemu vhost net device startup */ + rte_vhost_driver_set_features(file, + 1ULL << VHOST_USER_F_PROTOCOL_FEATURES); + } if (mergeable == 0) { rte_vhost_driver_disable_features(file, -- 2.17.0