From patchwork Thu Oct 11 09:24:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Coquelin X-Patchwork-Id: 46561 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E7E681B19D; Thu, 11 Oct 2018 11:26:42 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 078B11B183; Thu, 11 Oct 2018 11:26:41 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4FC8030E5F8D; Thu, 11 Oct 2018 09:26:40 +0000 (UTC) Received: from localhost.localdomain (ovpn-112-55.ams2.redhat.com [10.36.112.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1B36F8FC0D; Thu, 11 Oct 2018 09:26:33 +0000 (UTC) From: Maxime Coquelin To: dev@dpdk.org, tiwei.bie@intel.com, zhihong.wang@intel.com, jfreimann@redhat.com, nicknickolaev@gmail.com, i.maximets@samsung.com, bruce.richardson@intel.com, alejandro.lucero@netronome.com Cc: dgilbert@redhat.com, stable@dpdk.org, Maxime Coquelin Date: Thu, 11 Oct 2018 11:24:31 +0200 Message-Id: <20181011092432.22275-19-maxime.coquelin@redhat.com> In-Reply-To: <20181011092432.22275-1-maxime.coquelin@redhat.com> References: <20181011092432.22275-1-maxime.coquelin@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Thu, 11 Oct 2018 09:26:40 +0000 (UTC) Subject: [dpdk-dev] [PATCH v6 18/19] net/vhost: add parameter to enable postcopy support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Introduce a new postcopy-support parameter to Vhost PMD that passes the RTE_VHOST_USER_POSTCOPY_SUPPORT flag at vhost device register time. Flag should only be set if application does not prefault guest memory using, for example, mlockall() syscall. Default value is 0, meaning that postcopy support is disabled unless specified explicitly. Example to enable postcopy support for a given device: --vdev 'net_vhost0,iface=/tmp/vhost-user1,postcopy-support=1' Signed-off-by: Maxime Coquelin --- doc/guides/nics/vhost.rst | 5 +++++ drivers/net/vhost/rte_eth_vhost.c | 13 +++++++++++++ 2 files changed, 18 insertions(+) diff --git a/doc/guides/nics/vhost.rst b/doc/guides/nics/vhost.rst index 4f7ae8990..23f2e87aa 100644 --- a/doc/guides/nics/vhost.rst +++ b/doc/guides/nics/vhost.rst @@ -71,6 +71,11 @@ The user can specify below arguments in `--vdev` option. It is used to enable iommu support in vhost library. (Default: 0 (disabled)) +#. ``postcopy-support``: + + It is used to enable postcopy live-migration support in vhost library. + (Default: 0 (disabled)) + Vhost PMD event handling ------------------------ diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c index aa6052221..1330f06ba 100644 --- a/drivers/net/vhost/rte_eth_vhost.c +++ b/drivers/net/vhost/rte_eth_vhost.c @@ -30,6 +30,7 @@ enum {VIRTIO_RXQ, VIRTIO_TXQ, VIRTIO_QNUM}; #define ETH_VHOST_CLIENT_ARG "client" #define ETH_VHOST_DEQUEUE_ZERO_COPY "dequeue-zero-copy" #define ETH_VHOST_IOMMU_SUPPORT "iommu-support" +#define ETH_VHOST_POSTCOPY_SUPPORT "postcopy-support" #define VHOST_MAX_PKT_BURST 32 static const char *valid_arguments[] = { @@ -38,6 +39,7 @@ static const char *valid_arguments[] = { ETH_VHOST_CLIENT_ARG, ETH_VHOST_DEQUEUE_ZERO_COPY, ETH_VHOST_IOMMU_SUPPORT, + ETH_VHOST_POSTCOPY_SUPPORT, NULL }; @@ -1339,6 +1341,7 @@ rte_pmd_vhost_probe(struct rte_vdev_device *dev) int client_mode = 0; int dequeue_zero_copy = 0; int iommu_support = 0; + int postcopy_support = 0; struct rte_eth_dev *eth_dev; const char *name = rte_vdev_device_name(dev); @@ -1411,6 +1414,16 @@ rte_pmd_vhost_probe(struct rte_vdev_device *dev) flags |= RTE_VHOST_USER_IOMMU_SUPPORT; } + if (rte_kvargs_count(kvlist, ETH_VHOST_POSTCOPY_SUPPORT) == 1) { + ret = rte_kvargs_process(kvlist, ETH_VHOST_POSTCOPY_SUPPORT, + &open_int, &postcopy_support); + if (ret < 0) + goto out_free; + + if (postcopy_support) + flags |= RTE_VHOST_USER_POSTCOPY_SUPPORT; + } + if (dev->device.numa_node == SOCKET_ID_ANY) dev->device.numa_node = rte_socket_id();