From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35122) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZHCy-0004Gy-OC for qemu-devel@nongnu.org; Tue, 18 Dec 2018 10:22:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZH1b-0005wT-FL for qemu-devel@nongnu.org; Tue, 18 Dec 2018 10:11:12 -0500 Received: from mail-yb1-xb42.google.com ([2607:f8b0:4864:20::b42]:35807) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gZH1b-0005qK-8q for qemu-devel@nongnu.org; Tue, 18 Dec 2018 10:11:11 -0500 Received: by mail-yb1-xb42.google.com with SMTP id z2-v6so6600465ybj.2 for ; Tue, 18 Dec 2018 07:11:10 -0800 (PST) MIME-Version: 1.0 References: <20181218100002.11219-1-xieyongji@baidu.com> <20181218100002.11219-3-xieyongji@baidu.com> <20181218092449-mutt-send-email-mst@kernel.org> <20181218095456-mutt-send-email-mst@kernel.org> In-Reply-To: <20181218095456-mutt-send-email-mst@kernel.org> From: Yongji Xie Date: Tue, 18 Dec 2018 23:10:58 +0800 Message-ID: Content-Type: text/plain; charset="UTF-8" Subject: Re: [Qemu-devel] [PATCH v2 for-4.0 2/7] vhost-user: Support providing shared memory to backend List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: =?UTF-8?B?TWFyYy1BbmRyw6kgTHVyZWF1?= , Jason Wang , Yury Kotov , "Coquelin, Maxime" , qemu-devel , zhangyu31@baidu.com, chaiwen@baidu.com, nixun@baidu.com, lilin24@baidu.com, Xie Yongji On Tue, 18 Dec 2018 at 22:57, Michael S. Tsirkin wrote: > > On Tue, Dec 18, 2018 at 10:47:32PM +0800, Yongji Xie wrote: > > On Tue, 18 Dec 2018 at 22:25, Michael S. Tsirkin wrote: > > > > > > On Tue, Dec 18, 2018 at 05:59:57PM +0800, elohimes@gmail.com wrote: > > > > From: Xie Yongji > > > > > > > > This patch introduces two new messages VHOST_USER_GET_SHM_SIZE > > > > and VHOST_USER_SET_SHM_FD to support providing shared > > > > memory to backend. > > > > > > > > Firstly, qemu uses VHOST_USER_GET_SHM_SIZE to get the > > > > required size of shared memory from backend. Then, qemu > > > > allocates memory and sends them back to backend through > > > > VHOST_USER_SET_SHM_FD. > > > > > > > > Note that the shared memory should be used to record > > > > inflight I/O by backend. Qemu will clear it when vm reset. > > > > > > An interesting design choice. Why not let the backend clear it > > > on start? > > > > > > > The backend might restart when it has some inflight I/Os. In this case, > > it should not clear the memory on start, right? > > > > Thanks, > > Yongji > > I see. So this allows backend to detect a non-initialized buffer > by checking e.g. a version is 0? Clever. > If the version is a variable in the buffer, yes, we can detect whether the buffer is initialized or not by checking it. Thanks, Yongji