From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202512 header.b=cNK7K2OT; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 26C4C5A0625 for ; Wed, 10 Dec 2025 01:04:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202512; t=1765325079; bh=Ae4wa3IPy8x/6PzH3wvyo7/3U7CoF+xonesYTNOu6EQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=cNK7K2OTX9B8bPnZjntFncuuHsVkpsfHGBte4slZdJ8rPaR9BSwaCeCWvSs7eMuG4 kGf54N1DIDNfJnk92pjSu3Ucy0i2kETmK95OV7xSWfb7w+pAKXD5p2funxvRaIIXkF f41EsPS5dM6MOrqN9DkT2qtglVI3JNR9ko7OczHYfzxuq6XFXmXT31ChvUPFd1kx5z jPC7nllYsC10x0tyPcXX/+DymivHlr32NO8gZFH7zLF2azFeRgJ9KRyPvVAdodewwa Cd6NgY/VTkRb6H4WcN1OCnkGBiwNCh/DeSmn9UuTvQSnLnJRjAXBSA8aGdIoN71hWs pFun8XxMIB6sA== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4dQwvC2HWZz4wBG; Wed, 10 Dec 2025 11:04:39 +1100 (AEDT) Date: Wed, 10 Dec 2025 11:04:33 +1100 From: David Gibson To: Laurent Vivier Subject: Re: [PATCH v3 2/6] vhost-user: Enable multiqueue Message-ID: References: <20251203185435.582096-1-lvivier@redhat.com> <20251203185435.582096-3-lvivier@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="1af5WUIe24y3DNza" Content-Disposition: inline In-Reply-To: <20251203185435.582096-3-lvivier@redhat.com> Message-ID-Hash: DHAMS673BLAV64BVT6WR4DGTSO3YGDOG X-Message-ID-Hash: DHAMS673BLAV64BVT6WR4DGTSO3YGDOG X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --1af5WUIe24y3DNza Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Dec 03, 2025 at 07:54:30PM +0100, Laurent Vivier wrote: > Advertise multi-queue support in vhost-user by setting VIRTIO_NET_F_MQ > and VHOST_USER_PROTOCOL_F_MQ feature flags, and increase > VHOST_USER_MAX_VQS from 2 to 32, supporting up to 16 queue pairs. >=20 > Currently, only the first RX queue (queue 0) is used for receiving > packets. The guest kernel selects which TX queue to use for > transmission. Full multi-RX queue load balancing will be implemented in > future work. >=20 > Update the QEMU usage hint to show the required parameters for enabling > multiqueue: queues parameter on the netdev, and mq=3Dtrue on the > virtio-net device. >=20 > Signed-off-by: Laurent Vivier Reviewed-by: David Gibson > --- > tap.c | 7 +++++-- > vhost_user.c | 10 ++++++---- > virtio.h | 2 +- > 3 files changed, 12 insertions(+), 7 deletions(-) >=20 > diff --git a/tap.c b/tap.c > index 2cda8c9772b8..591b49491aa3 100644 > --- a/tap.c > +++ b/tap.c > @@ -1314,8 +1314,11 @@ static void tap_backend_show_hints(struct ctx *c) > break; > case MODE_VU: > info("You can start qemu with:"); > - info(" kvm ... -chardev socket,id=3Dchr0,path=3D%s -netdev vhost-us= er,id=3Dnetdev0,chardev=3Dchr0 -device virtio-net,netdev=3Dnetdev0 -object = memory-backend-memfd,id=3Dmemfd0,share=3Don,size=3D$RAMSIZE -numa node,memd= ev=3Dmemfd0\n", > - c->sock_path); > + info(" kvm ... -chardev socket,id=3Dchr0,path=3D%s " > + "-netdev vhost-user,id=3Dnetdev0,chardev=3Dchr0,queues=3D$QUEUES " > + "-device virtio-net,netdev=3Dnetdev0,mq=3Dtrue " > + "-object memory-backend-memfd,id=3Dmemfd0,share=3Don,size=3D$RAMS= IZE " > + "-numa node,memdev=3Dmemfd0\n", c->sock_path); > break; > } > } > diff --git a/vhost_user.c b/vhost_user.c > index aa7c869d9e56..845fdb551c84 100644 > --- a/vhost_user.c > +++ b/vhost_user.c > @@ -323,6 +323,7 @@ static bool vu_get_features_exec(struct vu_dev *vdev, > uint64_t features =3D > 1ULL << VIRTIO_F_VERSION_1 | > 1ULL << VIRTIO_NET_F_MRG_RXBUF | > + 1ULL << VIRTIO_NET_F_MQ | > 1ULL << VHOST_F_LOG_ALL | > 1ULL << VHOST_USER_F_PROTOCOL_FEATURES; > =20 > @@ -767,7 +768,8 @@ static void vu_check_queue_msg_file(struct vhost_user= _msg *vmsg) > int idx =3D vmsg->payload.u64 & VHOST_USER_VRING_IDX_MASK; > =20 > if (idx >=3D VHOST_USER_MAX_VQS) > - die("Invalid vhost-user queue index: %u", idx); > + die("Invalid vhost-user queue index: %u (maximum %u)", idx, > + VHOST_USER_MAX_VQS); > =20 > if (nofd) { > vmsg_close_fds(vmsg); > @@ -896,7 +898,8 @@ static bool vu_get_protocol_features_exec(struct vu_d= ev *vdev, > uint64_t features =3D 1ULL << VHOST_USER_PROTOCOL_F_REPLY_ACK | > 1ULL << VHOST_USER_PROTOCOL_F_LOG_SHMFD | > 1ULL << VHOST_USER_PROTOCOL_F_DEVICE_STATE | > - 1ULL << VHOST_USER_PROTOCOL_F_RARP; > + 1ULL << VHOST_USER_PROTOCOL_F_RARP | > + 1ULL << VHOST_USER_PROTOCOL_F_MQ; > =20 > (void)vdev; > vmsg_set_reply_u64(vmsg, features); > @@ -935,10 +938,9 @@ static bool vu_get_queue_num_exec(struct vu_dev *vde= v, > { > (void)vdev; > =20 > - /* NOLINTNEXTLINE(misc-redundant-expression) */ > vmsg_set_reply_u64(vmsg, VHOST_USER_MAX_VQS / 2); > =20 > - debug("VHOST_USER_MAX_VQS %u", VHOST_USER_MAX_VQS / 2); > + debug("queue num %u", VHOST_USER_MAX_VQS / 2); > =20 > return true; > } > diff --git a/virtio.h b/virtio.h > index 12caaa0b6def..176c935cecc7 100644 > --- a/virtio.h > +++ b/virtio.h > @@ -88,7 +88,7 @@ struct vu_dev_region { > uint64_t mmap_addr; > }; > =20 > -#define VHOST_USER_MAX_VQS 2 > +#define VHOST_USER_MAX_VQS 32 > =20 > /* > * Set a reasonable maximum number of ram slots, which will be supported= by > --=20 > 2.51.1 >=20 --=20 David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson --1af5WUIe24y3DNza Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmk4uRAACgkQzQJF27ox 2GcUVg//aSUgAJt5pZKuJ20wuTU66x5VMahg9Sd9WA+okY8cWfKEgvSgKRUlwNWK runmvCWokIpi2jMPYDCqta7OYQptCba6JWCMWbyVww3uIwPXEVxreTxD+qYh7UOj LuVua12NJdmtaKcjObL4A04W+9M0ad+Ft34Iqiz6N2FWsNkDX0Sc7Ilas013Kp3Z Ef4SXpPh5Gx7yz42oE7kr3XAB0sZ191qRbHhuXv3i7XqgBY8JnBYBy3QycETMn9B N20p8wpdMRVjVqqtk8iz6nKOw6OL6YWy1CeuRbe0YRUebkWXbykUsqv83LDBtzs8 ytaFO6UFZEhhDAVR79QbXn38B0BUCSNUZO+d57ZxpWl+pRJ/NWI39bAbWG+wZ2C9 faV+g2/i5e9sMRqdNbU9dbu6bsRwftkgZbSdWD/EDHMAkwuXHRNlaaFg6W4Ql4HA rteBskXVDmU6g8Lf6aeKdCVTzTmEagLGFcoPV2556IM5/47FcVPJdO1hofnTLNyQ 23NzFtdtniJ52FlrKFfkTln+Hr0q/njH+m99kmJtB7qa4nhsKPofktX2slVjyDRA Iq6lGdQsR3CJ3GC2x4QSveVmp+bH8u6HwOmiv8nUYZqZpfMqA8huPyQU2j3LK0nJ G6Ln6SFAzYYlU5OLirX+MXOmWXKJDmh5FPrHOpAafg8J6661QpM= =QuSs -----END PGP SIGNATURE----- --1af5WUIe24y3DNza--