From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2FC35A0487 for ; Fri, 5 Jul 2019 10:47:09 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 075D41B9D6; Fri, 5 Jul 2019 10:47:09 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 5BFC31B9C9 for ; Fri, 5 Jul 2019 10:47:08 +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 B7FD23083394; Fri, 5 Jul 2019 08:47:07 +0000 (UTC) Received: from [10.36.112.54] (ovpn-112-54.ams2.redhat.com [10.36.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 72BE77D95E; Fri, 5 Jul 2019 08:47:03 +0000 (UTC) To: JinYu , dev@dpdk.org Cc: changpeng.liu@intel.com, LinLi , XunNi , YuZhang , Tiwei Bie References: <20190626163806.61624-1-jin.yu@intel.com> From: Maxime Coquelin Message-ID: <428a3995-9735-499f-d3af-a1e88f333ee7@redhat.com> Date: Fri, 5 Jul 2019 10:47:01 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190626163806.61624-1-jin.yu@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit 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.44]); Fri, 05 Jul 2019 08:47:07 +0000 (UTC) Subject: Re: [dpdk-dev] [PATCH] [v1]vhost: support inflight share memory protocol feature 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" Hi Jin, On 6/26/19 6:38 PM, JinYu wrote: > This patch introduces two new messages VHOST_USER_GET_INFLIGHT_FD > and VHOST_USER_SET_INFLIGHT_FD to support transferring a shared > buffer between qemu and backend. > > Firstly, qemu uses VHOST_USER_GET_INFLIGHT_FD to get the > shared buffer from backend. Then qemu should send it back > through VHOST_USER_SET_INFLIGHT_FD each time we start vhost-user. > > This shared buffer is used to process inflight I/O when backend > reconnect. > > Signed-off-by: LinLi > Signed-off-by: XunNi > Signed-off-by: YuZhang > Signed-off-by: JinYu > --- > V1 - specify the APIs are split-ring only > --- > lib/librte_vhost/rte_vhost.h | 99 +++++++++ > lib/librte_vhost/rte_vhost_version.map | 4 + > lib/librte_vhost/vhost.c | 135 ++++++++++++ > lib/librte_vhost/vhost.h | 12 + > lib/librte_vhost/vhost_user.c | 292 +++++++++++++++++++++++++ > lib/librte_vhost/vhost_user.h | 13 +- > 6 files changed, 554 insertions(+), 1 deletion(-) > > diff --git a/lib/librte_vhost/rte_vhost.h b/lib/librte_vhost/rte_vhost.h > index 0226b3eff..c9959c15a 100644 > --- a/lib/librte_vhost/rte_vhost.h > +++ b/lib/librte_vhost/rte_vhost.h > @@ -71,6 +71,10 @@ extern "C" { > #define VHOST_USER_PROTOCOL_F_HOST_NOTIFIER 11 > #endif > > +#ifndef VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD > +#define VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD 12 > +#endif > + > /** Indicate whether protocol features negotiation is supported. */ > #ifndef VHOST_USER_F_PROTOCOL_FEATURES > #define VHOST_USER_F_PROTOCOL_FEATURES 30 > @@ -98,12 +102,41 @@ struct rte_vhost_memory { > struct rte_vhost_mem_region regions[]; > }; > > +struct inflight_desc_split { > + uint8_t inflight; > + uint8_t padding[5]; > + uint16_t next; > + uint64_t counter; > +}; > + > +struct inflight_info_split { > + uint64_t features; > + uint16_t version; > + uint16_t desc_num; > + uint16_t last_inflight_io; > + uint16_t used_idx; > + struct inflight_desc_split desc[0]; > +}; > + > +struct resubmit_desc { > + uint16_t index; > + uint64_t counter; > +}; > + > +struct resubmit_info { > + struct resubmit_desc *resubmit_list; > + uint16_t resubmit_num; > +}; > + > struct rte_vhost_vring { > struct vring_desc *desc; > struct vring_avail *avail; > struct vring_used *used; > uint64_t log_guest_addr; > > + struct inflight_info_split *inflight; > + struct resubmit_info *resubmit_inflight; > + This is breaking the ABI, and discussing with Tiwei, we think it could be avoided by defining its own structure of inflight and inflight resubmit pointers. More below: > /** Deprecated, use rte_vhost_vring_call() instead. */ > int callfd; > > @@ -603,6 +636,22 @@ uint16_t rte_vhost_dequeue_burst(int vid, uint16_t queue_id, > */ > int rte_vhost_get_mem_table(int vid, struct rte_vhost_memory **mem); > > +/** > + * Get guest vring info, including the vring address, vring size, inflight, etc. > + * > + * @param vid > + * vhost device ID > + * @param vring_idx > + * vring index > + * @param vring > + * the structure to hold the requested vring info > + * @return > + * 0 on success, -1 on failure > + */ > +int __rte_experimental > +rte_vhost_get_vhost_vring_with_inflight_split(int vid, uint16_t vring_idx, > + struct rte_vhost_vring *vring); Here a new API is introduced to get vting info with inflight. It could be just changed to get only the inflight info. It means the caller would first call rte_vhost_get_vhost_vring() and then the new function, which I guess may be renamed to: rte_vhost_get_vhost_vring_inflight_split Other than that, the patch looks good to me. (Next time, please run get_maintainer.sh script so that all the maintainers are in Cc:). Thanks, Maxime