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 B41F9A0C49 for ; Tue, 15 Jun 2021 10:43:00 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 473F741139; Tue, 15 Jun 2021 10:42:59 +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 4633D41109 for ; Tue, 15 Jun 2021 10:42:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623746576; 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=JFuptni0AtOF9MRmipZ/nejPzzARtNXjt+b9IVV6YNr2ydMZ8+jNReFyXm32+bwQlPSiTX u4Zw2IAowegWXnVIGIiDvdmS+oaSAqi+C6AKCoWuh5TaEY8d2QiZpgVo/Qphf7J99puZJi VIArCJMKwmUzl0QObTan6/tNF9GrWHM= 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-254-LKJkqofOOBeBBpBpTmcqaA-1; Tue, 15 Jun 2021 04:42:55 -0400 X-MC-Unique: LKJkqofOOBeBBpBpTmcqaA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id ED433100B3AB; Tue, 15 Jun 2021 08:42:54 +0000 (UTC) Received: from max-t490s.redhat.com (unknown [10.36.110.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id A15F960C03; Tue, 15 Jun 2021 08:42:53 +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:42:37 +0200 Message-Id: <20210615084241.139097-3-maxime.coquelin@redhat.com> In-Reply-To: <20210615084241.139097-1-maxime.coquelin@redhat.com> References: <20210615084241.139097-1-maxime.coquelin@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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 v2 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