From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id F1D9E45A9D; Wed, 2 Oct 2024 16:42:21 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B78BB4025E; Wed, 2 Oct 2024 16:42:21 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 4140B4025C for ; Wed, 2 Oct 2024 16:42:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727880139; 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; bh=ChGl8V1HiSdYawZKfsVmK8zk+qSZ4nIvK3vaFxqIuDM=; b=KyoWWg1dhp2+fiICCX3Sd62BJ4zCpfXt7fS/wJhUNp2vu065yVC8SafjWVFuRJ/WEhkyuH wQHcDQdDpFPEjIX/rgJ9vep9f1qyX7nHYu0aPyFN5Wq7Kk42EYyqu2e9Ts5n82xqxE5Wn5 mKWWzq/lMemAuvnxy/tLqYpcFyLoSd8= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-538-3HHATrTpMIaPvVwHp-hPHA-1; Wed, 02 Oct 2024 10:42:16 -0400 X-MC-Unique: 3HHATrTpMIaPvVwHp-hPHA-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7FD151955F3C; Wed, 2 Oct 2024 14:42:15 +0000 (UTC) Received: from max-p1.redhat.com (unknown [10.39.208.25]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 1ABEF19560A3; Wed, 2 Oct 2024 14:42:12 +0000 (UTC) From: Maxime Coquelin To: dev@dpdk.org, chenbox@nvidia.com, david.marchand@redhat.com Cc: stable@dpdk.org, yux.jiang@intel.com, Maxime Coquelin Subject: [PATCH] vhost: restrict set max queue pair API to VDUSE Date: Wed, 2 Oct 2024 16:42:08 +0200 Message-ID: <20241002144208.2618714-1-maxime.coquelin@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 Signed-off-by: Maxime Coquelin --- lib/vhost/socket.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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