On Fri, 4 Jan 2019 at 01:02, Michael S. Tsirkin <[email protected]> wrote: > > On Thu, Jan 03, 2019 at 06:18:14PM +0800, [email protected] wrote: > > From: Xie Yongji <[email protected]> > > > > This patch introduces two new messages VHOST_USER_GET_SHM_SIZE > > and VHOST_USER_SET_SHM_FD to support providing shared > > memory to backend. > > So this seems a bit vague. Since we are going to use it > for tracking in-flight I/O I would prefer it that we > actually call it that. > >
So how about VHOST_USER_GET_INFLIGHT_SIZE and VHOST_USER_SET_INFLIHGT_FD? > > > > 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 > > s/them/it/ ? > Will fix it in v4. > > 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. > > > > Signed-off-by: Xie Yongji <[email protected]> > > Signed-off-by: Chai Wen <[email protected]> > > Signed-off-by: Zhang Yu <[email protected]> > > --- > > docs/interop/vhost-user.txt | 41 +++++++++++ > > hw/virtio/vhost-user.c | 86 ++++++++++++++++++++++ > > hw/virtio/vhost.c | 117 ++++++++++++++++++++++++++++++ > > include/hw/virtio/vhost-backend.h | 9 +++ > > include/hw/virtio/vhost.h | 19 +++++ > > 5 files changed, 272 insertions(+) > > > > diff --git a/docs/interop/vhost-user.txt b/docs/interop/vhost-user.txt > > index c2194711d9..5ee9c28ab0 100644 > > --- a/docs/interop/vhost-user.txt > > +++ b/docs/interop/vhost-user.txt > > @@ -142,6 +142,19 @@ Depending on the request type, payload can be: > > Offset: a 64-bit offset of this area from the start of the > > supplied file descriptor > > > > + * Shm description > > + ----------------------------------- > > + | mmap_size | mmap_offset | dev_size | vq_size | align | version | > > + ----------------------------------- > > + > > + Mmap_size: a 64-bit size of the shared memory > > + Mmap_offset: a 64-bit offset of the shared memory from the start > > + of the supplied file descriptor > > + Dev_size: a 32-bit size of device region in shared memory > > + Vq_size: a 32-bit size of each virtqueue region in shared memory > > + Align: a 32-bit align of each region in shared memory > > + Version: a 32-bit version of this shared memory > > + > > This is an informal description so please avoid _ in field > names, just put a space in there. See e.g. log description. > > Got it! > > In QEMU the vhost-user message is implemented with the following struct: > > > > typedef struct VhostUserMsg { > > > For things to work, in-flight format must not change when > backend reconnects. > I'm not sure whether there will be some cases that we want to add some fields to the inflight area without stopping vm. > To encourage consistency, how about including a recommended format for > this buffer in this document? > > Sure. Will add it in v4. Thanks, Yongji
