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 9074FA0A0C; Tue, 29 Jun 2021 16:35:47 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 558A64117E; Tue, 29 Jun 2021 16:35:47 +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 48F4740E01 for ; Tue, 29 Jun 2021 16:35:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624977345; 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=6gAh3xpRArinxlDeudX+ScjH3TFLw7f8hEGUOcUH/cU=; b=fwmDWF0nc7moPNqh1QY3h4FxnAAAxKOiHfc/vtS9PskBNj7GbbJvkIl6m9QfGYCTW4jgui KpV7LEnMrhVYX76VDuLiTy4LRkyLjyl9QyX30iWkDV+6Tt39CAee06AykDQz2BXfDzS3c5 vTmS/Nm86DewTniuDk3aU1jYRcq7EgU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-30-ku3mr2sJPJOm4H0oPH54NA-1; Tue, 29 Jun 2021 10:35:44 -0400 X-MC-Unique: ku3mr2sJPJOm4H0oPH54NA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 128B61922962; Tue, 29 Jun 2021 14:35:43 +0000 (UTC) Received: from [10.36.110.32] (unknown [10.36.110.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 75D4B5D6A1; Tue, 29 Jun 2021 14:35:38 +0000 (UTC) To: "Xia, Chenbo" , "dev@dpdk.org" , "david.marchand@redhat.com" Cc: "stable@dpdk.org" References: <20210618140357.255995-1-maxime.coquelin@redhat.com> <20210618140357.255995-5-maxime.coquelin@redhat.com> From: Maxime Coquelin Message-ID: <84c15374-2d78-daea-2e2c-9716530606a8@redhat.com> Date: Tue, 29 Jun 2021 16:35:36 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=maxime.coquelin@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH v6 4/7] vhost: fix NUMA reallocation with multiqueue 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 Sender: "dev" Hi Chenbo, On 6/25/21 1:37 PM, Xia, Chenbo wrote: > Hi Maxime, > >> -----Original Message----- >> From: stable On Behalf Of Xia, Chenbo >> Sent: Friday, June 25, 2021 10:56 AM >> To: Maxime Coquelin ; dev@dpdk.org; >> david.marchand@redhat.com >> Cc: stable@dpdk.org >> Subject: Re: [dpdk-stable] [PATCH v6 4/7] vhost: fix NUMA reallocation >> with multiqueue >> >> Hi Maxime, >> >>> -----Original Message----- >>> From: Maxime Coquelin >>> Sent: Friday, June 18, 2021 10:04 PM >>> To: dev@dpdk.org; david.marchand@redhat.com; Xia, Chenbo >> >>> Cc: Maxime Coquelin ; stable@dpdk.org >>> Subject: [PATCH v6 4/7] vhost: fix NUMA reallocation with multiqueue >>> >>> Since the Vhost-user device initialization has been reworked, >>> enabling the application to start using the device as soon as >>> the first queue pair is ready, NUMA reallocation no more >>> happened on queue pairs other than the first one since >>> numa_realloc() was returning early if the device was running. >>> >>> This patch fixes this issue by only preventing the device >>> metadata to be allocated if the device is running. For the >>> virtqueues, a vring state change notification is sent to >>> notify the application of its disablement. Since the callback >>> is supposed to be blocking, it is safe to reallocate it >>> afterwards. >>> >>> Fixes: d0fcc38f5fa4 ("vhost: improve device readiness notifications") >>> Cc: stable@dpdk.org >>> >>> Signed-off-by: Maxime Coquelin >>> --- >>> lib/vhost/vhost_user.c | 13 ++++++++++--- >>> 1 file changed, 10 insertions(+), 3 deletions(-) >>> >>> diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c >>> index 82adf80fe5..51b96a0716 100644 >>> --- a/lib/vhost/vhost_user.c >>> +++ b/lib/vhost/vhost_user.c >>> @@ -488,12 +488,16 @@ numa_realloc(struct virtio_net *dev, int index) >>> struct batch_copy_elem *new_batch_copy_elems; >>> int ret; >>> >>> - if (dev->flags & VIRTIO_DEV_RUNNING) >>> - return dev; >>> - >>> old_dev = dev; >>> vq = old_vq = dev->virtqueue[index]; >>> >>> + /* >>> + * If VQ is ready, it is too late to reallocate, it certainly >> already >>> + * happened anyway on VHOST_USER_SET_VRING_ADRR. >>> + */ >>> + if (vq->ready) >>> + return dev; >>> + >>> ret = get_mempolicy(&newnode, NULL, 0, old_vq->desc, >>> MPOL_F_NODE | MPOL_F_ADDR); >>> >>> @@ -558,6 +562,9 @@ numa_realloc(struct virtio_net *dev, int index) >>> rte_free(old_vq); >>> } >>> >>> + if (dev->flags & VIRTIO_DEV_RUNNING) >>> + goto out; >>> + >> >> Since we don't realloc when vq is ready, there is no case that vq not >> ready but >> device still running, right? > > Sorry, I forgot DEV_RUNNING now only requires 1 qpair ready now ☹ > Ignore above comments.. No problem, thanks for the review! > Thanks, > Chenbo > >> >> Thanks, >> Chenbo >> >>> /* check if we need to reallocate dev */ >>> ret = get_mempolicy(&oldnode, NULL, 0, old_dev, >>> MPOL_F_NODE | MPOL_F_ADDR); >>> -- >>> 2.31.1 >