From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by dpdk.org (Postfix) with ESMTP id C0CF31B1F7 for ; Fri, 5 Oct 2018 16:22:04 +0200 (CEST) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20181005142203euoutp0115f94e43112b41fd0c85e8ace5c32b6d~avFtzWq0e2400624006euoutp01m for ; Fri, 5 Oct 2018 14:22:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20181005142203euoutp0115f94e43112b41fd0c85e8ace5c32b6d~avFtzWq0e2400624006euoutp01m DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1538749323; bh=LD/q2E15iOdi8kU6u2llxn2t9GLl6hTud4l33/7m5eo=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=ZkoWWfuMZwiUBmRgm1vrlr9AFaVu/asaTuN82FrenUJ4cPcXZ99ZdiZMLLj5Zvngr zD3fjRQJXSG5ghr5800Th7IDKHem90Wj/4e9TBTMd1Q9EQmm/q094CPzNJ3uChsCMF aiJXgMGHNRqmdLrA6SuJnkmBzAgPnN4a2CtN5v4I= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181005142201eucas1p2c3d68906f0d5aa413d6660d9d42d52a4~avFsHfo7J2724727247eucas1p2Y; Fri, 5 Oct 2018 14:22:01 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 64.F9.04294.98377BB5; Fri, 5 Oct 2018 15:22:01 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20181005142201eucas1p1359f104e0fc99b03019452350b44f631~avFrXXPTu2477524775eucas1p1A; Fri, 5 Oct 2018 14:22:01 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20181005142200eusmtrp1aa417ff137a6e6d4633f782fae2b402f~avFrGWfas1222512225eusmtrp1O; Fri, 5 Oct 2018 14:22:00 +0000 (GMT) X-AuditID: cbfec7f4-835ff700000010c6-71-5bb773892b1e Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 7C.CA.04128.88377BB5; Fri, 5 Oct 2018 15:22:00 +0100 (BST) Received: from [106.109.129.180] (unknown [106.109.129.180]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20181005142200eusmtip2485e8734c1d7732d6db1aa293298998f~avFqbuajt0060900609eusmtip2E; Fri, 5 Oct 2018 14:21:59 +0000 (GMT) To: Maxime Coquelin , dev@dpdk.org, tiwei.bie@intel.com, zhihong.wang@intel.com, jfreimann@redhat.com, nicknickolaev@gmail.com, bruce.richardson@intel.com, alejandro.lucero@netronome.com Cc: dgilbert@redhat.com, stable@dpdk.org From: Ilya Maximets Date: Fri, 5 Oct 2018 17:24:21 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20181004081403.8039-19-maxime.coquelin@redhat.com> Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA02SaUwTYRCG/Xa33QUsWQrIBImYQrwFRaNrJIARksbERIwxCj+wwgqE0y5U 8YeiMVoQCKCmWpVD5RBIEOSGSKjYcglogAAihwJyyE2MHKK0i5F/zzsz73wzk4/Cxe8E1lRg aAQrD5UFS4TGRIl2oWVvDFfqvW8pTsI0z2ZiTGeOKzM5W4ox8SW9JNN2d4FkmvMyCEYbU0Uw jekdBLOiXCaZ4ug/GPPmYzLmZiJdTMsQSMvVX0jpi6pRTKq6N4BLp962C6UJ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hSX+XOti62LkAqp5zygxv/UyI0hCWCBQ4sWJh2AJEYE7 jBJbZp0BSzALaEisv/qEEaLjBKNE76G3YKPYBHQkTq0+AlbEK2An8WP+TbDVLAIqEp8vLGAC sUUFIiRWL3/BClEjKHFy5hOwGk4BB4mTz6ZDLVCX+DPvEjOELS7R9GUlK4QtL7H97RzmCYxC s5C0z0LSMgtJyywkLQsYWVYxiqSWFuem5xYb6RUn5haX5qXrJefnbmIERuq2Yz+37GDsehd8 iFGAg1GJh3eC4rZoIdbEsuLK3EOMEhzMSiK8e+K3RwvxpiRWVqUW5ccXleakFh9iNAV6biKz lGhyPjCJ5JXEG5oamltYGpobmxubWSiJ8543qIwSEkhPLEnNTk0tSC2C6WPi4JRqYDQ58uji nFfurWq/JSNdTNfqr9nmcMvoz7Y7780yFMzuFnHlBp988CHl3G7Jf19b/hkVb1eym37928qE wheVR6W4ny2d82rPoWdt+7cJRIUnVkzimvL/dkxR0cYrVuVaHM/+L1yloHtJNaErP85H0Cti 7fXD70JFT6fbvpfruP51404vvd3Jd0SVWIozEg21mIuKEwG+F26h6gIAAA== Message-Id: <20181005142201eucas1p1359f104e0fc99b03019452350b44f631~avFrXXPTu2477524775eucas1p1A@eucas1p1.samsung.com> X-CMS-MailID: 20181005142201eucas1p1359f104e0fc99b03019452350b44f631 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20181004081624epcas5p245dd150d45f0bf4e8854b7ceaaa3ec49 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181004081624epcas5p245dd150d45f0bf4e8854b7ceaaa3ec49 References: <20181004081403.8039-1-maxime.coquelin@redhat.com> <20181004081403.8039-19-maxime.coquelin@redhat.com> Subject: Re: [dpdk-stable] [PATCH v3 18/19] vhost: add flag to enable postcopy live-migration X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Oct 2018 14:22:04 -0000 I think it'll be nice to have a warning in case zero-copy and postcopy enabled at the same time. This warning will clarify for users why postcopy is not enabled. What do you think? Maybe we can also move the check from the previous patch to rte_vhost_driver_register() like it done for VIRTIO_F_IN_ORDER ? We can't change the set of enabled features in runtime anyway. Best regards, Ilya Maximets. On 04.10.2018 11:14, Maxime Coquelin wrote: > Postcopy live-migration feature require the application to > not populate the guest memory. As the vhost library cannot > prevent the application to that (e.g. preventing the > application to call mlockall()), the feature is disabled by > default. > > The application should only enable the feature if it does not > force the guest memory to be populated. > > In case the user passes the RTE_VHOST_USER_POSTCOPY_SUPPORT > flag at registration but the feature was not compiled, > registration fails. > > Signed-off-by: Maxime Coquelin > --- > doc/guides/prog_guide/vhost_lib.rst | 8 ++++++++ > lib/librte_vhost/rte_vhost.h | 1 + > lib/librte_vhost/socket.c | 19 +++++++++++++++++-- > 3 files changed, 26 insertions(+), 2 deletions(-) > > diff --git a/doc/guides/prog_guide/vhost_lib.rst b/doc/guides/prog_guide/vhost_lib.rst > index 77af4d775..c77df338f 100644 > --- a/doc/guides/prog_guide/vhost_lib.rst > +++ b/doc/guides/prog_guide/vhost_lib.rst > @@ -106,6 +106,14 @@ The following is an overview of some key Vhost API functions: > Enabling this flag with these Qemu version results in Qemu being blocked > when multiple queue pairs are declared. > > + - ``RTE_VHOST_USER_POSTCOPY_SUPPORT`` > + > + Postcopy live-migration support will be enabled when this flag is set. > + It is disabled by default. > + > + Enabling this flag should only be done when the calling application does > + not pre-fault the guest shared memory, otherwise migration would fail. > + > * ``rte_vhost_driver_set_features(path, features)`` > > This function sets the feature bits the vhost-user driver supports. The > diff --git a/lib/librte_vhost/rte_vhost.h b/lib/librte_vhost/rte_vhost.h > index b3cc6990d..b26afbffa 100644 > --- a/lib/librte_vhost/rte_vhost.h > +++ b/lib/librte_vhost/rte_vhost.h > @@ -28,6 +28,7 @@ extern "C" { > #define RTE_VHOST_USER_NO_RECONNECT (1ULL << 1) > #define RTE_VHOST_USER_DEQUEUE_ZERO_COPY (1ULL << 2) > #define RTE_VHOST_USER_IOMMU_SUPPORT (1ULL << 3) > +#define RTE_VHOST_USER_POSTCOPY_SUPPORT (1ULL << 4) > > /** Protocol features. */ > #ifndef VHOST_USER_PROTOCOL_F_MQ > diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c > index c04d3d305..3df303be8 100644 > --- a/lib/librte_vhost/socket.c > +++ b/lib/librte_vhost/socket.c > @@ -51,6 +51,8 @@ struct vhost_user_socket { > uint64_t supported_features; > uint64_t features; > > + uint64_t protocol_features; > + > /* > * Device id to identify a specific backend device. > * It's set to -1 for the default software implementation. > @@ -731,7 +733,7 @@ rte_vhost_driver_get_protocol_features(const char *path, > did = vsocket->vdpa_dev_id; > vdpa_dev = rte_vdpa_get_device(did); > if (!vdpa_dev || !vdpa_dev->ops->get_protocol_features) { > - *protocol_features = VHOST_USER_PROTOCOL_FEATURES; > + *protocol_features = vsocket->protocol_features; > goto unlock_exit; > } > > @@ -744,7 +746,7 @@ rte_vhost_driver_get_protocol_features(const char *path, > goto unlock_exit; > } > > - *protocol_features = VHOST_USER_PROTOCOL_FEATURES > + *protocol_features = vsocket->protocol_features > & vdpa_protocol_features; > > unlock_exit: > @@ -863,6 +865,7 @@ rte_vhost_driver_register(const char *path, uint64_t flags) > vsocket->use_builtin_virtio_net = true; > vsocket->supported_features = VIRTIO_NET_SUPPORTED_FEATURES; > vsocket->features = VIRTIO_NET_SUPPORTED_FEATURES; > + vsocket->protocol_features = VHOST_USER_PROTOCOL_FEATURES; > > /* Dequeue zero copy can't assure descriptors returned in order */ > if (vsocket->dequeue_zero_copy) { > @@ -875,6 +878,18 @@ rte_vhost_driver_register(const char *path, uint64_t flags) > vsocket->features &= ~(1ULL << VIRTIO_F_IOMMU_PLATFORM); > } > > + if (!(flags & RTE_VHOST_USER_POSTCOPY_SUPPORT)) { > + vsocket->protocol_features &= > + ~(1ULL << VHOST_USER_PROTOCOL_F_PAGEFAULT); > + } else { > +#ifndef RTE_LIBRTE_VHOST_POSTCOPY > + RTE_LOG(ERR, VHOST_CONFIG, > + "Postcopy requested but not compiled\n"); > + ret = -1; > + goto out_mutex; > +#endif > + } > + > if ((flags & RTE_VHOST_USER_CLIENT) != 0) { > vsocket->reconnect = !(flags & RTE_VHOST_USER_NO_RECONNECT); > if (vsocket->reconnect && reconn_tid == 0) { >