From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35932) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZbrkL-0001bZ-U4 for qemu-devel@nongnu.org; Tue, 15 Sep 2015 11:02:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZbrkI-0005jZ-CS for qemu-devel@nongnu.org; Tue, 15 Sep 2015 11:02:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39063) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZbrkI-0005jL-5O for qemu-devel@nongnu.org; Tue, 15 Sep 2015 11:02:10 -0400 References: <1442301035-7550-1-git-send-email-yuanhan.liu@linux.intel.com> <1442301035-7550-8-git-send-email-yuanhan.liu@linux.intel.com> From: Eric Blake Message-ID: <55F832EF.9030500@redhat.com> Date: Tue, 15 Sep 2015 09:02:07 -0600 MIME-Version: 1.0 In-Reply-To: <1442301035-7550-8-git-send-email-yuanhan.liu@linux.intel.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="3RFjFfJ657iv6SFoLFndc7mEsFesB3fSt" Subject: Re: [Qemu-devel] [PATCH 6/7] vhost-user: add multiple queue support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Yuanhan Liu , qemu-devel@nongnu.org Cc: jasowang@redhat.com, mst@redhat.com, changchun.ouyang@intel.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --3RFjFfJ657iv6SFoLFndc7mEsFesB3fSt Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/15/2015 01:10 AM, Yuanhan Liu wrote: > From: Changchun Ouyang >=20 > This patch is initially based a patch from Nikolay Nikolaev. >=20 > Here is the latest version for adding vhost-user multiple queue support= , > by creating a nc and vhost_net pair for each queue. The phrase "Here is the latest version" doesn't make much sense in the long term in git (that is, a year from now, we won't care how many preliminary versions there were, just about the version that got committed; and if anything in git changes after that point, it is no longer the latest version). >=20 > Qemu exits if find that the backend can't support number of requested > queues(by providing queues=3D# option). The max number is queried by a space before ( in English. > new message, VHOST_USER_GET_QUEUE_NUM, and is sent only when protocol > feature VHOST_USER_PROTOCOL_F_MQ is present first. >=20 > The max queue check is done at vhost-user initiation stage. We initiate= > one queue first, which, in the meantime, also gets the max_queues the > backend supports. >=20 > In older version, it was reported that some messages are sent more time= s > than necessary. Here we came an agreement with Michael that we could > categorize vhost user messages to 2 types: none-vring specific messages= , s/none/non/ > which should be sent only once, and vring specific messages, which shou= ld > be sent per queue. >=20 > Here I introduced a helper function vhost_user_one_time_request(), whic= h > lists following messages as none-vring specific messages: s/none/non/ >=20 > VHOST_USER_GET_FEATURES > VHOST_USER_SET_FEATURES > VHOST_USER_GET_PROTOCOL_FEATURES > VHOST_USER_SET_PROTOCOL_FEATURES > VHOST_USER_SET_OWNER > VHOST_USER_RESET_DEVICE > VHOST_USER_SET_MEM_TABLE > VHOST_USER_GET_QUEUE_NUM >=20 > For above messages, we simply ignore them when they are not sent the fi= rst > time. >=20 Up to here is mostly fine for the commit message. Meanwhile... > v9: per suggested by Jason Wang, we could invoke qemu_chr_add_handlers(= ) > once only, and invoke qemu_find_net_clients_except() at the handler= > to gather all related ncs, for initiating all queues. Which address= es > a hidden bug in older verion in a more QEMU-like way. >=20 > v8: set net->dev.vq_index correctly inside vhost_net_init() based on th= e > value from net->nc->queue_index. =2E..this chunk here is useful only on the mailing list, and not in git, and therefore, should appear... >=20 > Signed-off-by: Nikolay Nikolaev > Signed-off-by: Changchun Ouyang > Signed-off-by: Yuanhan Liu > --- =2E..here, after the --- separator. > docs/specs/vhost-user.txt | 13 +++++ > hw/net/vhost_net.c | 10 ++-- > hw/virtio/vhost-user.c | 26 +++++++++ > hw/virtio/vhost.c | 5 +- > net/vhost-user.c | 146 +++++++++++++++++++++++++++++++++-----= -------- > qapi-schema.json | 6 +- > qemu-options.hx | 5 +- > 7 files changed, 161 insertions(+), 50 deletions(-) >=20 > diff --git a/docs/specs/vhost-user.txt b/docs/specs/vhost-user.txt > index 43db9b4..acf5708 100644 > --- a/docs/specs/vhost-user.txt > +++ b/docs/specs/vhost-user.txt > @@ -135,6 +135,19 @@ As older slaves don't support negotiating protocol= features, > a feature bit was dedicated for this purpose: > #define VHOST_USER_F_PROTOCOL_FEATURES 30 > =20 > +Multiple queue support > +------------------- Nit: the ---- line looks better when it is as long as the text it is highlighting (3 bytes more) > +Multiple queue is treated as a protocol extension, hence the slave has= to > +implement protocol features first. Multiple queues is supported only w= hen Sounds awkward. Either "Multiple queues are supported" or "The multiple queues feature is supported" > +the protocol feature VHOST_USER_PROTOCOL_F_MQ(bit 0) is set. space before ( in English. > + > +The max number of queues the slave supports can be queried with messag= e > +VHOST_USER_GET_PROTOCOL_FEATURES. Master should stop when the number o= f > +requested queues is bigger than that. > + > +As all queues share one connection, the master uses a unique index for= each > +queue in the sent message to identify a specified queue. > + > Message types > ------------- > =20 > @@ -207,6 +224,15 @@ static int vhost_user_call(struct vhost_dev *dev, = unsigned long int request, > msg_request =3D request; > } > =20 > + /* > + * For none-vring specific requests, like VHOST_USER_GET_FEATURES,= s/none/non/ > + * we just need send it once in the first time. For later such > + * request, we just ignore it. > + */ > + if (vhost_user_one_time_request(msg_request) && dev->vq_index !=3D= 0) { > + return 0; > + } > +++ b/qapi-schema.json > @@ -2480,12 +2480,16 @@ > # > # @vhostforce: #optional vhost on for non-MSIX virtio guests (default:= false). > # > +# @queues: #optional number of queues to be created for multiqueue vho= st-user > +# (default: 1) (Since 2.5) > +# > # Since 2.1 > ## > { 'struct': 'NetdevVhostUserOptions', > 'data': { > 'chardev': 'str', > - '*vhostforce': 'bool' } } > + '*vhostforce': 'bool', > + '*queues': 'int' } } Interface looks okay. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --3RFjFfJ657iv6SFoLFndc7mEsFesB3fSt Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJV+DLvAAoJEKeha0olJ0Nqc9cH/jbrZ4LwPJzcYVONx1x8Csny UANUjEIDU4SMj6f3FAv1BWTT7i8yQDtI4Y/CseMDtnod4c+XpDeyTDDMN+NiL9oe jAKpW2Yub9U/SW1HFhhtwp759d2bo+SI76KvX6TImk4f4HEkajiyUmwmDywtlU2K aJ38UtmZC/S/icvVJa0NKzdhejFh+yoxUhufojhX10cUqALY6DGlYNIUnQv++cEp 1yHoHeYfL+Bwb/SZ6B0kM4wnGVPwSaQS3XZBHqtJu/dJJKNDH20E6r3perCAJvyX 7KOx+db9w3mINcDE/P1XfTGFM6flgeYjgQWPVryVKvrfZXqk7GERDFkPjtc13Oo= =HRP9 -----END PGP SIGNATURE----- --3RFjFfJ657iv6SFoLFndc7mEsFesB3fSt--