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 280D1A0C49 for ; Tue, 15 Jun 2021 10:33:24 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5231C41134; Tue, 15 Jun 2021 10:33:22 +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 EDF7641102 for ; Tue, 15 Jun 2021 10:33:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623746000; 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=eGzY5Z7Uhq4x+kamaF7STpZ+s1TxFHVRuU61XxkXeik=; b=XsTKFfwachBpqhtXZMXllyVtKRLb3ikMYthHTKC+amx13JqNdw9wryZ8iscIGRGo58SOjD AHhGNC2YsNDHQtLEJc8nGNNtIOvIAi4vexiOOFnECm2vV2F0Qab6ms+VBz2Qn66R7a43qe +Q8hi40unzozygoTzSugd+C943maxXY= 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-222-TKqCKKE_Ox-FcR6t87SC4w-1; Tue, 15 Jun 2021 04:33:17 -0400 X-MC-Unique: TKqCKKE_Ox-FcR6t87SC4w-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3C420107ACF6; Tue, 15 Jun 2021 08:33:16 +0000 (UTC) Received: from max-t490s.redhat.com (unknown [10.36.110.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id EAF1A60C0F; Tue, 15 Jun 2021 08:33:14 +0000 (UTC) From: Maxime Coquelin To: dev@dpdk.org, david.marchand@redhat.com, chenbo.xia@intel.com Cc: Maxime Coquelin , stable@dpdk.org Date: Tue, 15 Jun 2021 10:33:04 +0200 Message-Id: <20210615083308.137401-3-maxime.coquelin@redhat.com> In-Reply-To: <20210615083308.137401-1-maxime.coquelin@redhat.com> References: <20210615083308.137401-1-maxime.coquelin@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Subject: [dpdk-stable] [PATCH 2/6] vhost: fix missing guest pages table NUMA realloc 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 Sender: "stable" When the guest allocates virtqueues on a different NUMA node than the one the Vhost metadata are allocated, both the Vhost device struct and the virtqueues struct are reallocated. However, reallocating the guest pages table was missing, which likely causes at least one cross-NUMA accesses for every burst of packets. This patch reallocates this table on the same NUMA node as the other metadata. Fixes: e246896178e6 ("vhost: get guest/host physical address mappings") Cc: stable@dpdk.org Signed-off-by: Maxime Coquelin --- lib/vhost/vhost_user.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c index 031e3bfa2f..cbfdf1b4d8 100644 --- a/lib/vhost/vhost_user.c +++ b/lib/vhost/vhost_user.c @@ -558,7 +558,8 @@ numa_realloc(struct virtio_net *dev, int index) } if (oldnode != newnode) { struct rte_vhost_memory *old_mem; - ssize_t mem_size; + struct guest_page *old_gp; + ssize_t mem_size, gp_size; VHOST_LOG_CONFIG(INFO, "reallocate dev from %d to %d node\n", @@ -583,6 +584,17 @@ numa_realloc(struct virtio_net *dev, int index) memcpy(dev->mem, old_mem, mem_size); rte_free(old_mem); + + gp_size = dev->max_guest_pages * sizeof(*dev->guest_pages); + old_gp = dev->guest_pages; + dev->guest_pages = rte_malloc_socket(NULL, gp_size, RTE_CACHE_LINE_SIZE, newnode); + if (!dev->guest_pages) { + dev->guest_pages = old_gp; + goto out; + } + + memcpy(dev->guest_pages, old_gp, gp_size); + rte_free(old_gp); } out: -- 2.31.1