From patchwork Thu Oct 12 15:38:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Coquelin X-Patchwork-Id: 30306 X-Patchwork-Delegate: yuanhan.liu@linux.intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 870061B3E2; Thu, 12 Oct 2017 17:39:12 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 9A5321B3DB for ; Thu, 12 Oct 2017 17:39:09 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EE3E2C059B63; Thu, 12 Oct 2017 15:39:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com EE3E2C059B63 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=maxime.coquelin@redhat.com Received: from localhost.localdomain (ovpn-112-53.ams2.redhat.com [10.36.112.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5F0F6413E; Thu, 12 Oct 2017 15:39:07 +0000 (UTC) From: Maxime Coquelin To: yliu@fridaylinux.org, thomas@monjalon.net, dev@dpdk.org Cc: Maxime Coquelin Date: Thu, 12 Oct 2017 17:38:50 +0200 Message-Id: <20171012153850.21837-3-maxime.coquelin@redhat.com> In-Reply-To: <20171012153850.21837-1-maxime.coquelin@redhat.com> References: <20171012153850.21837-1-maxime.coquelin@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 12 Oct 2017 15:39:09 +0000 (UTC) Subject: [dpdk-dev] [PATCH 2/2] vhost: fix IOTLB on NUMA realloc X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" In case of NUMA reallocation, virtqueue's iotlb list is broken, has its head changes but first iotlb entry in the list still points to the previous head pointer. Also, in case of reallocation, we want the IOTLB cache mempool to be on the new socket. This patch perform a full re-init of the IOTLB cache when mempool already exists, and calls the IOTLB cache init function in case the virtqueue is being reallocated on a new socket. Signed-off-by: Maxime Coquelin Reviewed-by: Jens Freimann --- lib/librte_vhost/iotlb.c | 1 - lib/librte_vhost/vhost_user.c | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/librte_vhost/iotlb.c b/lib/librte_vhost/iotlb.c index 05c278040..b74cc6a78 100644 --- a/lib/librte_vhost/iotlb.c +++ b/lib/librte_vhost/iotlb.c @@ -309,7 +309,6 @@ vhost_user_iotlb_init(struct virtio_net *dev, int vq_index) */ vhost_user_iotlb_cache_remove_all(vq); vhost_user_iotlb_pending_remove_all(vq); - return 0; } #ifdef RTE_LIBRTE_VHOST_NUMA diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index 9acac6125..1dfb234ca 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -314,6 +314,9 @@ numa_realloc(struct virtio_net *dev, int index) dev->virtqueue[index] = vq; vhost_devices[dev->vid] = dev; + if (old_vq != vq) + vhost_user_iotlb_init(dev, index); + return dev; } #else