From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46493) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bzstx-0005zb-2U for qemu-devel@nongnu.org; Thu, 27 Oct 2016 18:11:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bzstt-0007Sd-LS for qemu-devel@nongnu.org; Thu, 27 Oct 2016 18:11:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43970) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bzstt-0007Rv-Gc for qemu-devel@nongnu.org; Thu, 27 Oct 2016 18:11:53 -0400 Date: Fri, 28 Oct 2016 01:11:51 +0300 From: "Michael S. Tsirkin" Message-ID: <20161028011101-mutt-send-email-mst@kernel.org> References: <20161018092405.21829-1-marcandre.lureau@redhat.com> <20161018092405.21829-6-marcandre.lureau@redhat.com> <7FD18897-996A-489F-9E9A-A51FB417863A@nutanix.com> <1124121564.320248.1476804321305.JavaMail.zimbra@redhat.com> <573FC693-003A-4A03-9870-00A9A64ADE2B@nutanix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <573FC693-003A-4A03-9870-00A9A64ADE2B@nutanix.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 5/6] contrib: add libvhost-user List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Felipe Franciosi Cc: =?iso-8859-1?Q?Marc-Andr=E9?= Lureau , =?iso-8859-1?Q?Marc-Andr=E9?= Lureau , qemu-devel , "victork@redhat.com" , Eric Blake On Tue, Oct 18, 2016 at 04:21:57PM +0000, Felipe Franciosi wrote: >=20 > > On 18 Oct 2016, at 16:25, Marc-Andr=E9 Lureau wr= ote: > >=20 > > Hi Felipe > >=20 > > ----- Original Message ----- > >> Hello, > >>=20 > >>> On 18 Oct 2016, at 10:24, Marc-Andr=E9 Lureau > >>> wrote: > >>>=20 > >>> <...> > >>>=20 > >>> diff --git a/contrib/libvhost-user/libvhost-user.h > >>> b/contrib/libvhost-user/libvhost-user.h > >>>=20 > >>> <...> > >>>=20 > >>> +#define VHOST_MAX_NR_VIRTQUEUE 8 > >>> +#define VIRTQUEUE_MAX_SIZE 1024 > >>=20 > >> I think that the maximum number of VQs should be 1024 to match Qemu'= s. > >>=20 > >> http://git.qemu.org/?p=3Dqemu.git;a=3Dblob;f=3Dinclude/hw/virtio/vir= tio.h;h=3Db913aac45589449bcc5d8161651332f4b0d69c7f;hb=3DHEAD#l55 > >=20 > > That would make the VuDev structure quite big. We may want to set the= nr of max queues in vu_init() instead, and allocate it there. I think th= is is rather a current limitation, but does not prevent iterating from th= ere. >=20 > Well, it depends what we call "quite big". The only thing that depends = on that is: >=20 > > struct VuDev { > > <...> > > VuVirtq vq[VHOST_MAX_NR_VIRTQUEUE]; > > <...> >=20 > And VuVirtq is 96 bytes in size (x86_64). So we're really talking about= 768 bytes vs 96 KiB. >=20 > Actually, you can bring it down to 88 bytes by... >=20 > > typedef struct VuRing { > > unsigned int num; > > struct vring_desc *desc; > > struct vring_avail *avail; > > struct vring_used *used; > > uint64_t log_guest_addr; > > uint32_t flags; >=20 > ... moving "flags" just below "num". Allows gcc to compact the struct b= etter. >=20 > > } VuRing; >=20 >=20 > I'd rather fix this kind of thing sooner than later, but it's ultimatel= y up to you. >=20 > Felipe I suspect the right thing to do is allocating it dynamically, I'm fine merging as is for now though. --=20 MST