From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=eFHzhjBM; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by passt.top (Postfix) with ESMTPS id 820775A0625 for ; Thu, 11 Dec 2025 08:01:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1765436507; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZmHCjH24HDn/Ci070bnTFY/rTBTueAJVsZzhJqtOV3c=; b=eFHzhjBMlgeu9FNUUeL/Zap0FtsJByMIXH+tCzShBTKz0dY45DKGlzRKCtQzDxvUe1n2XK guxfHpY2OB374QDmSwKluCUaqKSok45qFtcFTkIF6WwyzPpwz7We+FUCzu/3WfGIbM24pl T1FEA0Sn771/FaEEy3H4UkBataVWI+U= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-484-REMCwfhoMhuz159UJFrrIg-1; Thu, 11 Dec 2025 02:01:45 -0500 X-MC-Unique: REMCwfhoMhuz159UJFrrIg-1 X-Mimecast-MFC-AGG-ID: REMCwfhoMhuz159UJFrrIg_1765436504 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-4779b3749a8so4290135e9.1 for ; Wed, 10 Dec 2025 23:01:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765436503; x=1766041303; h=content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ZmHCjH24HDn/Ci070bnTFY/rTBTueAJVsZzhJqtOV3c=; b=YOaEYHlAqvULfJKUt/OOK15erlGEnHnAP8IvUnE8imlw75Ot12xaB/KYOTwSPrq3AQ Tif7c3nH5gyn6KjXIDC2de+ZcB5iRJjC2KSD6/40V5KSxBhkyehk231t6FcDMgR/NX+l kJeSKdwWflW2XuqRGbMWBlQeDoG6L9EtsNjIR2XCdC0uRVu3wszqfD2+RJBNyOotHItv WV7AIPjbYBKWUze9xkbcnECuQjTBlyO12RJ8jgRoaJcGTPBQCiqcTc9ibfe88ljSxzpF PqsChfnVBrP1lgFyPfyd1etQXdEX7gdd7X6u+73ZgO9LsuMWnylFS6PuN8WnCt98Qo+d Ba3A== X-Gm-Message-State: AOJu0Yyqwy6dHdVVEorNu2txbYiXcc1sbnGdwsajITShwxe/w1NrqGFR y1ZJ3omJGqAAlNivy8dQm5o0BGJfVFPHAg/l3zSrfOrXxkZSi1atpEsmdUCMVvHN+0iCzKGHpgU EGdhIv1vnaezohc15SnhTBUThLb18sY5kPJUBBX6q14bOFu46oqPMAPXfmEA0olZGBn/qEeAXoh g/S10TDuxzoQob8qHhF8I8GR2ryaFjUpY3Mi5B X-Gm-Gg: ASbGncv5pC8yWeT1wAA4cj8z/wVkLdqAIE4gcIwasQSrjcKP2oYx+ePz9tDnSiiF59z o5aV/ynPh6Xpug8xm8AGzoM7uAqJxdrC/RaWXkdq0S8BkGzm8cE3YNQdy5jb158QR0yb1jf95Tu maGtU4Fv7O5n1losuloWEveXGQOszLkSZme136ub0OCa204KYkADeykpgCfcmxzLLaWVVApEb7H vJ8ZcPLUWMB3SKqyVGJJXMx40F+sXacJTcYYXMqwjG8UGUerNCBNuZi8l/oBYRIgU+M/eBwWJ8/ p6ol/8xPn949ZPa9VmFY48Ze4ROmynI2ClJ9MkFYA88VofDodkPh0sQDhOeMMmOOBnSrtp+fmjs A7lHM9cAY3mYE5BTYsWIk X-Received: by 2002:a05:600c:4fd6:b0:471:1716:11c4 with SMTP id 5b1f17b1804b1-47a8381e6b4mr40945045e9.34.1765436503496; Wed, 10 Dec 2025 23:01:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IENcaQbFX6vzCoKr3bM+99KYaDBvIBHbJDEzA2NlvQ7qbccjktJKRmZUysGR/anX8mL7Ux8mg== X-Received: by 2002:a05:600c:4fd6:b0:471:1716:11c4 with SMTP id 5b1f17b1804b1-47a8381e6b4mr40944735e9.34.1765436502978; Wed, 10 Dec 2025 23:01:42 -0800 (PST) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [2a10:fc81:a806:d6a9::1]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42fa8b85f38sm3700128f8f.28.2025.12.10.23.01.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Dec 2025 23:01:42 -0800 (PST) Date: Thu, 11 Dec 2025 08:01:41 +0100 From: Stefano Brivio To: Laurent Vivier Subject: Re: [PATCH v3 2/6] vhost-user: Enable multiqueue Message-ID: <20251211080141.79d71c2e@elisabeth> In-Reply-To: <20251203185435.582096-3-lvivier@redhat.com> References: <20251203185435.582096-1-lvivier@redhat.com> <20251203185435.582096-3-lvivier@redhat.com> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.49; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: dweqP_GPHqsz3Iy1PXvwUCeNqEsuu4r_-Wy5Akslrfo_1765436504 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: SPRMKFF4K4IBYVUZCOWGNYAMPM3FMPEY X-Message-ID-Hash: SPRMKFF4K4IBYVUZCOWGNYAMPM3FMPEY X-MailFrom: sbrivio@redhat.com 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: On Wed, 3 Dec 2025 19:54:30 +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. > > 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. > > Update the QEMU usage hint to show the required parameters for enabling > multiqueue: queues parameter on the netdev, and mq=true on the > virtio-net device. > > Signed-off-by: Laurent Vivier > --- > tap.c | 7 +++++-- > vhost_user.c | 10 ++++++---- > virtio.h | 2 +- > 3 files changed, 12 insertions(+), 7 deletions(-) > > 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=chr0,path=%s -netdev vhost-user,id=netdev0,chardev=chr0 -device virtio-net,netdev=netdev0 -object memory-backend-memfd,id=memfd0,share=on,size=$RAMSIZE -numa node,memdev=memfd0\n", > - c->sock_path); > + info(" kvm ... -chardev socket,id=chr0,path=%s " > + "-netdev vhost-user,id=netdev0,chardev=chr0,queues=$QUEUES " > + "-device virtio-net,netdev=netdev0,mq=true " > + "-object memory-backend-memfd,id=memfd0,share=on,size=$RAMSIZE " > + "-numa node,memdev=memfd0\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 = > 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; > > @@ -767,7 +768,8 @@ static void vu_check_queue_msg_file(struct vhost_user_msg *vmsg) > int idx = vmsg->payload.u64 & VHOST_USER_VRING_IDX_MASK; > > if (idx >= 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); > > if (nofd) { > vmsg_close_fds(vmsg); > @@ -896,7 +898,8 @@ static bool vu_get_protocol_features_exec(struct vu_dev *vdev, > uint64_t features = 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; > > (void)vdev; > vmsg_set_reply_u64(vmsg, features); > @@ -935,10 +938,9 @@ static bool vu_get_queue_num_exec(struct vu_dev *vdev, > { > (void)vdev; > > - /* NOLINTNEXTLINE(misc-redundant-expression) */ > vmsg_set_reply_u64(vmsg, VHOST_USER_MAX_VQS / 2); > > - debug("VHOST_USER_MAX_VQS %u", VHOST_USER_MAX_VQS / 2); > + debug("queue num %u", VHOST_USER_MAX_VQS / 2); Nit, if you respin: this "queue num %u" message doesn't carry any context at all. Actually, why is it needed? It's defined at build time anyway. If it's needed maybe "Using up to %u vhost-user queue pairs"? > > 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; > }; > > -#define VHOST_USER_MAX_VQS 2 > +#define VHOST_USER_MAX_VQS 32 > > /* > * Set a reasonable maximum number of ram slots, which will be supported by -- Stefano