[v2,2/5] build: enable large file support on 32-bit

Message ID 20190528110748.10772-3-bruce.richardson@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series fix 32-bit meson builds |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail Compilation issues

Commit Message

Bruce Richardson May 28, 2019, 11:07 a.m. UTC
  By default on 32-bit systems, file offsets are given as 32-bit values
which prevents support for large files. While this is unlikely to be
a problem, enabling large file support globally makes "make" and
"meson" builds consistent, since meson always enables large file
support, and without this change, the size of "struct stat" fields
will be different between the two builds.

The only location where this appears to be significant is in the
dpaax common code, where a printf needs to be updated for 32-bit
builds.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>
---
 drivers/common/dpaax/dpaax_iova_table.c | 4 ++--
 mk/arch/arm/rte.vars.mk                 | 2 +-
 mk/arch/i686/rte.vars.mk                | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
  

Comments

Shreyansh Jain May 30, 2019, 6:45 a.m. UTC | #1
> -----Original Message-----
> From: Bruce Richardson <bruce.richardson@intel.com>
> Sent: Tuesday, May 28, 2019 4:38 PM
> To: dev@dpdk.org
> Cc: Shreyansh Jain <shreyansh.jain@nxp.com>; Alejandro Lucero
> <alejandro.lucero@netronome.com>; Anatoly Burakov
> <anatoly.burakov@intel.com>; stable@dpdk.org; Maxime Coquelin
> <maxime.coquelin@redhat.com>; Zhihong Wang <zhihong.wang@intel.com>; Luca
> Boccassi <bluca@debian.org>; Zhang XuemingX <xuemingx.zhang@intel.com>; Bruce
> Richardson <bruce.richardson@intel.com>
> Subject: [PATCH v2 2/5] build: enable large file support on 32-bit
> 
> By default on 32-bit systems, file offsets are given as 32-bit values
> which prevents support for large files. While this is unlikely to be
> a problem, enabling large file support globally makes "make" and
> "meson" builds consistent, since meson always enables large file
> support, and without this change, the size of "struct stat" fields
> will be different between the two builds.
> 
> The only location where this appears to be significant is in the
> dpaax common code, where a printf needs to be updated for 32-bit
> builds.

From DPAAX perspective, I am not worried about 32bit and dependency of large file support.
So, this 'don't care' from my side.

> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> Acked-by: Luca Boccassi <bluca@debian.org>
> ---
>  drivers/common/dpaax/dpaax_iova_table.c | 4 ++--
>  mk/arch/arm/rte.vars.mk                 | 2 +-
>  mk/arch/i686/rte.vars.mk                | 2 +-
>  3 files changed, 4 insertions(+), 4 deletions(-)
> 

If this patch is merged, please ignore [1]

[1] http://patches.dpdk.org/patch/53798/

Acked-by: Shreyansh Jain <Shreyansh.jain@nxp.com>
  
Ferruh Yigit June 4, 2019, 2:49 p.m. UTC | #2
On 5/28/2019 12:07 PM, Bruce Richardson wrote:
> By default on 32-bit systems, file offsets are given as 32-bit values
> which prevents support for large files. While this is unlikely to be
> a problem, enabling large file support globally makes "make" and
> "meson" builds consistent, since meson always enables large file
> support, and without this change, the size of "struct stat" fields
> will be different between the two builds.
> 
> The only location where this appears to be significant is in the
> dpaax common code, where a printf needs to be updated for 32-bit
> builds.
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> Acked-by: Luca Boccassi <bluca@debian.org>
> ---
>  drivers/common/dpaax/dpaax_iova_table.c | 4 ++--
>  mk/arch/arm/rte.vars.mk                 | 2 +-
>  mk/arch/i686/rte.vars.mk                | 2 +-
>  3 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/common/dpaax/dpaax_iova_table.c b/drivers/common/dpaax/dpaax_iova_table.c
> index 2dd38a9..ae0af09 100644
> --- a/drivers/common/dpaax/dpaax_iova_table.c
> +++ b/drivers/common/dpaax/dpaax_iova_table.c
> @@ -99,7 +99,7 @@ read_memory_node(unsigned int *count)
>  		goto cleanup;
>  	}
>  
> -	DPAAX_DEBUG("Size of device-tree mem node: %lu", statbuf.st_size);
> +	DPAAX_DEBUG("Size of device-tree mem node: %" PRIu64, statbuf.st_size);
>  	if (statbuf.st_size > MEM_NODE_FILE_LEN) {
>  		DPAAX_DEBUG("More memory nodes available than assumed.");
>  		DPAAX_DEBUG("System may not work properly!");
> @@ -118,7 +118,7 @@ read_memory_node(unsigned int *count)
>  	 */
>  	*count = (statbuf.st_size / 16);
>  	if ((*count) <= 0 || (statbuf.st_size % 16 != 0)) {
> -		DPAAX_DEBUG("Invalid memory node values or count. (size=%lu)",
> +		DPAAX_DEBUG("Invalid memory node values or count. (size=%" PRIu64 ")",
>  			    statbuf.st_size);
>  		goto cleanup;
>  	}
> diff --git a/mk/arch/arm/rte.vars.mk b/mk/arch/arm/rte.vars.mk
> index 27b1147..dc8c10a 100644
> --- a/mk/arch/arm/rte.vars.mk
> +++ b/mk/arch/arm/rte.vars.mk
> @@ -4,7 +4,7 @@
>  ARCH  ?= arm
>  CROSS ?=
>  
> -CPU_CFLAGS  ?= -marm -munaligned-access
> +CPU_CFLAGS  ?= -marm -munaligned-access -D_FILE_OFFSET_BITS=64
>  CPU_LDFLAGS ?=
>  CPU_ASFLAGS ?= -felf
>  
> diff --git a/mk/arch/i686/rte.vars.mk b/mk/arch/i686/rte.vars.mk
> index 3f48f67..c867883 100644
> --- a/mk/arch/i686/rte.vars.mk
> +++ b/mk/arch/i686/rte.vars.mk
> @@ -24,7 +24,7 @@ ARCH  ?= i386
>  ARCH_DIR := x86
>  CROSS ?=
>  
> -CPU_CFLAGS  ?= -m32
> +CPU_CFLAGS  ?= -m32 -D_FILE_OFFSET_BITS=64

Previously, 'off_t' was "long int" both for 32-bit or 64-bit, so in the printf
using "%ld" was OK.
But with this change 'off_t' becomes 'uint64_t' and just using '%ld' in the
format will cause error, as it is happening in 'mlx5' [1].

All 'off_t' usage should be checked for this change.


Shahaf, Yongseok,
Can you please send a fix for below build error?


Thanks,
ferruh



[1]
In file included from .../dpdk/i686-native-linuxapp-gcc/include/rte_compat.h:8,
                 from .../dpdk/i686-native-linuxapp-gcc/include/rte_mbuf.h:35,
                 from .../dpdk/drivers/net/mlx5/mlx5_txq.c:24:
.../dpdk/drivers/net/mlx5/mlx5_txq.c: In function ‘mlx5_txq_ibv_new’:
.../dpdk/drivers/net/mlx5/mlx5_defs.h:14:26: error: format ‘%lx’ expects
argument of type ‘long unsigned int’, but argument 5 has type ‘off_t’ {aka ‘long
long int’} [-Werror=format=]
   14 | #define MLX5_DRIVER_NAME "net_mlx5"
      |                          ^~~~~~~~~~
.../dpdk/i686-native-linuxapp-gcc/include/rte_common.h:642:27: note: in
definition of macro ‘RTE_FMT’
  642 | #define RTE_FMT(fmt, ...) fmt "%.0s", __VA_ARGS__ ""
      |                           ^~~
.../dpdk/drivers/net/mlx5/mlx5_utils.h:79:11: note: in expansion of macro
‘MLX5_DRIVER_NAME’
   79 |   RTE_FMT(MLX5_DRIVER_NAME ": " \
      |           ^~~~~~~~~~~~~~~~
.../dpdk/drivers/net/mlx5/mlx5_utils.h:101:2: note: in expansion of macro
‘PMD_DRV_LOG___’
  101 |  PMD_DRV_LOG___(level, __VA_ARGS__)
      |  ^~~~~~~~~~~~~~
.../dpdk/drivers/net/mlx5/mlx5_utils.h:103:2: note: in expansion of macro
‘PMD_DRV_LOG__’
  103 |  PMD_DRV_LOG__(level, s "\n", __VA_ARGS__)
      |  ^~~~~~~~~~~~~
.../dpdk/drivers/net/mlx5/mlx5_utils.h:109:2: note: in expansion of macro
‘PMD_DRV_LOG_’
  109 |  PMD_DRV_LOG_(level, \
      |  ^~~~~~~~~~~~
.../dpdk/drivers/net/mlx5/mlx5_txq.c:569:3: note: in expansion of macro ‘DRV_LOG’
  569 |   DRV_LOG(DEBUG, "port %u: uar_mmap_offset 0x%lx",
      |   ^~~~~~~
.../dpdk/drivers/net/mlx5/mlx5_txq.c:569:48: note: format string is defined here
  569 |   DRV_LOG(DEBUG, "port %u: uar_mmap_offset 0x%lx",
      |                                              ~~^
      |                                                |
      |                                                long unsigned int
      |                                              %llx
cc1: all warnings being treated as errors
  

Patch

diff --git a/drivers/common/dpaax/dpaax_iova_table.c b/drivers/common/dpaax/dpaax_iova_table.c
index 2dd38a9..ae0af09 100644
--- a/drivers/common/dpaax/dpaax_iova_table.c
+++ b/drivers/common/dpaax/dpaax_iova_table.c
@@ -99,7 +99,7 @@  read_memory_node(unsigned int *count)
 		goto cleanup;
 	}
 
-	DPAAX_DEBUG("Size of device-tree mem node: %lu", statbuf.st_size);
+	DPAAX_DEBUG("Size of device-tree mem node: %" PRIu64, statbuf.st_size);
 	if (statbuf.st_size > MEM_NODE_FILE_LEN) {
 		DPAAX_DEBUG("More memory nodes available than assumed.");
 		DPAAX_DEBUG("System may not work properly!");
@@ -118,7 +118,7 @@  read_memory_node(unsigned int *count)
 	 */
 	*count = (statbuf.st_size / 16);
 	if ((*count) <= 0 || (statbuf.st_size % 16 != 0)) {
-		DPAAX_DEBUG("Invalid memory node values or count. (size=%lu)",
+		DPAAX_DEBUG("Invalid memory node values or count. (size=%" PRIu64 ")",
 			    statbuf.st_size);
 		goto cleanup;
 	}
diff --git a/mk/arch/arm/rte.vars.mk b/mk/arch/arm/rte.vars.mk
index 27b1147..dc8c10a 100644
--- a/mk/arch/arm/rte.vars.mk
+++ b/mk/arch/arm/rte.vars.mk
@@ -4,7 +4,7 @@ 
 ARCH  ?= arm
 CROSS ?=
 
-CPU_CFLAGS  ?= -marm -munaligned-access
+CPU_CFLAGS  ?= -marm -munaligned-access -D_FILE_OFFSET_BITS=64
 CPU_LDFLAGS ?=
 CPU_ASFLAGS ?= -felf
 
diff --git a/mk/arch/i686/rte.vars.mk b/mk/arch/i686/rte.vars.mk
index 3f48f67..c867883 100644
--- a/mk/arch/i686/rte.vars.mk
+++ b/mk/arch/i686/rte.vars.mk
@@ -24,7 +24,7 @@  ARCH  ?= i386
 ARCH_DIR := x86
 CROSS ?=
 
-CPU_CFLAGS  ?= -m32
+CPU_CFLAGS  ?= -m32 -D_FILE_OFFSET_BITS=64
 CPU_LDFLAGS ?= -melf_i386
 CPU_ASFLAGS ?= -felf