* [dpdk-stable] [PATCH] eal: fix memory mapping for 32-bit targets
@ 2021-05-07 18:10 Lance Richardson
2021-05-07 18:50 ` Lance Richardson
` (4 more replies)
0 siblings, 5 replies; 20+ messages in thread
From: Lance Richardson @ 2021-05-07 18:10 UTC (permalink / raw)
To: Dmitry Kozlyuk, Narcisa Ana Maria Vasile, Dmitry Malloy, Pallavi Kadam
Cc: dev, stable
[-- Attachment #1: Type: text/plain, Size: 2751 bytes --]
For 32-bit targets, size_t is normally a 32-bit type and
does not have sufficient range to represent 64-bit offsets
that can are needed when mapping PCI addresses. Use off_t
instead, which is usually a 64-bit type when compiled with
_D_FILE_OFFSET_BITS=64 as is the case for DPDK.
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")
Cc: stable@dpdk.org
Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
---
lib/eal/include/rte_eal_paging.h | 2 +-
lib/eal/unix/eal_unix_memory.c | 10 +++++-----
lib/eal/windows/eal_memory.c | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/lib/eal/include/rte_eal_paging.h b/lib/eal/include/rte_eal_paging.h
index ed98e70e9e..2c05025ffc 100644
--- a/lib/eal/include/rte_eal_paging.h
+++ b/lib/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, off_t offset);
/**
* OS-independent implementation of POSIX munmap(3).
diff --git a/lib/eal/unix/eal_unix_memory.c b/lib/eal/unix/eal_unix_memory.c
index ec7156df96..51a42e1a43 100644
--- a/lib/eal/unix/eal_unix_memory.c
+++ b/lib/eal/unix/eal_unix_memory.c
@@ -24,14 +24,14 @@
static void *
mem_map(void *requested_addr, size_t size, int prot, int flags,
- int fd, size_t offset)
+ int fd, off_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%llx): %s\n",
+ requested_addr, size, prot, flags, fd,
+ (unsigned long long)offset, strerror(errno));
rte_errno = errno;
return NULL;
}
@@ -106,7 +106,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, off_t offset)
{
int sys_flags = 0;
int sys_prot;
diff --git a/lib/eal/windows/eal_memory.c b/lib/eal/windows/eal_memory.c
index 2cf5a5e649..f1c4b03e96 100644
--- a/lib/eal/windows/eal_memory.c
+++ b/lib/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, off_t offset)
{
HANDLE file_handle = INVALID_HANDLE_VALUE;
HANDLE mapping_handle = INVALID_HANDLE_VALUE;
--
2.25.1
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [dpdk-stable] [PATCH] eal: fix memory mapping for 32-bit targets
2021-05-07 18:10 [dpdk-stable] [PATCH] eal: fix memory mapping for 32-bit targets Lance Richardson
@ 2021-05-07 18:50 ` Lance Richardson
2021-05-07 18:55 ` Lance Richardson
2021-05-07 19:06 ` [dpdk-stable] [PATCH v2] " Lance Richardson
` (3 subsequent siblings)
4 siblings, 1 reply; 20+ messages in thread
From: Lance Richardson @ 2021-05-07 18:50 UTC (permalink / raw)
To: Dmitry Kozlyuk, Narcisa Ana Maria Vasile, Dmitry Malloy, Pallavi Kadam
Cc: dev, dpdk stable
[-- Attachment #1: Type: text/plain, Size: 3393 bytes --]
On Fri, May 7, 2021 at 2:10 PM Lance Richardson
<lance.richardson@broadcom.com> wrote:
>
> For 32-bit targets, size_t is normally a 32-bit type and
> does not have sufficient range to represent 64-bit offsets
> that can are needed when mapping PCI addresses. Use off_t
> instead, which is usually a 64-bit type when compiled with
> _D_FILE_OFFSET_BITS=64 as is the case for DPDK.
>
> 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")
> Cc: stable@dpdk.org
> Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
> ---
> lib/eal/include/rte_eal_paging.h | 2 +-
> lib/eal/unix/eal_unix_memory.c | 10 +++++-----
> lib/eal/windows/eal_memory.c | 2 +-
> 3 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/lib/eal/include/rte_eal_paging.h b/lib/eal/include/rte_eal_paging.h
> index ed98e70e9e..2c05025ffc 100644
> --- a/lib/eal/include/rte_eal_paging.h
> +++ b/lib/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, off_t offset);
>
> /**
> * OS-independent implementation of POSIX munmap(3).
> diff --git a/lib/eal/unix/eal_unix_memory.c b/lib/eal/unix/eal_unix_memory.c
> index ec7156df96..51a42e1a43 100644
> --- a/lib/eal/unix/eal_unix_memory.c
> +++ b/lib/eal/unix/eal_unix_memory.c
> @@ -24,14 +24,14 @@
>
> static void *
> mem_map(void *requested_addr, size_t size, int prot, int flags,
> - int fd, size_t offset)
> + int fd, off_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%llx): %s\n",
> + requested_addr, size, prot, flags, fd,
> + (unsigned long long)offset, strerror(errno));
> rte_errno = errno;
> return NULL;
> }
> @@ -106,7 +106,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, off_t offset)
> {
> int sys_flags = 0;
> int sys_prot;
> diff --git a/lib/eal/windows/eal_memory.c b/lib/eal/windows/eal_memory.c
> index 2cf5a5e649..f1c4b03e96 100644
> --- a/lib/eal/windows/eal_memory.c
> +++ b/lib/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, off_t offset)
> {
> HANDLE file_handle = INVALID_HANDLE_VALUE;
> HANDLE mapping_handle = INVALID_HANDLE_VALUE;
> --
> 2.25.1
>
Windows compilation is failing in CI, apparently Windows doesn't
understand "off_t".
Should we add an "rte_off_t" definition for non-POSIX portability?
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [dpdk-stable] [PATCH] eal: fix memory mapping for 32-bit targets
2021-05-07 18:50 ` Lance Richardson
@ 2021-05-07 18:55 ` Lance Richardson
0 siblings, 0 replies; 20+ messages in thread
From: Lance Richardson @ 2021-05-07 18:55 UTC (permalink / raw)
To: Dmitry Kozlyuk, Narcisa Ana Maria Vasile, Dmitry Malloy, Pallavi Kadam
Cc: dev, dpdk stable
[-- Attachment #1: Type: text/plain, Size: 225 bytes --]
> Windows compilation is failing in CI, apparently Windows doesn't
> understand "off_t".
>
> Should we add an "rte_off_t" definition for non-POSIX portability?
On second thought, it's probably better to simply use uint64_t.
^ permalink raw reply [flat|nested] 20+ messages in thread
* [dpdk-stable] [PATCH v2] eal: fix memory mapping for 32-bit targets
2021-05-07 18:10 [dpdk-stable] [PATCH] eal: fix memory mapping for 32-bit targets Lance Richardson
2021-05-07 18:50 ` Lance Richardson
@ 2021-05-07 19:06 ` Lance Richardson
2021-05-07 20:51 ` Dmitry Kozlyuk
2021-05-08 14:12 ` [dpdk-stable] [PATCH] " Lance Richardson
` (2 subsequent siblings)
4 siblings, 1 reply; 20+ messages in thread
From: Lance Richardson @ 2021-05-07 19:06 UTC (permalink / raw)
To: Dmitry Kozlyuk, Narcisa Ana Maria Vasile, Dmitry Malloy, Pallavi Kadam
Cc: dev, stable
[-- Attachment #1: Type: text/plain, Size: 2734 bytes --]
For 32-bit targets, size_t is normally a 32-bit type and
does not have sufficient range to represent 64-bit offsets
that can 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")
Cc: stable@dpdk.org
Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
---
v2: Use uint64_t instead of off_t (off_t is unknown to Windows).
lib/eal/include/rte_eal_paging.h | 2 +-
lib/eal/unix/eal_unix_memory.c | 10 +++++-----
lib/eal/windows/eal_memory.c | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/lib/eal/include/rte_eal_paging.h b/lib/eal/include/rte_eal_paging.h
index ed98e70e9e..c60317d0f5 100644
--- a/lib/eal/include/rte_eal_paging.h
+++ b/lib/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/eal/unix/eal_unix_memory.c b/lib/eal/unix/eal_unix_memory.c
index ec7156df96..41a94a7511 100644
--- a/lib/eal/unix/eal_unix_memory.c
+++ b/lib/eal/unix/eal_unix_memory.c
@@ -24,14 +24,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%llx): %s\n",
+ requested_addr, size, prot, flags, fd,
+ (unsigned long long)offset, strerror(errno));
rte_errno = errno;
return NULL;
}
@@ -106,7 +106,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/eal/windows/eal_memory.c b/lib/eal/windows/eal_memory.c
index 2cf5a5e649..4db048ccb5 100644
--- a/lib/eal/windows/eal_memory.c
+++ b/lib/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
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [dpdk-stable] [PATCH v2] eal: fix memory mapping for 32-bit targets
2021-05-07 19:06 ` [dpdk-stable] [PATCH v2] " Lance Richardson
@ 2021-05-07 20:51 ` Dmitry Kozlyuk
2021-05-07 21:35 ` Lance Richardson
0 siblings, 1 reply; 20+ messages in thread
From: Dmitry Kozlyuk @ 2021-05-07 20:51 UTC (permalink / raw)
To: Lance Richardson
Cc: Narcisa Ana Maria Vasile, Dmitry Malloy, Pallavi Kadam, dev, stable
2021-05-07 15:06 (UTC-0400), Lance Richardson:
[...]
> diff --git a/lib/eal/unix/eal_unix_memory.c b/lib/eal/unix/eal_unix_memory.c
> index ec7156df96..41a94a7511 100644
> --- a/lib/eal/unix/eal_unix_memory.c
> +++ b/lib/eal/unix/eal_unix_memory.c
> @@ -24,14 +24,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%llx): %s\n",
> + requested_addr, size, prot, flags, fd,
> + (unsigned long long)offset, strerror(errno));
Why not PRIx64?
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [dpdk-stable] [PATCH v2] eal: fix memory mapping for 32-bit targets
2021-05-07 20:51 ` Dmitry Kozlyuk
@ 2021-05-07 21:35 ` Lance Richardson
0 siblings, 0 replies; 20+ messages in thread
From: Lance Richardson @ 2021-05-07 21:35 UTC (permalink / raw)
To: Dmitry Kozlyuk
Cc: Narcisa Ana Maria Vasile, Dmitry Malloy, Pallavi Kadam, dev, dpdk stable
[-- Attachment #1: Type: text/plain, Size: 1179 bytes --]
On Fri, May 7, 2021 at 4:51 PM Dmitry Kozlyuk <dmitry.kozliuk@gmail.com> wrote:
>
> 2021-05-07 15:06 (UTC-0400), Lance Richardson:
> [...]
> > diff --git a/lib/eal/unix/eal_unix_memory.c b/lib/eal/unix/eal_unix_memory.c
> > index ec7156df96..41a94a7511 100644
> > --- a/lib/eal/unix/eal_unix_memory.c
> > +++ b/lib/eal/unix/eal_unix_memory.c
> > @@ -24,14 +24,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%llx): %s\n",
> > + requested_addr, size, prot, flags, fd,
> > + (unsigned long long)offset, strerror(errno));
>
> Why not PRIx64?
Good point. %llx made sense for off_t.
Thanks,
Lance
^ permalink raw reply [flat|nested] 20+ messages in thread
* [dpdk-stable] [PATCH] eal: fix memory mapping for 32-bit targets
2021-05-07 18:10 [dpdk-stable] [PATCH] eal: fix memory mapping for 32-bit targets Lance Richardson
2021-05-07 18:50 ` Lance Richardson
2021-05-07 19:06 ` [dpdk-stable] [PATCH v2] " Lance Richardson
@ 2021-05-08 14:12 ` Lance Richardson
2021-05-08 14:27 ` [dpdk-stable] [PATCH v3] " Lance Richardson
2021-05-11 14:45 ` [dpdk-stable] [PATCH v4] " Lance Richardson
4 siblings, 0 replies; 20+ messages in thread
From: Lance Richardson @ 2021-05-08 14:12 UTC (permalink / raw)
To: Dmitry Kozlyuk, Narcisa Ana Maria Vasile, Dmitry Malloy, Pallavi Kadam
Cc: dev, stable
[-- Attachment #1: Type: text/plain, Size: 2951 bytes --]
For 32-bit targets, size_t is normally a 32-bit type and
does not have sufficient range to represent 64-bit offsets
that can 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")
Cc: stable@dpdk.org
Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
---
v3: Use PRIx64 instead of llx to format offset in log message.
v2: Use uint64_t instead of off_t (off_t is unknown to Windows).
lib/eal/include/rte_eal_paging.h | 2 +-
lib/eal/unix/eal_unix_memory.c | 11 ++++++-----
lib/eal/windows/eal_memory.c | 2 +-
3 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/lib/eal/include/rte_eal_paging.h b/lib/eal/include/rte_eal_paging.h
index ed98e70e9e..c60317d0f5 100644
--- a/lib/eal/include/rte_eal_paging.h
+++ b/lib/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/eal/unix/eal_unix_memory.c b/lib/eal/unix/eal_unix_memory.c
index ec7156df96..68ae93bd6e 100644
--- a/lib/eal/unix/eal_unix_memory.c
+++ b/lib/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/eal/windows/eal_memory.c b/lib/eal/windows/eal_memory.c
index 2cf5a5e649..4db048ccb5 100644
--- a/lib/eal/windows/eal_memory.c
+++ b/lib/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
^ permalink raw reply [flat|nested] 20+ messages in thread
* [dpdk-stable] [PATCH v3] eal: fix memory mapping for 32-bit targets
2021-05-07 18:10 [dpdk-stable] [PATCH] eal: fix memory mapping for 32-bit targets Lance Richardson
` (2 preceding siblings ...)
2021-05-08 14:12 ` [dpdk-stable] [PATCH] " Lance Richardson
@ 2021-05-08 14:27 ` Lance Richardson
2021-05-10 12:42 ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon
2021-05-11 8:17 ` Thomas Monjalon
2021-05-11 14:45 ` [dpdk-stable] [PATCH v4] " Lance Richardson
4 siblings, 2 replies; 20+ messages in thread
From: Lance Richardson @ 2021-05-08 14:27 UTC (permalink / raw)
To: Dmitry Kozlyuk, Narcisa Ana Maria Vasile, Dmitry Malloy, Pallavi Kadam
Cc: dev, stable
[-- Attachment #1: Type: text/plain, Size: 2951 bytes --]
For 32-bit targets, size_t is normally a 32-bit type and
does not have sufficient range to represent 64-bit offsets
that can 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")
Cc: stable@dpdk.org
Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
---
v3: Use PRIx64 instead of llx to format offset in log message.
v2: Use uint64_t instead of off_t (off_t is unknown to Windows).
lib/eal/include/rte_eal_paging.h | 2 +-
lib/eal/unix/eal_unix_memory.c | 11 ++++++-----
lib/eal/windows/eal_memory.c | 2 +-
3 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/lib/eal/include/rte_eal_paging.h b/lib/eal/include/rte_eal_paging.h
index ed98e70e9e..c60317d0f5 100644
--- a/lib/eal/include/rte_eal_paging.h
+++ b/lib/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/eal/unix/eal_unix_memory.c b/lib/eal/unix/eal_unix_memory.c
index ec7156df96..68ae93bd6e 100644
--- a/lib/eal/unix/eal_unix_memory.c
+++ b/lib/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/eal/windows/eal_memory.c b/lib/eal/windows/eal_memory.c
index 2cf5a5e649..4db048ccb5 100644
--- a/lib/eal/windows/eal_memory.c
+++ b/lib/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
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH v3] eal: fix memory mapping for 32-bit targets
2021-05-08 14:27 ` [dpdk-stable] [PATCH v3] " Lance Richardson
@ 2021-05-10 12:42 ` Thomas Monjalon
2021-05-10 15:31 ` Burakov, Anatoly
2021-05-11 8:17 ` Thomas Monjalon
1 sibling, 1 reply; 20+ messages in thread
From: Thomas Monjalon @ 2021-05-10 12:42 UTC (permalink / raw)
To: Lance Richardson
Cc: Dmitry Kozlyuk, Narcisa Ana Maria Vasile, Dmitry Malloy,
Pallavi Kadam, dev, stable, anatoly.burakov
+Cc Anatoly
08/05/2021 16:27, Lance Richardson:
> For 32-bit targets, size_t is normally a 32-bit type and
> does not have sufficient range to represent 64-bit offsets
> that can 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")
> Cc: stable@dpdk.org
> Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
> ---
> v3: Use PRIx64 instead of llx to format offset in log message.
> v2: Use uint64_t instead of off_t (off_t is unknown to Windows).
>
> lib/eal/include/rte_eal_paging.h | 2 +-
> lib/eal/unix/eal_unix_memory.c | 11 ++++++-----
> lib/eal/windows/eal_memory.c | 2 +-
> 3 files changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/lib/eal/include/rte_eal_paging.h b/lib/eal/include/rte_eal_paging.h
> index ed98e70e9e..c60317d0f5 100644
> --- a/lib/eal/include/rte_eal_paging.h
> +++ b/lib/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/eal/unix/eal_unix_memory.c b/lib/eal/unix/eal_unix_memory.c
> index ec7156df96..68ae93bd6e 100644
> --- a/lib/eal/unix/eal_unix_memory.c
> +++ b/lib/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/eal/windows/eal_memory.c b/lib/eal/windows/eal_memory.c
> index 2cf5a5e649..4db048ccb5 100644
> --- a/lib/eal/windows/eal_memory.c
> +++ b/lib/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;
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH v3] eal: fix memory mapping for 32-bit targets
2021-05-10 12:42 ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon
@ 2021-05-10 15:31 ` Burakov, Anatoly
2021-05-10 15:55 ` Thomas Monjalon
2021-05-11 20:45 ` Thomas Monjalon
0 siblings, 2 replies; 20+ messages in thread
From: Burakov, Anatoly @ 2021-05-10 15:31 UTC (permalink / raw)
To: Thomas Monjalon, Lance Richardson
Cc: Dmitry Kozlyuk, Narcisa Ana Maria Vasile, Dmitry Malloy,
Pallavi Kadam, dev, stable
On 10-May-21 1:42 PM, Thomas Monjalon wrote:
> +Cc Anatoly
>
> 08/05/2021 16:27, Lance Richardson:
>> For 32-bit targets, size_t is normally a 32-bit type and
>> does not have sufficient range to represent 64-bit offsets
>> that can 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")
>> Cc: stable@dpdk.org
>> Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
>> ---
LGTM, although the Fixes: tag is probably wrong because IIRC previous
versions did have the same issue.
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
--
Thanks,
Anatoly
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH v3] eal: fix memory mapping for 32-bit targets
2021-05-10 15:31 ` Burakov, Anatoly
@ 2021-05-10 15:55 ` Thomas Monjalon
2021-05-10 16:04 ` Lance Richardson
2021-05-11 20:45 ` Thomas Monjalon
1 sibling, 1 reply; 20+ messages in thread
From: Thomas Monjalon @ 2021-05-10 15:55 UTC (permalink / raw)
To: Lance Richardson, Burakov, Anatoly
Cc: Dmitry Kozlyuk, Narcisa Ana Maria Vasile, Dmitry Malloy,
Pallavi Kadam, dev, stable
10/05/2021 17:31, Burakov, Anatoly:
> On 10-May-21 1:42 PM, Thomas Monjalon wrote:
> > +Cc Anatoly
> >
> > 08/05/2021 16:27, Lance Richardson:
> >> For 32-bit targets, size_t is normally a 32-bit type and
> >> does not have sufficient range to represent 64-bit offsets
> >> that can 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")
> >> Cc: stable@dpdk.org
> >> Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
> >> ---
>
> LGTM, although the Fixes: tag is probably wrong because IIRC previous
> versions did have the same issue.
What should be the right Fixes tag Anatoly?
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH v3] eal: fix memory mapping for 32-bit targets
2021-05-10 15:55 ` Thomas Monjalon
@ 2021-05-10 16:04 ` Lance Richardson
2021-05-11 7:55 ` Thomas Monjalon
0 siblings, 1 reply; 20+ messages in thread
From: Lance Richardson @ 2021-05-10 16:04 UTC (permalink / raw)
To: Thomas Monjalon
Cc: Burakov, Anatoly, Dmitry Kozlyuk, Narcisa Ana Maria Vasile,
Dmitry Malloy, Pallavi Kadam, dev, dpdk stable
[-- Attachment #1: Type: text/plain, Size: 1306 bytes --]
On Mon, May 10, 2021 at 11:55 AM Thomas Monjalon <thomas@monjalon.net>
wrote:
> 10/05/2021 17:31, Burakov, Anatoly:
> > On 10-May-21 1:42 PM, Thomas Monjalon wrote:
> > > +Cc Anatoly
> > >
> > > 08/05/2021 16:27, Lance Richardson:
> > >> For 32-bit targets, size_t is normally a 32-bit type and
> > >> does not have sufficient range to represent 64-bit offsets
> > >> that can 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")
> > >> Cc: stable@dpdk.org
> > >> Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
> > >> ---
> >
> > LGTM, although the Fixes: tag is probably wrong because IIRC previous
> > versions did have the same issue.
>
> What should be the right Fixes tag Anatoly?
>
I think this would be more appropriate (prior to this commit,
pci_map_resource()
called mmap() directly with off_t offset, with this commit offset was
narrowed
to size_t before calling mmap()):
Fixes: 2fd3567e5425 ("pci: use OS generic memory mapping functions")
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH v3] eal: fix memory mapping for 32-bit targets
2021-05-10 16:04 ` Lance Richardson
@ 2021-05-11 7:55 ` Thomas Monjalon
0 siblings, 0 replies; 20+ messages in thread
From: Thomas Monjalon @ 2021-05-11 7:55 UTC (permalink / raw)
To: Lance Richardson
Cc: stable, Burakov, Anatoly, Dmitry Kozlyuk,
Narcisa Ana Maria Vasile, Dmitry Malloy, Pallavi Kadam, dev,
dpdk stable
10/05/2021 18:04, Lance Richardson:
> On Mon, May 10, 2021 at 11:55 AM Thomas Monjalon <thomas@monjalon.net>
> wrote:
>
> > 10/05/2021 17:31, Burakov, Anatoly:
> > > On 10-May-21 1:42 PM, Thomas Monjalon wrote:
> > > > +Cc Anatoly
> > > >
> > > > 08/05/2021 16:27, Lance Richardson:
> > > >> For 32-bit targets, size_t is normally a 32-bit type and
> > > >> does not have sufficient range to represent 64-bit offsets
> > > >> that can 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")
> > > >> Cc: stable@dpdk.org
> > > >> Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
> > > >> ---
> > >
> > > LGTM, although the Fixes: tag is probably wrong because IIRC previous
> > > versions did have the same issue.
> >
> > What should be the right Fixes tag Anatoly?
> >
>
> I think this would be more appropriate (prior to this commit,
> pci_map_resource()
> called mmap() directly with off_t offset, with this commit offset was
> narrowed
> to size_t before calling mmap()):
>
> Fixes: 2fd3567e5425 ("pci: use OS generic memory mapping functions")
That's only one usage of rte_mem_map.
I prefer the original Fixes: line.
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH v3] eal: fix memory mapping for 32-bit targets
2021-05-08 14:27 ` [dpdk-stable] [PATCH v3] " Lance Richardson
2021-05-10 12:42 ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon
@ 2021-05-11 8:17 ` Thomas Monjalon
2021-05-11 13:33 ` Lance Richardson
1 sibling, 1 reply; 20+ messages in thread
From: Thomas Monjalon @ 2021-05-11 8:17 UTC (permalink / raw)
To: Dmitry Kozlyuk, Lance Richardson
Cc: Narcisa Ana Maria Vasile, Dmitry Malloy, Pallavi Kadam, dev,
stable, talshn
08/05/2021 16:27, Lance Richardson:
> For 32-bit targets, size_t is normally a 32-bit type and
> does not have sufficient range to represent 64-bit offsets
> that can 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")
> Cc: stable@dpdk.org
> Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
> ---
> v3: Use PRIx64 instead of llx to format offset in log message.
> v2: Use uint64_t instead of off_t (off_t is unknown to Windows).
off_t is referenced in drivers/bus/pci/windows/pci.c
(for unused parameter) so it should be fine?
If not, we could add it?
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH v3] eal: fix memory mapping for 32-bit targets
2021-05-11 8:17 ` Thomas Monjalon
@ 2021-05-11 13:33 ` Lance Richardson
0 siblings, 0 replies; 20+ messages in thread
From: Lance Richardson @ 2021-05-11 13:33 UTC (permalink / raw)
To: Thomas Monjalon
Cc: Dmitry Kozlyuk, Narcisa Ana Maria Vasile, Dmitry Malloy,
Pallavi Kadam, dev, dpdk stable, talshn
[-- Attachment #1: Type: text/plain, Size: 1360 bytes --]
On Tue, May 11, 2021 at 4:18 AM Thomas Monjalon <thomas@monjalon.net> wrote:
>
> 08/05/2021 16:27, Lance Richardson:
> > For 32-bit targets, size_t is normally a 32-bit type and
> > does not have sufficient range to represent 64-bit offsets
> > that can 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")
> > Cc: stable@dpdk.org
> > Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
> > ---
> > v3: Use PRIx64 instead of llx to format offset in log message.
> > v2: Use uint64_t instead of off_t (off_t is unknown to Windows).
>
> off_t is referenced in drivers/bus/pci/windows/pci.c
> (for unused parameter) so it should be fine?
> If not, we could add it?
v1 of the patch had the following build error in CI:
*Build Failed #1:
OS: WIN10-64
Target: x86_64-windows-clang
FAILED: lib/librte_eal.a.p/eal_common_eal_common_fbarray.c.obj
....
In file included from ../lib/eal/common/eal_common_fbarray.c:14:
..\lib\eal\include\rte_eal_paging.h:64:10: error: unknown type name 'off_t'
int fd, off_t offset);
^ permalink raw reply [flat|nested] 20+ messages in thread
* [dpdk-stable] [PATCH v4] eal: fix memory mapping for 32-bit targets
2021-05-07 18:10 [dpdk-stable] [PATCH] eal: fix memory mapping for 32-bit targets Lance Richardson
` (3 preceding siblings ...)
2021-05-08 14:27 ` [dpdk-stable] [PATCH v3] " Lance Richardson
@ 2021-05-11 14:45 ` Lance Richardson
2021-05-11 15:56 ` Lance Richardson
4 siblings, 1 reply; 20+ messages in thread
From: Lance Richardson @ 2021-05-11 14:45 UTC (permalink / raw)
To: Dmitry Kozlyuk, Narcisa Ana Maria Vasile, Dmitry Malloy, Pallavi Kadam
Cc: dev, anatoly.burakov, thomas, stable
[-- Attachment #1: Type: text/plain, Size: 3115 bytes --]
For 32-bit targets, size_t is normally a 32-bit type and
does not have sufficient range to represent 64-bit offsets
that can are needed when mapping PCI addresses. Use off_t
instead, which is usually a 64-bit type when compiled with
_D_FILE_OFFSET_BITS=64 as is the case for DPDK.
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")
Cc: stable@dpdk.org
Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
---
v4: Identical to v1, with <sys/types.h> now included in rte_eal_paging.h
to (hopefully) make off_t available for Windows builds.
v3: Use PRIx64 instead of llx ot format offset in log message.
v2: Use uint64_t instead of off_t (off_t is unknown to Windows).
lib/eal/include/rte_eal_paging.h | 3 ++-
lib/eal/unix/eal_unix_memory.c | 10 +++++-----
lib/eal/windows/eal_memory.c | 2 +-
3 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/lib/eal/include/rte_eal_paging.h b/lib/eal/include/rte_eal_paging.h
index ed98e70e9e..974bf5ee64 100644
--- a/lib/eal/include/rte_eal_paging.h
+++ b/lib/eal/include/rte_eal_paging.h
@@ -3,6 +3,7 @@
*/
#include <stdint.h>
+#include <sys/types.h>
#include <rte_compat.h>
@@ -61,7 +62,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, off_t offset);
/**
* OS-independent implementation of POSIX munmap(3).
diff --git a/lib/eal/unix/eal_unix_memory.c b/lib/eal/unix/eal_unix_memory.c
index ec7156df96..51a42e1a43 100644
--- a/lib/eal/unix/eal_unix_memory.c
+++ b/lib/eal/unix/eal_unix_memory.c
@@ -24,14 +24,14 @@
static void *
mem_map(void *requested_addr, size_t size, int prot, int flags,
- int fd, size_t offset)
+ int fd, off_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%llx): %s\n",
+ requested_addr, size, prot, flags, fd,
+ (unsigned long long)offset, strerror(errno));
rte_errno = errno;
return NULL;
}
@@ -106,7 +106,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, off_t offset)
{
int sys_flags = 0;
int sys_prot;
diff --git a/lib/eal/windows/eal_memory.c b/lib/eal/windows/eal_memory.c
index 2cf5a5e649..f1c4b03e96 100644
--- a/lib/eal/windows/eal_memory.c
+++ b/lib/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, off_t offset)
{
HANDLE file_handle = INVALID_HANDLE_VALUE;
HANDLE mapping_handle = INVALID_HANDLE_VALUE;
--
2.25.1
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [dpdk-stable] [PATCH v4] eal: fix memory mapping for 32-bit targets
2021-05-11 14:45 ` [dpdk-stable] [PATCH v4] " Lance Richardson
@ 2021-05-11 15:56 ` Lance Richardson
2021-05-11 16:08 ` Dmitry Kozlyuk
0 siblings, 1 reply; 20+ messages in thread
From: Lance Richardson @ 2021-05-11 15:56 UTC (permalink / raw)
To: Dmitry Kozlyuk, Narcisa Ana Maria Vasile, Dmitry Malloy, Pallavi Kadam
Cc: dev, Anatoly Burakov, Thomas Monjalon, dpdk stable
[-- Attachment #1: Type: text/plain, Size: 658 bytes --]
> v4: Identical to v1, with <sys/types.h> now included in rte_eal_paging.h
> to (hopefully) make off_t available for Windows builds.
With this version, using off_t is no longer a problem, however based on the
new compilation error it appears that for Windows, off_t is a 32-bit type
while size_t is a 64-bit type:
../lib/eal/windows/eal_memory.c:519:37: error: shift count >= width of
type [-Werror,-Wshift-count-overflow]
DWORD offset_high = (DWORD)(offset >> 32);
^ ~~
So the options seem to be to either use uint64_t for the offset parameter
as in patch v3, or else introduce something like:
typedef uint64_t rte_off_t;
Thoughts/opinions?
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [dpdk-stable] [PATCH v4] eal: fix memory mapping for 32-bit targets
2021-05-11 15:56 ` Lance Richardson
@ 2021-05-11 16:08 ` Dmitry Kozlyuk
2021-05-11 20:45 ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon
0 siblings, 1 reply; 20+ messages in thread
From: Dmitry Kozlyuk @ 2021-05-11 16:08 UTC (permalink / raw)
To: Lance Richardson
Cc: Narcisa Ana Maria Vasile, Dmitry Malloy, Pallavi Kadam, dev,
Anatoly Burakov, Thomas Monjalon, dpdk stable
2021-05-11 11:56 (UTC-0400), Lance Richardson:
> > v4: Identical to v1, with <sys/types.h> now included in rte_eal_paging.h
> > to (hopefully) make off_t available for Windows builds.
>
> With this version, using off_t is no longer a problem, however based on the
> new compilation error it appears that for Windows, off_t is a 32-bit type
> while size_t is a 64-bit type:
>
> ../lib/eal/windows/eal_memory.c:519:37: error: shift count >= width of
> type [-Werror,-Wshift-count-overflow]
> DWORD offset_high = (DWORD)(offset >> 32);
> ^ ~~
>
> So the options seem to be to either use uint64_t for the offset parameter
> as in patch v3, or else introduce something like:
> typedef uint64_t rte_off_t;
>
> Thoughts/opinions?
I'm for uint64_t: it's explicit and will hardly ever change.
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH v3] eal: fix memory mapping for 32-bit targets
2021-05-10 15:31 ` Burakov, Anatoly
2021-05-10 15:55 ` Thomas Monjalon
@ 2021-05-11 20:45 ` Thomas Monjalon
1 sibling, 0 replies; 20+ messages in thread
From: Thomas Monjalon @ 2021-05-11 20:45 UTC (permalink / raw)
To: Lance Richardson
Cc: dev, Dmitry Kozlyuk, Narcisa Ana Maria Vasile, Dmitry Malloy,
Pallavi Kadam, stable, Burakov, Anatoly, david.marchand
10/05/2021 17:31, Burakov, Anatoly:
> On 10-May-21 1:42 PM, Thomas Monjalon wrote:
> > +Cc Anatoly
> >
> > 08/05/2021 16:27, Lance Richardson:
> >> For 32-bit targets, size_t is normally a 32-bit type and
> >> does not have sufficient range to represent 64-bit offsets
> >> that can 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")
> >> Cc: stable@dpdk.org
> >> Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
> >> ---
>
> LGTM, although the Fixes: tag is probably wrong because IIRC previous
> versions did have the same issue.
>
> Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
v3 applied, thanks
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH v4] eal: fix memory mapping for 32-bit targets
2021-05-11 16:08 ` Dmitry Kozlyuk
@ 2021-05-11 20:45 ` Thomas Monjalon
0 siblings, 0 replies; 20+ messages in thread
From: Thomas Monjalon @ 2021-05-11 20:45 UTC (permalink / raw)
To: Lance Richardson, Dmitry Kozlyuk
Cc: dev, Narcisa Ana Maria Vasile, Dmitry Malloy, Pallavi Kadam,
Anatoly Burakov, dpdk stable
11/05/2021 18:08, Dmitry Kozlyuk:
> 2021-05-11 11:56 (UTC-0400), Lance Richardson:
> > > v4: Identical to v1, with <sys/types.h> now included in rte_eal_paging.h
> > > to (hopefully) make off_t available for Windows builds.
> >
> > With this version, using off_t is no longer a problem, however based on the
> > new compilation error it appears that for Windows, off_t is a 32-bit type
> > while size_t is a 64-bit type:
> >
> > ../lib/eal/windows/eal_memory.c:519:37: error: shift count >= width of
> > type [-Werror,-Wshift-count-overflow]
> > DWORD offset_high = (DWORD)(offset >> 32);
> > ^ ~~
> >
> > So the options seem to be to either use uint64_t for the offset parameter
> > as in patch v3, or else introduce something like:
> > typedef uint64_t rte_off_t;
> >
> > Thoughts/opinions?
>
> I'm for uint64_t: it's explicit and will hardly ever change.
OK, v3 applied.
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2021-05-11 20:45 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-07 18:10 [dpdk-stable] [PATCH] eal: fix memory mapping for 32-bit targets Lance Richardson
2021-05-07 18:50 ` Lance Richardson
2021-05-07 18:55 ` Lance Richardson
2021-05-07 19:06 ` [dpdk-stable] [PATCH v2] " Lance Richardson
2021-05-07 20:51 ` Dmitry Kozlyuk
2021-05-07 21:35 ` Lance Richardson
2021-05-08 14:12 ` [dpdk-stable] [PATCH] " Lance Richardson
2021-05-08 14:27 ` [dpdk-stable] [PATCH v3] " Lance Richardson
2021-05-10 12:42 ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon
2021-05-10 15:31 ` Burakov, Anatoly
2021-05-10 15:55 ` Thomas Monjalon
2021-05-10 16:04 ` Lance Richardson
2021-05-11 7:55 ` Thomas Monjalon
2021-05-11 20:45 ` Thomas Monjalon
2021-05-11 8:17 ` Thomas Monjalon
2021-05-11 13:33 ` Lance Richardson
2021-05-11 14:45 ` [dpdk-stable] [PATCH v4] " Lance Richardson
2021-05-11 15:56 ` Lance Richardson
2021-05-11 16:08 ` Dmitry Kozlyuk
2021-05-11 20:45 ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).