patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH v2] vhost: restrict set max queue pair API to VDUSE
@ 2024-10-03  8:11 Maxime Coquelin
  2024-10-03  9:22 ` David Marchand
  2024-10-07  7:29 ` Maxime Coquelin
  0 siblings, 2 replies; 3+ messages in thread
From: Maxime Coquelin @ 2024-10-03  8:11 UTC (permalink / raw)
  To: dev, chenbox, yux.jiang; +Cc: Maxime Coquelin, stable

In order to avoid breaking Vhost-user live-migration, we want the
rte_vhost_driver_set_max_queue_num API to only be effective with
VDUSE.

Furthermore, this API is only really needed for VDUSE where the
device number of queues is defined by the backend. For Vhost-user,
this is defined by the frontend (e.g. QEMU), so the advantages of
restricting more the maximum number of queue pairs is limited to
a small memory gain (a handful of pointers).

Fixes: 4aa1f88ac13d ("vhost: add API to set max queue pairs")
Cc: stable@dpdk.org

Reported-by: Yu Jiang <yux.jiang@intel.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---

Changes in v2:
==============
- Document the change in the API (David)

---

 lib/vhost/rte_vhost.h |  2 ++
 lib/vhost/socket.c    | 12 ++++++++++++
 2 files changed, 14 insertions(+)

diff --git a/lib/vhost/rte_vhost.h b/lib/vhost/rte_vhost.h
index b0434c4b8d..328281ba0f 100644
--- a/lib/vhost/rte_vhost.h
+++ b/lib/vhost/rte_vhost.h
@@ -614,6 +614,8 @@ rte_vhost_driver_get_queue_num(const char *path, uint32_t *queue_num);
  * @b EXPERIMENTAL: this API may change, or be removed, without prior notice.
  *
  * Set the maximum number of queue pairs supported by the device.
+ * The value set is ignored for Vhost-user backends. It is only taken into
+ * account with VDUSE backends.
  *
  * @param path
  *  The vhost-user socket file path
diff --git a/lib/vhost/socket.c b/lib/vhost/socket.c
index a75728a2e4..d29d15494c 100644
--- a/lib/vhost/socket.c
+++ b/lib/vhost/socket.c
@@ -860,6 +860,18 @@ rte_vhost_driver_set_max_queue_num(const char *path, uint32_t max_queue_pairs)
 		goto unlock_exit;
 	}
 
+	/*
+	 * This is only useful for VDUSE for which number of virtqueues is set
+	 * by the backend. For Vhost-user, the number of virtqueues is defined
+	 * by the frontend.
+	 */
+	if (!vsocket->is_vduse) {
+		VHOST_CONFIG_LOG(path, DEBUG,
+				"Keeping %u max queue pairs for Vhost-user backend",
+				VHOST_MAX_QUEUE_PAIRS);
+		goto unlock_exit;
+	}
+
 	vsocket->max_queue_pairs = max_queue_pairs;
 
 unlock_exit:
-- 
2.46.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] vhost: restrict set max queue pair API to VDUSE
  2024-10-03  8:11 [PATCH v2] vhost: restrict set max queue pair API to VDUSE Maxime Coquelin
@ 2024-10-03  9:22 ` David Marchand
  2024-10-07  7:29 ` Maxime Coquelin
  1 sibling, 0 replies; 3+ messages in thread
From: David Marchand @ 2024-10-03  9:22 UTC (permalink / raw)
  To: Maxime Coquelin; +Cc: dev, chenbox, yux.jiang, stable

On Thu, Oct 3, 2024 at 10:11 AM Maxime Coquelin
<maxime.coquelin@redhat.com> wrote:
>
> In order to avoid breaking Vhost-user live-migration, we want the
> rte_vhost_driver_set_max_queue_num API to only be effective with
> VDUSE.
>
> Furthermore, this API is only really needed for VDUSE where the
> device number of queues is defined by the backend. For Vhost-user,
> this is defined by the frontend (e.g. QEMU), so the advantages of
> restricting more the maximum number of queue pairs is limited to
> a small memory gain (a handful of pointers).
>
> Fixes: 4aa1f88ac13d ("vhost: add API to set max queue pairs")
> Cc: stable@dpdk.org
>
> Reported-by: Yu Jiang <yux.jiang@intel.com>
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Acked-by: David Marchand <david.marchand@redhat.com>

-- 
David Marchand


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] vhost: restrict set max queue pair API to VDUSE
  2024-10-03  8:11 [PATCH v2] vhost: restrict set max queue pair API to VDUSE Maxime Coquelin
  2024-10-03  9:22 ` David Marchand
@ 2024-10-07  7:29 ` Maxime Coquelin
  1 sibling, 0 replies; 3+ messages in thread
From: Maxime Coquelin @ 2024-10-07  7:29 UTC (permalink / raw)
  To: dev, chenbox, yux.jiang; +Cc: stable



On 10/3/24 10:11, Maxime Coquelin wrote:
> In order to avoid breaking Vhost-user live-migration, we want the
> rte_vhost_driver_set_max_queue_num API to only be effective with
> VDUSE.
> 
> Furthermore, this API is only really needed for VDUSE where the
> device number of queues is defined by the backend. For Vhost-user,
> this is defined by the frontend (e.g. QEMU), so the advantages of
> restricting more the maximum number of queue pairs is limited to
> a small memory gain (a handful of pointers).
> 
> Fixes: 4aa1f88ac13d ("vhost: add API to set max queue pairs")
> Cc: stable@dpdk.org
> 
> Reported-by: Yu Jiang <yux.jiang@intel.com>
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
> 
> Changes in v2:
> ==============
> - Document the change in the API (David)
> 
> ---
> 
>   lib/vhost/rte_vhost.h |  2 ++
>   lib/vhost/socket.c    | 12 ++++++++++++
>   2 files changed, 14 insertions(+)
> 


Applied to next-virtio/for-next-net

Thanks,
Maxime


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-10-07  7:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-03  8:11 [PATCH v2] vhost: restrict set max queue pair API to VDUSE Maxime Coquelin
2024-10-03  9:22 ` David Marchand
2024-10-07  7:29 ` Maxime Coquelin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).