[dpdk-stable] patch 'eal: fix memory mapping on 32-bit target' has been queued to stable release 20.11.2

Xueming Li xuemingl at nvidia.com
Sat Jun 12 01:03:11 CEST 2021


Hi,

FYI, your patch has been queued to stable release 20.11.2

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 06/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/steevenlee/dpdk

This queued commit can be viewed at:
https://github.com/steevenlee/dpdk/commit/3aadd33dd27258388af609121ea1dd415f575b05

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From 3aadd33dd27258388af609121ea1dd415f575b05 Mon Sep 17 00:00:00 2001
From: Lance Richardson <lance.richardson at broadcom.com>
Date: Sat, 8 May 2021 10:27:53 -0400
Subject: [PATCH] eal: fix memory mapping on 32-bit target
Cc: Luca Boccassi <bluca at debian.org>

[ upstream commit 6beb2d294743aad1488234109a3ad95a8d5a273f ]

For 32-bit targets, size_t is normally a 32-bit type and
does not have sufficient range to represent 64-bit offsets
that are needed when mapping PCI addresses.
Use uint64_t instead.

Found when attempting to run 32-bit Linux dpdk-testpmd
using VFIO driver:

    EAL: pci_map_resource(): cannot map resource(63, 0xc0010000, \
    0x200000, 0x20000000000): Invalid argument ((nil))

Fixes: c4b89ecb64ea ("eal: introduce memory management wrappers")

Signed-off-by: Lance Richardson <lance.richardson at broadcom.com>
Acked-by: Anatoly Burakov <anatoly.burakov at intel.com>
---
 lib/librte_eal/include/rte_eal_paging.h |  2 +-
 lib/librte_eal/unix/eal_unix_memory.c   | 11 ++++++-----
 lib/librte_eal/windows/eal_memory.c     |  2 +-
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/lib/librte_eal/include/rte_eal_paging.h b/lib/librte_eal/include/rte_eal_paging.h
index ed98e70e9e..c60317d0f5 100644
--- a/lib/librte_eal/include/rte_eal_paging.h
+++ b/lib/librte_eal/include/rte_eal_paging.h
@@ -61,7 +61,7 @@ enum rte_map_flags {
 __rte_internal
 void *
 rte_mem_map(void *requested_addr, size_t size, int prot, int flags,
-	int fd, size_t offset);
+	int fd, uint64_t offset);
 
 /**
  * OS-independent implementation of POSIX munmap(3).
diff --git a/lib/librte_eal/unix/eal_unix_memory.c b/lib/librte_eal/unix/eal_unix_memory.c
index ec7156df96..68ae93bd6e 100644
--- a/lib/librte_eal/unix/eal_unix_memory.c
+++ b/lib/librte_eal/unix/eal_unix_memory.c
@@ -5,6 +5,7 @@
 #include <string.h>
 #include <sys/mman.h>
 #include <unistd.h>
+#include <inttypes.h>
 
 #include <rte_eal_paging.h>
 #include <rte_errno.h>
@@ -24,14 +25,14 @@
 
 static void *
 mem_map(void *requested_addr, size_t size, int prot, int flags,
-	int fd, size_t offset)
+	int fd, uint64_t offset)
 {
 	void *virt = mmap(requested_addr, size, prot, flags, fd, offset);
 	if (virt == MAP_FAILED) {
 		RTE_LOG(DEBUG, EAL,
-			"Cannot mmap(%p, 0x%zx, 0x%x, 0x%x, %d, 0x%zx): %s\n",
-			requested_addr, size, prot, flags, fd, offset,
-			strerror(errno));
+		    "Cannot mmap(%p, 0x%zx, 0x%x, 0x%x, %d, 0x%"PRIx64"): %s\n",
+		    requested_addr, size, prot, flags, fd, offset,
+		    strerror(errno));
 		rte_errno = errno;
 		return NULL;
 	}
@@ -106,7 +107,7 @@ mem_rte_to_sys_prot(int prot)
 
 void *
 rte_mem_map(void *requested_addr, size_t size, int prot, int flags,
-	int fd, size_t offset)
+	int fd, uint64_t offset)
 {
 	int sys_flags = 0;
 	int sys_prot;
diff --git a/lib/librte_eal/windows/eal_memory.c b/lib/librte_eal/windows/eal_memory.c
index 2cf5a5e649..4db048ccb5 100644
--- a/lib/librte_eal/windows/eal_memory.c
+++ b/lib/librte_eal/windows/eal_memory.c
@@ -508,7 +508,7 @@ eal_mem_set_dump(void *virt, size_t size, bool dump)
 
 void *
 rte_mem_map(void *requested_addr, size_t size, int prot, int flags,
-	int fd, size_t offset)
+	int fd, uint64_t offset)
 {
 	HANDLE file_handle = INVALID_HANDLE_VALUE;
 	HANDLE mapping_handle = INVALID_HANDLE_VALUE;
-- 
2.25.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2021-06-12 06:53:59.125112700 +0800
+++ 0097-eal-fix-memory-mapping-on-32-bit-target.patch	2021-06-12 06:53:56.450000000 +0800
@@ -1 +1 @@
-From 6beb2d294743aad1488234109a3ad95a8d5a273f Mon Sep 17 00:00:00 2001
+From 3aadd33dd27258388af609121ea1dd415f575b05 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Luca Boccassi <bluca at debian.org>
+
+[ upstream commit 6beb2d294743aad1488234109a3ad95a8d5a273f ]
@@ -18 +20,0 @@
-Cc: stable at dpdk.org
@@ -23,3 +25,3 @@
- lib/eal/include/rte_eal_paging.h |  2 +-
- lib/eal/unix/eal_unix_memory.c   | 11 ++++++-----
- lib/eal/windows/eal_memory.c     |  2 +-
+ lib/librte_eal/include/rte_eal_paging.h |  2 +-
+ lib/librte_eal/unix/eal_unix_memory.c   | 11 ++++++-----
+ lib/librte_eal/windows/eal_memory.c     |  2 +-
@@ -28 +30 @@
-diff --git a/lib/eal/include/rte_eal_paging.h b/lib/eal/include/rte_eal_paging.h
+diff --git a/lib/librte_eal/include/rte_eal_paging.h b/lib/librte_eal/include/rte_eal_paging.h
@@ -30,2 +32,2 @@
---- a/lib/eal/include/rte_eal_paging.h
-+++ b/lib/eal/include/rte_eal_paging.h
+--- a/lib/librte_eal/include/rte_eal_paging.h
++++ b/lib/librte_eal/include/rte_eal_paging.h
@@ -41 +43 @@
-diff --git a/lib/eal/unix/eal_unix_memory.c b/lib/eal/unix/eal_unix_memory.c
+diff --git a/lib/librte_eal/unix/eal_unix_memory.c b/lib/librte_eal/unix/eal_unix_memory.c
@@ -43,2 +45,2 @@
---- a/lib/eal/unix/eal_unix_memory.c
-+++ b/lib/eal/unix/eal_unix_memory.c
+--- a/lib/librte_eal/unix/eal_unix_memory.c
++++ b/lib/librte_eal/unix/eal_unix_memory.c
@@ -81 +83 @@
-diff --git a/lib/eal/windows/eal_memory.c b/lib/eal/windows/eal_memory.c
+diff --git a/lib/librte_eal/windows/eal_memory.c b/lib/librte_eal/windows/eal_memory.c
@@ -83,2 +85,2 @@
---- a/lib/eal/windows/eal_memory.c
-+++ b/lib/eal/windows/eal_memory.c
+--- a/lib/librte_eal/windows/eal_memory.c
++++ b/lib/librte_eal/windows/eal_memory.c


More information about the stable mailing list