[dpdk-stable] patch 'vhost: fix missing guest pages table NUMA realloc' has been queued to stable release 20.11.3

luca.boccassi at gmail.com luca.boccassi at gmail.com
Mon Jul 12 15:04:48 CEST 2021


Hi,

FYI, your patch has been queued to stable release 20.11.3

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 07/14/21. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/bluca/dpdk-stable

This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/62c6d22fb03a331a89ffae89484e8036b05d8b0e

Thanks.

Luca Boccassi

---
>From 62c6d22fb03a331a89ffae89484e8036b05d8b0e Mon Sep 17 00:00:00 2001
From: Maxime Coquelin <maxime.coquelin at redhat.com>
Date: Tue, 29 Jun 2021 18:11:28 +0200
Subject: [PATCH] vhost: fix missing guest pages table NUMA realloc

[ upstream commit 57589cdfd784e6704ded490d80038584d6ade9df ]

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")

Signed-off-by: Maxime Coquelin <maxime.coquelin at redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia at intel.com>
---
 lib/librte_vhost/vhost_user.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
index bef269298b..fcb78ad4ea 100644
--- a/lib/librte_vhost/vhost_user.c
+++ b/lib/librte_vhost/vhost_user.c
@@ -559,7 +559,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",
@@ -584,6 +585,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.30.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2021-07-12 13:41:39.424165831 +0100
+++ 0053-vhost-fix-missing-guest-pages-table-NUMA-realloc.patch	2021-07-12 13:41:36.438121527 +0100
@@ -1 +1 @@
-From 57589cdfd784e6704ded490d80038584d6ade9df Mon Sep 17 00:00:00 2001
+From 62c6d22fb03a331a89ffae89484e8036b05d8b0e Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 57589cdfd784e6704ded490d80038584d6ade9df ]
+
@@ -18 +19,0 @@
-Cc: stable at dpdk.org
@@ -23 +24 @@
- lib/vhost/vhost_user.c | 14 +++++++++++++-
+ lib/librte_vhost/vhost_user.c | 14 +++++++++++++-
@@ -26,5 +27,5 @@
-diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
-index b5a84f3dcd..5fb055ea2e 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)
+diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
+index bef269298b..fcb78ad4ea 100644
+--- a/lib/librte_vhost/vhost_user.c
++++ b/lib/librte_vhost/vhost_user.c
+@@ -559,7 +559,8 @@ numa_realloc(struct virtio_net *dev, int index)
@@ -40 +41 @@
-@@ -583,6 +584,17 @@ numa_realloc(struct virtio_net *dev, int index)
+@@ -584,6 +585,17 @@ numa_realloc(struct virtio_net *dev, int index)


More information about the stable mailing list