DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] pdump: fix build issue with GCC 12
@ 2023-03-27  7:07 Joyce Kong
  2023-03-27 14:19 ` Pattan, Reshma
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Joyce Kong @ 2023-03-27  7:07 UTC (permalink / raw)
  To: reshma.pattan, stephen, konstantin.v.ananyev
  Cc: dev, nd, Joyce Kong, stable, Ruifeng Wang

The following warning is observed with GCC12 compilation
with release 20.11:

In function ‘__rte_ring_enqueue_elems_64’,
    inlined from ‘__rte_ring_enqueue_elems’ at
            ../lib/librte_ring/rte_ring_elem.h:225:3,
    inlined from ‘__rte_ring_do_enqueue_elem’ at
            ../lib/librte_ring/rte_ring_elem.h:424:2,
    inlined from ‘rte_ring_mp_enqueue_burst_elem’ at
            ../lib/librte_ring/rte_ring_elem.h:884:9,
    inlined from ‘rte_ring_enqueue_burst_elem’ at
            ../lib/librte_ring/rte_ring_elem.h:946:10,
    inlined from ‘rte_ring_enqueue_burst’ at
            ../lib/librte_ring/rte_ring.h:721:9,
    inlined from ‘pdump_copy’ at
            ../lib/librte_pdump/rte_pdump.c:94:13:
../lib/librte_ring/rte_ring_elem.h:162:40: warning: ‘*dup_bufs.36_42
+ _89’ may be used uninitialized [-Wmaybe-uninitialized]
  162 |                         ring[idx] = obj[i];
      |                                     ~~~^~~
../lib/librte_ring/rte_ring_elem.h:163:44: warning: ‘*dup_bufs.36_42
+ _98’ may be used uninitialized [-Wmaybe-uninitialized]
  163 |                         ring[idx + 1] = obj[i + 1];
      |                                         ~~~^~~~~~~
../lib/librte_ring/rte_ring_elem.h:164:44: warning: ‘*dup_bufs.36_42
+ _107’ may be used uninitialized [-Wmaybe-uninitialized]
  164 |                         ring[idx + 2] = obj[i + 2];
      |                                         ~~~^~~~~~~
../lib/librte_ring/rte_ring_elem.h:165:44: warning: ‘*dup_bufs.36_42
+ _116’ may be used uninitialized [-Wmaybe-uninitialized]
  165 |                         ring[idx + 3] = obj[i + 3];
      |                                         ~~~^~~~~~~
../lib/librte_ring/rte_ring_elem.h:169:42: warning: ‘*dup_bufs.36_42
+ _129’ may be used uninitialized [-Wmaybe-uninitialized]
  169 |                         ring[idx++] = obj[i++]; /* fallthrough */
      |                                       ~~~^~~~~
../lib/librte_ring/rte_ring_elem.h:171:42: warning: ‘*dup_bufs.36_42
+ _139’ may be used uninitialized [-Wmaybe-uninitialized]
  171 |                         ring[idx++] = obj[i++]; /* fallthrough */
      |                                       ~~~^~~~~
../lib/librte_ring/rte_ring_elem.h:173:42: warning: ‘*dup_bufs.36_42
+ _149’ may be used uninitialized [-Wmaybe-uninitialized]
  173 |                         ring[idx++] = obj[i++];

Actually, this is an alias warning as -O3 enables strict alias.
This patch fixes it by replacing 'dup_bufs' with '&dup_bufs[0]'
as the compiler represents them differently.

Fixes: 278f945402c5 ("pdump: add new library for packet capture")
Cc: stable@dpdk.org

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 lib/pdump/rte_pdump.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/pdump/rte_pdump.c b/lib/pdump/rte_pdump.c
index 9bc4bab4f2..53cca1034d 100644
--- a/lib/pdump/rte_pdump.c
+++ b/lib/pdump/rte_pdump.c
@@ -134,7 +134,7 @@ pdump_copy(uint16_t port_id, uint16_t queue,
 
 	__atomic_fetch_add(&stats->accepted, d_pkts, __ATOMIC_RELAXED);
 
-	ring_enq = rte_ring_enqueue_burst(ring, (void *)dup_bufs, d_pkts, NULL);
+	ring_enq = rte_ring_enqueue_burst(ring, (void *)&dup_bufs[0], d_pkts, NULL);
 	if (unlikely(ring_enq < d_pkts)) {
 		unsigned int drops = d_pkts - ring_enq;
 
-- 
2.25.1


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

* RE: [PATCH] pdump: fix build issue with GCC 12
  2023-03-27  7:07 [PATCH] pdump: fix build issue with GCC 12 Joyce Kong
@ 2023-03-27 14:19 ` Pattan, Reshma
  2023-03-27 14:34 ` Tyler Retzlaff
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Pattan, Reshma @ 2023-03-27 14:19 UTC (permalink / raw)
  To: Joyce Kong, stephen, konstantin.v.ananyev; +Cc: dev, nd, stable, Ruifeng Wang



> -----Original Message-----
> From: Joyce Kong <joyce.kong@arm.com>
> Signed-off-by: Joyce Kong <joyce.kong@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>

Acked-by: Reshma Pattan <reshma.pattan@intel.com>



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

* Re: [PATCH] pdump: fix build issue with GCC 12
  2023-03-27  7:07 [PATCH] pdump: fix build issue with GCC 12 Joyce Kong
  2023-03-27 14:19 ` Pattan, Reshma
@ 2023-03-27 14:34 ` Tyler Retzlaff
  2023-03-28  6:27   ` Joyce Kong
  2023-03-28 16:25 ` Thomas Monjalon
  2023-03-28 19:25 ` Stephen Hemminger
  3 siblings, 1 reply; 6+ messages in thread
From: Tyler Retzlaff @ 2023-03-27 14:34 UTC (permalink / raw)
  To: Joyce Kong
  Cc: reshma.pattan, stephen, konstantin.v.ananyev, dev, nd, stable,
	Ruifeng Wang

On Mon, Mar 27, 2023 at 07:07:12AM +0000, Joyce Kong wrote:
> The following warning is observed with GCC12 compilation
> with release 20.11:
> 
> In function ‘__rte_ring_enqueue_elems_64’,
>     inlined from ‘__rte_ring_enqueue_elems’ at
>             ../lib/librte_ring/rte_ring_elem.h:225:3,
>     inlined from ‘__rte_ring_do_enqueue_elem’ at
>             ../lib/librte_ring/rte_ring_elem.h:424:2,
>     inlined from ‘rte_ring_mp_enqueue_burst_elem’ at
>             ../lib/librte_ring/rte_ring_elem.h:884:9,
>     inlined from ‘rte_ring_enqueue_burst_elem’ at
>             ../lib/librte_ring/rte_ring_elem.h:946:10,
>     inlined from ‘rte_ring_enqueue_burst’ at
>             ../lib/librte_ring/rte_ring.h:721:9,
>     inlined from ‘pdump_copy’ at
>             ../lib/librte_pdump/rte_pdump.c:94:13:
> ../lib/librte_ring/rte_ring_elem.h:162:40: warning: ‘*dup_bufs.36_42
> + _89’ may be used uninitialized [-Wmaybe-uninitialized]
>   162 |                         ring[idx] = obj[i];
>       |                                     ~~~^~~
> ../lib/librte_ring/rte_ring_elem.h:163:44: warning: ‘*dup_bufs.36_42
> + _98’ may be used uninitialized [-Wmaybe-uninitialized]
>   163 |                         ring[idx + 1] = obj[i + 1];
>       |                                         ~~~^~~~~~~
> ../lib/librte_ring/rte_ring_elem.h:164:44: warning: ‘*dup_bufs.36_42
> + _107’ may be used uninitialized [-Wmaybe-uninitialized]
>   164 |                         ring[idx + 2] = obj[i + 2];
>       |                                         ~~~^~~~~~~
> ../lib/librte_ring/rte_ring_elem.h:165:44: warning: ‘*dup_bufs.36_42
> + _116’ may be used uninitialized [-Wmaybe-uninitialized]
>   165 |                         ring[idx + 3] = obj[i + 3];
>       |                                         ~~~^~~~~~~
> ../lib/librte_ring/rte_ring_elem.h:169:42: warning: ‘*dup_bufs.36_42
> + _129’ may be used uninitialized [-Wmaybe-uninitialized]
>   169 |                         ring[idx++] = obj[i++]; /* fallthrough */
>       |                                       ~~~^~~~~
> ../lib/librte_ring/rte_ring_elem.h:171:42: warning: ‘*dup_bufs.36_42
> + _139’ may be used uninitialized [-Wmaybe-uninitialized]
>   171 |                         ring[idx++] = obj[i++]; /* fallthrough */
>       |                                       ~~~^~~~~
> ../lib/librte_ring/rte_ring_elem.h:173:42: warning: ‘*dup_bufs.36_42
> + _149’ may be used uninitialized [-Wmaybe-uninitialized]
>   173 |                         ring[idx++] = obj[i++];
> 
> Actually, this is an alias warning as -O3 enables strict alias.
> This patch fixes it by replacing 'dup_bufs' with '&dup_bufs[0]'
> as the compiler represents them differently.
> 
> Fixes: 278f945402c5 ("pdump: add new library for packet capture")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Joyce Kong <joyce.kong@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> ---

Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>

>  lib/pdump/rte_pdump.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/pdump/rte_pdump.c b/lib/pdump/rte_pdump.c
> index 9bc4bab4f2..53cca1034d 100644
> --- a/lib/pdump/rte_pdump.c
> +++ b/lib/pdump/rte_pdump.c
> @@ -134,7 +134,7 @@ pdump_copy(uint16_t port_id, uint16_t queue,
>  
>  	__atomic_fetch_add(&stats->accepted, d_pkts, __ATOMIC_RELAXED);
>  
> -	ring_enq = rte_ring_enqueue_burst(ring, (void *)dup_bufs, d_pkts, NULL);
> +	ring_enq = rte_ring_enqueue_burst(ring, (void *)&dup_bufs[0], d_pkts, NULL);

nit: i would drop the cast to void *, it shouldn't be needed?

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

* RE: [PATCH] pdump: fix build issue with GCC 12
  2023-03-27 14:34 ` Tyler Retzlaff
@ 2023-03-28  6:27   ` Joyce Kong
  0 siblings, 0 replies; 6+ messages in thread
From: Joyce Kong @ 2023-03-28  6:27 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: reshma.pattan, stephen, konstantin.v.ananyev, dev, nd, stable,
	Ruifeng Wang

> -----Original Message-----
> From: Tyler Retzlaff <roretzla@linux.microsoft.com>
> Sent: Monday, March 27, 2023 10:35 PM
> To: Joyce Kong <Joyce.Kong@arm.com>
> Cc: reshma.pattan@intel.com; stephen@networkplumber.org;
> konstantin.v.ananyev@yandex.ru; dev@dpdk.org; nd <nd@arm.com>;
> stable@dpdk.org; Ruifeng Wang <Ruifeng.Wang@arm.com>
> Subject: Re: [PATCH] pdump: fix build issue with GCC 12
> 
> On Mon, Mar 27, 2023 at 07:07:12AM +0000, Joyce Kong wrote:
> > The following warning is observed with GCC12 compilation with release
> > 20.11:
> >
> > In function ‘__rte_ring_enqueue_elems_64’,
> >     inlined from ‘__rte_ring_enqueue_elems’ at
> >             ../lib/librte_ring/rte_ring_elem.h:225:3,
> >     inlined from ‘__rte_ring_do_enqueue_elem’ at
> >             ../lib/librte_ring/rte_ring_elem.h:424:2,
> >     inlined from ‘rte_ring_mp_enqueue_burst_elem’ at
> >             ../lib/librte_ring/rte_ring_elem.h:884:9,
> >     inlined from ‘rte_ring_enqueue_burst_elem’ at
> >             ../lib/librte_ring/rte_ring_elem.h:946:10,
> >     inlined from ‘rte_ring_enqueue_burst’ at
> >             ../lib/librte_ring/rte_ring.h:721:9,
> >     inlined from ‘pdump_copy’ at
> >             ../lib/librte_pdump/rte_pdump.c:94:13:
> > ../lib/librte_ring/rte_ring_elem.h:162:40: warning: ‘*dup_bufs.36_42
> > + _89’ may be used uninitialized [-Wmaybe-uninitialized]
> >   162 |                         ring[idx] = obj[i];
> >       |                                     ~~~^~~
> > ../lib/librte_ring/rte_ring_elem.h:163:44: warning: ‘*dup_bufs.36_42
> > + _98’ may be used uninitialized [-Wmaybe-uninitialized]
> >   163 |                         ring[idx + 1] = obj[i + 1];
> >       |                                         ~~~^~~~~~~
> > ../lib/librte_ring/rte_ring_elem.h:164:44: warning: ‘*dup_bufs.36_42
> > + _107’ may be used uninitialized [-Wmaybe-uninitialized]
> >   164 |                         ring[idx + 2] = obj[i + 2];
> >       |                                         ~~~^~~~~~~
> > ../lib/librte_ring/rte_ring_elem.h:165:44: warning: ‘*dup_bufs.36_42
> > + _116’ may be used uninitialized [-Wmaybe-uninitialized]
> >   165 |                         ring[idx + 3] = obj[i + 3];
> >       |                                         ~~~^~~~~~~
> > ../lib/librte_ring/rte_ring_elem.h:169:42: warning: ‘*dup_bufs.36_42
> > + _129’ may be used uninitialized [-Wmaybe-uninitialized]
> >   169 |                         ring[idx++] = obj[i++]; /* fallthrough */
> >       |                                       ~~~^~~~~
> > ../lib/librte_ring/rte_ring_elem.h:171:42: warning: ‘*dup_bufs.36_42
> > + _139’ may be used uninitialized [-Wmaybe-uninitialized]
> >   171 |                         ring[idx++] = obj[i++]; /* fallthrough */
> >       |                                       ~~~^~~~~
> > ../lib/librte_ring/rte_ring_elem.h:173:42: warning: ‘*dup_bufs.36_42
> > + _149’ may be used uninitialized [-Wmaybe-uninitialized]
> >   173 |                         ring[idx++] = obj[i++];
> >
> > Actually, this is an alias warning as -O3 enables strict alias.
> > This patch fixes it by replacing 'dup_bufs' with '&dup_bufs[0]'
> > as the compiler represents them differently.
> >
> > Fixes: 278f945402c5 ("pdump: add new library for packet capture")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Joyce Kong <joyce.kong@arm.com>
> > Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> > ---
> 
> Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> 
> >  lib/pdump/rte_pdump.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/lib/pdump/rte_pdump.c b/lib/pdump/rte_pdump.c index
> > 9bc4bab4f2..53cca1034d 100644
> > --- a/lib/pdump/rte_pdump.c
> > +++ b/lib/pdump/rte_pdump.c
> > @@ -134,7 +134,7 @@ pdump_copy(uint16_t port_id, uint16_t queue,
> >
> >  	__atomic_fetch_add(&stats->accepted, d_pkts, __ATOMIC_RELAXED);
> >
> > -	ring_enq = rte_ring_enqueue_burst(ring, (void *)dup_bufs, d_pkts,
> NULL);
> > +	ring_enq = rte_ring_enqueue_burst(ring, (void *)&dup_bufs[0],
> > +d_pkts, NULL);
> 
> nit: i would drop the cast to void *, it shouldn't be needed?

Removing 'void *' here would generate a warning from incompatible pointer type, 
as rte_ring_enqueue_burst(struct rte_ring *r, void * const *obj_table, ...) expected 
'void * const *', but argument of &dup_bufs[0] is of type 'struct rte_mbuf **'. 

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

* Re: [PATCH] pdump: fix build issue with GCC 12
  2023-03-27  7:07 [PATCH] pdump: fix build issue with GCC 12 Joyce Kong
  2023-03-27 14:19 ` Pattan, Reshma
  2023-03-27 14:34 ` Tyler Retzlaff
@ 2023-03-28 16:25 ` Thomas Monjalon
  2023-03-28 19:25 ` Stephen Hemminger
  3 siblings, 0 replies; 6+ messages in thread
From: Thomas Monjalon @ 2023-03-28 16:25 UTC (permalink / raw)
  To: Joyce Kong
  Cc: reshma.pattan, stephen, konstantin.v.ananyev, dev, nd, stable,
	Ruifeng Wang

27/03/2023 09:07, Joyce Kong:
> The following warning is observed with GCC12 compilation
> with release 20.11:
> 
> In function ‘__rte_ring_enqueue_elems_64’,
>     inlined from ‘__rte_ring_enqueue_elems’ at
>             ../lib/librte_ring/rte_ring_elem.h:225:3,
>     inlined from ‘__rte_ring_do_enqueue_elem’ at
>             ../lib/librte_ring/rte_ring_elem.h:424:2,
>     inlined from ‘rte_ring_mp_enqueue_burst_elem’ at
>             ../lib/librte_ring/rte_ring_elem.h:884:9,
>     inlined from ‘rte_ring_enqueue_burst_elem’ at
>             ../lib/librte_ring/rte_ring_elem.h:946:10,
>     inlined from ‘rte_ring_enqueue_burst’ at
>             ../lib/librte_ring/rte_ring.h:721:9,
>     inlined from ‘pdump_copy’ at
>             ../lib/librte_pdump/rte_pdump.c:94:13:
> ../lib/librte_ring/rte_ring_elem.h:162:40: warning: ‘*dup_bufs.36_42
> + _89’ may be used uninitialized [-Wmaybe-uninitialized]
>   162 |                         ring[idx] = obj[i];
>       |                                     ~~~^~~
> ../lib/librte_ring/rte_ring_elem.h:163:44: warning: ‘*dup_bufs.36_42
> + _98’ may be used uninitialized [-Wmaybe-uninitialized]
>   163 |                         ring[idx + 1] = obj[i + 1];
>       |                                         ~~~^~~~~~~
> ../lib/librte_ring/rte_ring_elem.h:164:44: warning: ‘*dup_bufs.36_42
> + _107’ may be used uninitialized [-Wmaybe-uninitialized]
>   164 |                         ring[idx + 2] = obj[i + 2];
>       |                                         ~~~^~~~~~~
> ../lib/librte_ring/rte_ring_elem.h:165:44: warning: ‘*dup_bufs.36_42
> + _116’ may be used uninitialized [-Wmaybe-uninitialized]
>   165 |                         ring[idx + 3] = obj[i + 3];
>       |                                         ~~~^~~~~~~
> ../lib/librte_ring/rte_ring_elem.h:169:42: warning: ‘*dup_bufs.36_42
> + _129’ may be used uninitialized [-Wmaybe-uninitialized]
>   169 |                         ring[idx++] = obj[i++]; /* fallthrough */
>       |                                       ~~~^~~~~
> ../lib/librte_ring/rte_ring_elem.h:171:42: warning: ‘*dup_bufs.36_42
> + _139’ may be used uninitialized [-Wmaybe-uninitialized]
>   171 |                         ring[idx++] = obj[i++]; /* fallthrough */
>       |                                       ~~~^~~~~
> ../lib/librte_ring/rte_ring_elem.h:173:42: warning: ‘*dup_bufs.36_42
> + _149’ may be used uninitialized [-Wmaybe-uninitialized]
>   173 |                         ring[idx++] = obj[i++];
> 
> Actually, this is an alias warning as -O3 enables strict alias.
> This patch fixes it by replacing 'dup_bufs' with '&dup_bufs[0]'
> as the compiler represents them differently.
> 
> Fixes: 278f945402c5 ("pdump: add new library for packet capture")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Joyce Kong <joyce.kong@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>

Acked-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>

Applied, thanks.



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

* Re: [PATCH] pdump: fix build issue with GCC 12
  2023-03-27  7:07 [PATCH] pdump: fix build issue with GCC 12 Joyce Kong
                   ` (2 preceding siblings ...)
  2023-03-28 16:25 ` Thomas Monjalon
@ 2023-03-28 19:25 ` Stephen Hemminger
  3 siblings, 0 replies; 6+ messages in thread
From: Stephen Hemminger @ 2023-03-28 19:25 UTC (permalink / raw)
  To: Joyce Kong
  Cc: reshma.pattan, konstantin.v.ananyev, dev, nd, stable, Ruifeng Wang

On Mon, 27 Mar 2023 07:07:12 +0000
Joyce Kong <joyce.kong@arm.com> wrote:

> Actually, this is an alias warning as -O3 enables strict alias.
> This patch fixes it by replacing 'dup_bufs' with '&dup_bufs[0]'
> as the compiler represents them differently.

This looks more like a compiler bug, since both should be
equivalent in C.

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

end of thread, other threads:[~2023-03-28 19:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-27  7:07 [PATCH] pdump: fix build issue with GCC 12 Joyce Kong
2023-03-27 14:19 ` Pattan, Reshma
2023-03-27 14:34 ` Tyler Retzlaff
2023-03-28  6:27   ` Joyce Kong
2023-03-28 16:25 ` Thomas Monjalon
2023-03-28 19:25 ` Stephen Hemminger

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