On Tue, 18 Dec 2018 at 22:57, Michael S. Tsirkin <m...@redhat.com> 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 <m...@redhat.com> wrote: > > > > > > On Tue, Dec 18, 2018 at 05:59:57PM +0800, elohi...@gmail.com wrote: > > > > From: Xie Yongji <xieyon...@baidu.com> > > > > > > > > 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