[dpdk-dev] [PATCH v3 00/40] Fix build on gcc8 and various bugs

Andy Green andy at warmcat.com
Thu May 10 09:11:11 CEST 2018



On 05/10/2018 02:12 PM, Jerin Jacob wrote:
> -----Original Message-----
>> Date: Thu, 10 May 2018 10:46:18 +0800
>> From: Andy Green <andy at warmcat.com>
>> To: dev at dpdk.org
>> Subject: [dpdk-dev] [PATCH v3 00/40] Fix build on gcc8 and various bugs
>> User-Agent: StGit/unknown-version
>>
>> The following series gets current master able to build
>> itself, and allow lagopus to build against it, on Fedora 28 +
>> x86_64 using gcc 8.0.1.
>>
>> The first 17 patches have already been through two spins and
>> this time are corrected for all the comment (thanks to
>> everybody who commented) since v2, and have tested-by /
>> acked-bys applied.  The first workaround patch for the hash
>> function cast problem is dropped since something has already
>> been applied in master since yesterday to address it.
>>
>> The additional 23 patches are fixes for problems found
>> actually trying to build lagopus using current master.
>> These are almost entirely related to signed / unsigned
>> or truncation without explicit casts inside dpdk
>> headers.
> 
> 
> Tested this series on gcc version 8.1.0
> 
> Found following error:

On gcc 8.0.1 on Fedora 28, where this doesn't appear using x86_64 
defconfig.  This is with the basis the current master HEAD 
8ea41438832a360aed2b7ba49fb75e310a2ff1dc

I assume 8.1 just got better at spotting the problem.

> /export/dpdk.org/test/test/test_table_pipeline.c: In function
> ‘test_table_pipeline’:
> /export/dpdk.org/test/test/test_table_pipeline.c:521:3: error: cast
> between incompatible function types from ‘int (* (*)(struct rte_pipeline
> *, struct rte_mbuf **, uint64_t,  struct rte_pipeline_table_entry **,
> void *))(struct rte_pipeline *, struct rte_mbuf **, uint64_t,  struct
> rte_pipeline_table_entry *, void *)’ {aka ‘int (* (*)(struct
> rte_pipeline *, struct rte_mbuf **, long unsigned int,  struct
> rte_pipeline_table_entry **, void *))(struct rte_pipeline *, struct
> rte_mbuf **, long unsigned int,  struct rte_pipeline_table_entry *, void
> *)’} to ‘int (*)(struct rte_pipeline *, struct rte_mbuf **, uint64_t,
> struct rte_pipeline_table_entry *, void *)’ {aka ‘int (*)(struct
> rte_pipeline *, struct rte_mbuf **, long unsigned int,  struct
> rte_pipeline_table_entry *, void *)’} [-Werror=cast-function-type]
>     (rte_pipeline_table_action_handler_miss) table_action_stub_miss;
>     ^
> /export/dpdk.org/test/test/test_table_pipeline.c:557:3: error: cast
> between incompatible function types from ‘int (* (*)(struct rte_pipeline
> *, struct rte_mbuf **, uint64_t,  struct rte_pipeline_table_entry **,
> void *))(struct rte_pipeline *, struct rte_mbuf **, uint64_t,  struct
> rte_pipeline_table_entry *, void *)’ {aka ‘int (* (*)(struct
> rte_pipeline *, struct rte_mbuf **, long unsigned int,  struct
> rte_pipeline_table_entry **, void *))(struct rte_pipeline *, struct
> rte_mbuf **, long unsigned int,  struct rte_pipeline_table_entry *, void
> *)’} to ‘int (*)(struct rte_pipeline *, struct rte_mbuf **, uint64_t,
> struct rte_pipeline_table_entry *, void *)’ {aka ‘int (*)(struct
> rte_pipeline *, struct rte_mbuf **, long unsigned int,  struct
> rte_pipeline_table_entry *, void *)’} [-Werror=cast-function-type]
>     (rte_pipeline_table_action_handler_miss)table_action_stub_miss;

Hum...

That seems to be declared:

rte_pipeline_table_action_handler_miss action_handler_miss = NULL;

which is

typedef int (*rte_pipeline_table_action_handler_miss)(
         struct rte_pipeline *p,
         struct rte_mbuf **pkts,
         uint64_t pkts_mask,
         struct rte_pipeline_table_entry *entry,    <<<<=====
         void *arg);

We're doing

action_handler_miss =
    (rte_pipeline_table_action_handler_miss)table_action_stub_miss;

The prototype for that is

rte_pipeline_table_action_handler_miss
table_action_stub_miss(struct rte_pipeline *p,
			struct rte_mbuf **pkts,
			uint64_t pkts_mask,
			struct rte_pipeline_table_entry **entry,  <<====
			void *arg);

It's true, the fourth arg has a different level of indirection... it 
seems another real pre-existing problem.

However the stub doesn't use the fourth arg "entry"

rte_pipeline_table_action_handler_miss
table_action_stub_miss(struct rte_pipeline *p,
         __attribute__((unused)) struct rte_mbuf **pkts,
         uint64_t pkts_mask,
         __attribute__((unused)) struct rte_pipeline_table_entry **entry,
         __attribute__((unused)) void *arg)
{
         printf("STUB Table Action Miss - setting mask to 0x%"PRIx64"\n",
                 override_miss_mask);
         pkts_mask = (~override_miss_mask) & 0x3;
         rte_pipeline_ah_packet_drop(p, pkts_mask);
         return 0;
}

Therefore, since I can't get the error here, can you check if this 
solves it?

diff --git a/test/test/test_table_pipeline.c 
b/test/test/test_table_pipeline.c
index 055a1a4e7..d007d55ce 100644
--- a/test/test/test_table_pipeline.c
+++ b/test/test/test_table_pipeline.c
@@ -71,7 +71,7 @@ table_action_stub_hit(struct rte_pipeline *p, struct 
rte_mbuf **pkts,

  rte_pipeline_table_action_handler_miss
  table_action_stub_miss(struct rte_pipeline *p, struct rte_mbuf **pkts,
-       uint64_t pkts_mask, struct rte_pipeline_table_entry **entry, 
void *arg);
+       uint64_t pkts_mask, struct rte_pipeline_table_entry *entry, void 
*arg);

  rte_pipeline_table_action_handler_hit
  table_action_0x00(__attribute__((unused)) struct rte_pipeline *p,
@@ -105,7 +105,7 @@ rte_pipeline_table_action_handler_miss
  table_action_stub_miss(struct rte_pipeline *p,
         __attribute__((unused)) struct rte_mbuf **pkts,
         uint64_t pkts_mask,
-       __attribute__((unused)) struct rte_pipeline_table_entry **entry,
+       __attribute__((unused)) struct rte_pipeline_table_entry *entry,
         __attribute__((unused)) void *arg)
  {
         printf("STUB Table Action Miss - setting mask to 0x%"PRIx64"\n",


At least I confirmed it still builds without error on 8.0.1 with my 
series and that patch.

-Andy

> 
> ➜ [master][dpdk.org] $ gcc -v
> Using built-in specs.
> COLLECT_GCC=/usr/bin/gcc
> COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/8.1.0/lto-wrapper
> Target: x86_64-pc-linux-gnu
> Configured with: /build/gcc/src/gcc/configure --prefix=/usr
> --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man
> --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/
> --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared
> --enable-threads=posix --enable-libmpx --with-system-zlib --with-isl
> --enable-__cxa_atexit --disable-libunwind-exceptions
> --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp
> --enable-gnu-unique-object --enable-linker-build-id --enable-lto
> --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu
> --enable-gnu-indirect-function --enable-multilib --disable-werror
> --enable-checking=release --enable-default-pie --enable-default-ssp
> Thread model: posix
> gcc version 8.1.0 (GCC)
> 
> 
>>
>> ---
>>
>> Andy Green (40):
>>        drivers/bus/pci: fix strncpy dangerous code
>>        drivers/bus/dpaa: fix inconsistent struct alignment
>>        drivers/net/axgbe: fix broken eeprom string comp
>>        drivers/net/nfp/nfpcore: fix strncpy misuse
>>        drivers/net/nfp/nfpcore: fix off-by-one and no NUL on strncpy use
>>        drivers/net/nfp: don't memcpy out of source range
>>        drivers/net/nfp: fix buffer overflow in fw_name
>>        drivers/net/qede: fix strncpy constant and NUL
>>        drivers/net/qede: fix broken strncpy
>>        drivers/net/sfc: fix strncpy length
>>        drivers/net/sfc: fix strncpy size and NUL
>>        drivers/net/vdev: readlink inputs cannot be aliased
>>        drivers/net/vdev: fix 3 x strncpy misuse
>>        app/test-pmd: can't find include
>>        app/proc-info: fix sprintf overrun bug
>>        app/test-bbdev: test-bbdev: strcpy ok for allocated string
>>        app/test-bbdev: strcpy ok for allocated string
>>        rte_common.h: cast gcc builtin result to avoid complaints
>>        rte_memcpy.h: explicit tmp cast
>>        lib/librte_eal/common/include/rte_lcore.h: explicit cast for signed change
>>        /lib/librte_eal/common/include/rte_random.h: stage cast from uint64_t to long
>>        rte_spinlock.h: stack declarations before code
>>        rte_ring_generic.h: stack declarations before code
>>        rte_ring.h: remove signed type flipflopping
>>        rte_dev.h: stack declaration at top of own basic block
>>        rte_mbuf.h: avoid truncation warnings from inadvertant int16_t to int promotion
>>        rte_mbuf.h: explicit casts for flipping between int16_t and uint16_t
>>        rte_mbuf.h: make sure RTE_MIN compares same types
>>        rte_mbuf.h: explicit cast restricting ptrdiff to uint16_t
>>        rte_mbuf.h: explicit cast for size_t to uint32_t
>>        rte_mbuf.h: explicit casts to uint16_t to avoid truncation warnings
>>        rte_byteorder.h: explicit cast for return promotion
>>        rte_ether.h: explicit cast avoiding truncation warning
>>        rte_ether.h: stack vars declared at top of function
>>        rte_ethdev.h: fix sign and scope of temp var
>>        rte_ethdev.h: explicit cast for return type
>>        rte_ethdev.h: explicit cast for truncation
>>        rte_hash_crc.h: stack vars declared at top of function
>>        rte_hash_crc.h: explicit casts for truncation
>>        rte_string_fns.h: explicit cast for int return to size_t
>>
>>
>>   app/proc-info/main.c                               |    9 ++++-
>>   app/test-bbdev/test_bbdev_vector.c                 |    5 ++-
>>   app/test-pmd/Makefile                              |    1 +
>>   drivers/bus/dpaa/base/qbman/qman.c                 |   14 ++++----
>>   drivers/bus/dpaa/include/fsl_qman.h                |   24 +++++++------
>>   drivers/bus/pci/linux/pci.c                        |    2 +
>>   drivers/net/axgbe/axgbe_phy_impl.c                 |    4 +-
>>   drivers/net/nfp/nfp_net.c                          |    6 ++-
>>   drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c         |    4 ++
>>   drivers/net/nfp/nfpcore/nfp_resource.c             |   10 +++---
>>   drivers/net/qede/base/ecore_int.c                  |    8 +++-
>>   drivers/net/qede/qede_main.c                       |    7 ++--
>>   drivers/net/sfc/sfc_ethdev.c                       |    6 ++-
>>   drivers/net/vdev_netvsc/vdev_netvsc.c              |   15 +++++---
>>   .../common/include/arch/x86/rte_memcpy.h           |    8 ++--
>>   .../common/include/arch/x86/rte_spinlock.h         |    4 ++
>>   .../common/include/generic/rte_byteorder.h         |    2 +
>>   lib/librte_eal/common/include/rte_common.h         |    2 +
>>   lib/librte_eal/common/include/rte_dev.h            |   15 +++++---
>>   lib/librte_eal/common/include/rte_lcore.h          |    2 +
>>   lib/librte_eal/common/include/rte_random.h         |    6 ++-
>>   lib/librte_eal/common/include/rte_string_fns.h     |    2 +
>>   lib/librte_ethdev/rte_ethdev.h                     |   32 +++++++++++-------
>>   lib/librte_hash/rte_hash_crc.h                     |   11 +++---
>>   lib/librte_mbuf/rte_mbuf.h                         |   36 +++++++++++---------
>>   lib/librte_net/rte_ether.h                         |    5 ++-
>>   lib/librte_ring/rte_ring.h                         |    4 +-
>>   lib/librte_ring/rte_ring_c11_mem.h                 |    2 +
>>   lib/librte_ring/rte_ring_generic.h                 |   10 ++----
>>   29 files changed, 144 insertions(+), 112 deletions(-)
>>
>> --
>> Signature


More information about the dev mailing list