patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] net/i40e: fix gcc 11 build warning on POWER architecture
@ 2021-10-14 19:05 David Christensen
  2021-11-05  0:50 ` [dpdk-stable] [dpdk-dev] " Zhang, Qi Z
  0 siblings, 1 reply; 3+ messages in thread
From: David Christensen @ 2021-10-14 19:05 UTC (permalink / raw)
  To: dev, beilei.xing; +Cc: stable, David Christensen

Building DPDK with a gcc 11 based compiler such as the IBM Advanced
Toolchain 15 (1) generates a stringop-overflow warning when using -O3
optimization (DPDK default for production releases):

writing 1 byte into a region of size 0 [-Wstringop-overflow=]

The issue has been reported to the gcc project (2) but can be resolved
by preventing the compiler from unrolling the loop as part of the -O3
optimization.

(1) https://www.ibm.com/support/pages/advance-toolchain-linux-power
(2) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102316

Bugzilla ID: 743

Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
---
 drivers/net/i40e/i40e_flow.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c
index e41a84f1d7..17ab7ad9b9 100644
--- a/drivers/net/i40e/i40e_flow.c
+++ b/drivers/net/i40e/i40e_flow.c
@@ -3047,6 +3047,10 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,
 				return -rte_errno;
 			}
 
+#if defined(RTE_ARCH_PPC_64) && defined(RTE_TOOLCHAIN_GCC) && \
+(GCC_VERSION >= 110000)
+#pragma GCC unroll 1
+#endif
 			for (i = 0; i < raw_spec->length; i++) {
 				j = i + next_dst_off;
 				filter->input.flow_ext.flexbytes[j] =
-- 
2.27.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH] net/i40e: fix gcc 11 build warning on POWER architecture
  2021-10-14 19:05 [dpdk-stable] [PATCH] net/i40e: fix gcc 11 build warning on POWER architecture David Christensen
@ 2021-11-05  0:50 ` Zhang, Qi Z
  2021-11-09 22:46   ` David Christensen
  0 siblings, 1 reply; 3+ messages in thread
From: Zhang, Qi Z @ 2021-11-05  0:50 UTC (permalink / raw)
  To: David Christensen, dev, Xing, Beilei; +Cc: stable, Yigit, Ferruh

Hi David:

	Not sure if below patch also help to solve the issue you met on power arch,
	Looks like the error is same: "writing 1 byte into a region of size 0"
	would you help to check?

commit 1b0f3a18145468c309bb5a8cb98a8aa29af059e7
Author: Ferruh Yigit <ferruh.yigit@intel.com>
Date:   Fri Oct 29 11:37:01 2021 +0100

    net/i40e: fix build for 32-bit

    Got error with: gcc 11.2.1 "cc (GCC) 11.2.1 20210728 (Red Hat 11.2.1-1)"

    Build error:
    In function 'i40e_flow_parse_fdir_pattern',
        inlined from 'i40e_flow_parse_fdir_filter'
        at ../drivers/net/i40e/i40e_flow.c:3274:8:
    ../drivers/net/i40e/i40e_flow.c:3052:69:
        error: writing 1 byte into a region of size 0
        [-Werror=stringop-overflow=]
     3052 |                         filter->input.flow_ext.flexbytes[j] =
          |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
     3053 |                                 raw_spec->pattern[i];
          |                                 ~~~~~~~~~~~~~~~~~~~~
    In file included from ../drivers/net/i40e/i40e_flow.c:25:
      ../drivers/net/i40e/i40e_flow.c:
      In function 'i40e_flow_parse_fdir_filter':
      ../drivers/net/i40e/i40e_ethdev.h:638:17:
      note: at offset 16 into destination object 'flexbytes' of size 16
      638 |         uint8_t flexbytes[RTE_ETH_FDIR_MAX_FLEXLEN];
          |                 ^~~~~~~~~

    Fixing by adding range checks.

    Fixes: 6ced3dd72f5f ("net/i40e: support flexible payload parsing for FDIR")
    Cc: stable@dpdk.org

Thanks
Qi
	 

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of David Christensen
> Sent: Friday, October 15, 2021 3:05 AM
> To: dev@dpdk.org; Xing, Beilei <beilei.xing@intel.com>
> Cc: stable@dpdk.org; David Christensen <drc@linux.vnet.ibm.com>
> Subject: [dpdk-dev] [PATCH] net/i40e: fix gcc 11 build warning on POWER
> architecture
> 
> Building DPDK with a gcc 11 based compiler such as the IBM Advanced
> Toolchain 15 (1) generates a stringop-overflow warning when using -O3
> optimization (DPDK default for production releases):
> 
> writing 1 byte into a region of size 0 [-Wstringop-overflow=]
> 
> The issue has been reported to the gcc project (2) but can be resolved by
> preventing the compiler from unrolling the loop as part of the -O3
> optimization.
> 
> (1) https://www.ibm.com/support/pages/advance-toolchain-linux-power
> (2) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102316
> 
> Bugzilla ID: 743
> 
> Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
> ---
>  drivers/net/i40e/i40e_flow.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c index
> e41a84f1d7..17ab7ad9b9 100644
> --- a/drivers/net/i40e/i40e_flow.c
> +++ b/drivers/net/i40e/i40e_flow.c
> @@ -3047,6 +3047,10 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev
> *dev,
>  				return -rte_errno;
>  			}
> 
> +#if defined(RTE_ARCH_PPC_64) && defined(RTE_TOOLCHAIN_GCC) && \
> +(GCC_VERSION >= 110000) #pragma GCC unroll 1 #endif
>  			for (i = 0; i < raw_spec->length; i++) {
>  				j = i + next_dst_off;
>  				filter->input.flow_ext.flexbytes[j] =
> --
> 2.27.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH] net/i40e: fix gcc 11 build warning on POWER architecture
  2021-11-05  0:50 ` [dpdk-stable] [dpdk-dev] " Zhang, Qi Z
@ 2021-11-09 22:46   ` David Christensen
  0 siblings, 0 replies; 3+ messages in thread
From: David Christensen @ 2021-11-09 22:46 UTC (permalink / raw)
  To: Zhang, Qi Z, dev, Xing, Beilei; +Cc: stable, Yigit, Ferruh

> 	Not sure if below patch also help to solve the issue you met on power arch,
> 	Looks like the error is same: "writing 1 byte into a region of size 0"
> 	would you help to check?
> 
> commit 1b0f3a18145468c309bb5a8cb98a8aa29af059e7
> Author: Ferruh Yigit <ferruh.yigit@intel.com>
> Date:   Fri Oct 29 11:37:01 2021 +0100
> 
>      net/i40e: fix build for 32-bit
> 
>      Got error with: gcc 11.2.1 "cc (GCC) 11.2.1 20210728 (Red Hat 11.2.1-1)"
> 
>      Build error:
>      In function 'i40e_flow_parse_fdir_pattern',
>          inlined from 'i40e_flow_parse_fdir_filter'
>          at ../drivers/net/i40e/i40e_flow.c:3274:8:
>      ../drivers/net/i40e/i40e_flow.c:3052:69:
>          error: writing 1 byte into a region of size 0
>          [-Werror=stringop-overflow=]
>       3052 |                         filter->input.flow_ext.flexbytes[j] =
>            |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
>       3053 |                                 raw_spec->pattern[i];
>            |                                 ~~~~~~~~~~~~~~~~~~~~
>      In file included from ../drivers/net/i40e/i40e_flow.c:25:
>        ../drivers/net/i40e/i40e_flow.c:
>        In function 'i40e_flow_parse_fdir_filter':
>        ../drivers/net/i40e/i40e_ethdev.h:638:17:
>        note: at offset 16 into destination object 'flexbytes' of size 16
>        638 |         uint8_t flexbytes[RTE_ETH_FDIR_MAX_FLEXLEN];
>            |                 ^~~~~~~~~
> 
>      Fixing by adding range checks.
> 
>      Fixes: 6ced3dd72f5f ("net/i40e: support flexible payload parsing for FDIR")
>      Cc: stable@dpdk.org

Yep, definitely fixed it for POWER as well with the latest GCC compiler 
(Advanced Toolchain 15.0 in my case).  I'll withdraw by other patch. 
Thanks for the heads up.

Dave

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-11-09 22:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-14 19:05 [dpdk-stable] [PATCH] net/i40e: fix gcc 11 build warning on POWER architecture David Christensen
2021-11-05  0:50 ` [dpdk-stable] [dpdk-dev] " Zhang, Qi Z
2021-11-09 22:46   ` David Christensen

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