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 3A04845A9F for ; Thu, 3 Oct 2024 10:11:28 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2EC33402E2; Thu, 3 Oct 2024 10:11:28 +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 7AEFA4025E for ; Thu, 3 Oct 2024 10:11:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727943084; 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=UhMjAeWDK+3OBDkg+IIm+wXkmrmIgXWu+x2WXMvBhC4=; b=PPB8hxG74vakcfrZbiGqI9IcCLnrf5MkVaS31VPm/p2vzmi34guUSxQmKYpmc8WJyVCa5+ qfXkIuAWBWlMTlsUp2NKp59wExJGCgid1T6sKF9MQ9BBGaDFRDXlvMV4NdxvnCHRMpmMXm CtFAvHYem9hvxWc1HPg2ou+LCfrUqsQ= Received: from mx-prod-mc-05.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-428-HjRW6iPANQCybmTsu3hN8w-1; Thu, 03 Oct 2024 04:11:19 -0400 X-MC-Unique: HjRW6iPANQCybmTsu3hN8w-1 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 230E51956083; Thu, 3 Oct 2024 08:11:17 +0000 (UTC) Received: from max-p1.redhat.com (unknown [10.39.208.26]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2030B30000DF; Thu, 3 Oct 2024 08:11:14 +0000 (UTC) From: Maxime Coquelin To: dev@dpdk.org, chenbox@nvidia.com, yux.jiang@intel.com Cc: Maxime Coquelin , stable@dpdk.org Subject: [PATCH v2] vhost: restrict set max queue pair API to VDUSE Date: Thu, 3 Oct 2024 10:11:10 +0200 Message-ID: <20241003081110.3471793-1-maxime.coquelin@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-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 --- 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