* [PATCH 1/1] test/ring: remove excessive inlining
@ 2022-05-10 11:57 Stanislaw Kardach
2022-05-10 23:23 ` Honnappa Nagarahalli
2022-05-11 15:07 ` [PATCH v2 " Stanislaw Kardach
0 siblings, 2 replies; 9+ messages in thread
From: Stanislaw Kardach @ 2022-05-10 11:57 UTC (permalink / raw)
To: Honnappa Nagarahalli
Cc: Stanislaw Kardach, dev, Frank Zhao, Sam Grove, mw, upstream
Forcing inlining in test_ring_enqueue and test_ring_dequeue can cause
the compiled code to grow extensively when compiled with no optimization
(-O0 or -Og). This is default in the meson's debug configuration. This
can collide with compiler bugs and cause issues during linking of unit
tests where the api_type or esize are non-const variables causing
inlining cascade. In perf tests this is not the case in perf-tests as
esize and api_type are const values.
One such case was discovered when porting DPDK to RISC-V. GCC 11.2 (and
no fix still in 12.1) is generating a short relative jump instruction
(J <offset>) for goto and for loops. When loop body grows extensively in
ring test, the target offset goes beyond supported offfset of +/- 1MB
from PC. This is an obvious bug in the GCC as RISC-V has a
two-instruction construct to jump to any absolute address (AUIPC+JALR).
However there is no reason to force inlining as the test code works
perfectly fine without it.
Fixes: a9fe152363 test/ring: add custom element size functional tests
Signed-off-by: Stanislaw Kardach <kda@semihalf.com>
---
app/test/test_ring.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/app/test/test_ring.h b/app/test/test_ring.h
index c8bfec8399..45c263f3ff 100644
--- a/app/test/test_ring.h
+++ b/app/test/test_ring.h
@@ -97,7 +97,7 @@ test_ring_copy_from(struct rte_ring_zc_data *zcd, void *dst, int esize,
}
}
-static __rte_always_inline unsigned int
+static inline unsigned int
test_ring_enqueue(struct rte_ring *r, void **obj, int esize, unsigned int n,
unsigned int api_type)
{
@@ -158,7 +158,7 @@ test_ring_enqueue(struct rte_ring *r, void **obj, int esize, unsigned int n,
}
}
-static __rte_always_inline unsigned int
+static inline unsigned int
test_ring_dequeue(struct rte_ring *r, void **obj, int esize, unsigned int n,
unsigned int api_type)
{
@@ -222,7 +222,7 @@ test_ring_dequeue(struct rte_ring *r, void **obj, int esize, unsigned int n,
/* This function is placed here as it is required for both
* performance and functional tests.
*/
-static __rte_always_inline void *
+static inline void *
test_ring_calloc(unsigned int rsize, int esize)
{
unsigned int sz;
--
2.30.2
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH 1/1] test/ring: remove excessive inlining
2022-05-10 11:57 [PATCH 1/1] test/ring: remove excessive inlining Stanislaw Kardach
@ 2022-05-10 23:23 ` Honnappa Nagarahalli
2022-05-11 9:14 ` Bruce Richardson
2022-05-11 14:39 ` Stanisław Kardach
2022-05-11 15:07 ` [PATCH v2 " Stanislaw Kardach
1 sibling, 2 replies; 9+ messages in thread
From: Honnappa Nagarahalli @ 2022-05-10 23:23 UTC (permalink / raw)
To: Stanislaw Kardach
Cc: dev, Frank Zhao, Sam Grove, mw, upstream, nd, Stephen Hemminger,
bruce.richardson, Ananyev, Konstantin, nd
+ Bruce, Stephen
<snip>
>
> Forcing inlining in test_ring_enqueue and test_ring_dequeue can cause the
> compiled code to grow extensively when compiled with no optimization
> (-O0 or -Og). This is default in the meson's debug configuration. This can collide
> with compiler bugs and cause issues during linking of unit tests where the
> api_type or esize are non-const variables causing inlining cascade. In perf tests
> this is not the case in perf-tests as esize and api_type are const values.
>
> One such case was discovered when porting DPDK to RISC-V. GCC 11.2 (and no
> fix still in 12.1) is generating a short relative jump instruction (J <offset>) for
> goto and for loops. When loop body grows extensively in ring test, the target
> offset goes beyond supported offfset of +/- 1MB from PC. This is an obvious
> bug in the GCC as RISC-V has a two-instruction construct to jump to any
> absolute address (AUIPC+JALR).
Is there a bug report created for this? Is it possible to add a link to the bug report?
>
> However there is no reason to force inlining as the test code works perfectly
> fine without it.
If this solves the problem, I prefer this as it is test code.
>
> Fixes: a9fe152363 test/ring: add custom element size functional tests
>
> Signed-off-by: Stanislaw Kardach <kda@semihalf.com>
> ---
> app/test/test_ring.h | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/app/test/test_ring.h b/app/test/test_ring.h index
> c8bfec8399..45c263f3ff 100644
> --- a/app/test/test_ring.h
> +++ b/app/test/test_ring.h
> @@ -97,7 +97,7 @@ test_ring_copy_from(struct rte_ring_zc_data *zcd, void
> *dst, int esize,
> }
> }
>
> -static __rte_always_inline unsigned int
> +static inline unsigned int
> test_ring_enqueue(struct rte_ring *r, void **obj, int esize, unsigned int n,
> unsigned int api_type)
> {
> @@ -158,7 +158,7 @@ test_ring_enqueue(struct rte_ring *r, void **obj, int
> esize, unsigned int n,
> }
> }
>
> -static __rte_always_inline unsigned int
> +static inline unsigned int
> test_ring_dequeue(struct rte_ring *r, void **obj, int esize, unsigned int n,
> unsigned int api_type)
> {
> @@ -222,7 +222,7 @@ test_ring_dequeue(struct rte_ring *r, void **obj, int
> esize, unsigned int n,
> /* This function is placed here as it is required for both
> * performance and functional tests.
> */
> -static __rte_always_inline void *
> +static inline void *
> test_ring_calloc(unsigned int rsize, int esize) {
> unsigned int sz;
> --
> 2.30.2
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/1] test/ring: remove excessive inlining
2022-05-10 23:23 ` Honnappa Nagarahalli
@ 2022-05-11 9:14 ` Bruce Richardson
2022-05-11 14:39 ` Stanisław Kardach
1 sibling, 0 replies; 9+ messages in thread
From: Bruce Richardson @ 2022-05-11 9:14 UTC (permalink / raw)
To: Honnappa Nagarahalli
Cc: Stanislaw Kardach, dev, Frank Zhao, Sam Grove, mw, upstream, nd,
Stephen Hemminger, Ananyev, Konstantin
On Tue, May 10, 2022 at 11:23:53PM +0000, Honnappa Nagarahalli wrote:
> + Bruce, Stephen
>
> <snip>
>
> >
> > Forcing inlining in test_ring_enqueue and test_ring_dequeue can cause the
> > compiled code to grow extensively when compiled with no optimization
> > (-O0 or -Og). This is default in the meson's debug configuration. This can collide
> > with compiler bugs and cause issues during linking of unit tests where the
> > api_type or esize are non-const variables causing inlining cascade. In perf tests
> > this is not the case in perf-tests as esize and api_type are const values.
> >
> > One such case was discovered when porting DPDK to RISC-V. GCC 11.2 (and no
> > fix still in 12.1) is generating a short relative jump instruction (J <offset>) for
> > goto and for loops. When loop body grows extensively in ring test, the target
> > offset goes beyond supported offfset of +/- 1MB from PC. This is an obvious
> > bug in the GCC as RISC-V has a two-instruction construct to jump to any
> > absolute address (AUIPC+JALR).
> Is there a bug report created for this? Is it possible to add a link to the bug report?
>
> >
> > However there is no reason to force inlining as the test code works perfectly
> > fine without it.
> If this solves the problem, I prefer this as it is test code.
>
+1 to this. I'm quite wary of changing the ring code itself.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/1] test/ring: remove excessive inlining
2022-05-10 23:23 ` Honnappa Nagarahalli
2022-05-11 9:14 ` Bruce Richardson
@ 2022-05-11 14:39 ` Stanisław Kardach
1 sibling, 0 replies; 9+ messages in thread
From: Stanisław Kardach @ 2022-05-11 14:39 UTC (permalink / raw)
To: Honnappa Nagarahalli
Cc: dev, Frank Zhao, Sam Grove, mw, upstream, nd, Stephen Hemminger,
bruce.richardson, Ananyev, Konstantin
On Wed, May 11, 2022 at 1:24 AM Honnappa Nagarahalli
<Honnappa.Nagarahalli@arm.com> wrote:
<snip>
> Is there a bug report created for this? Is it possible to add a link to the bug report?
I have found a bug for a similar issue (with "if" conditional):
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93062
I'll add it in v2.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 1/1] test/ring: remove excessive inlining
2022-05-10 11:57 [PATCH 1/1] test/ring: remove excessive inlining Stanislaw Kardach
2022-05-10 23:23 ` Honnappa Nagarahalli
@ 2022-05-11 15:07 ` Stanislaw Kardach
2022-05-11 15:48 ` Bruce Richardson
` (2 more replies)
1 sibling, 3 replies; 9+ messages in thread
From: Stanislaw Kardach @ 2022-05-11 15:07 UTC (permalink / raw)
To: Honnappa Nagarahalli
Cc: Stanislaw Kardach, dev, Frank Zhao, Sam Grove, mw, upstream
Forcing inlining in test_ring_enqueue and test_ring_dequeue can cause
the compiled code to grow extensively when compiled with no optimization
(-O0 or -Og). This is default in the meson's debug configuration. This
can collide with compiler bugs and cause issues during linking of unit
tests where the api_type or esize are non-const variables causing
inlining cascade. In perf tests this is not the case in perf-tests as
esize and api_type are const values.
One such case was discovered when porting DPDK to RISC-V. GCC 11.2 (and
no fix still in 12.1) is generating a short relative jump instruction
(J <offset>) for goto and for loops. When loop body grows extensively in
ring test, the target offset goes beyond supported offfset of +/- 1MB
from PC. This is an obvious bug in the GCC as RISC-V has a
two-instruction construct to jump to any absolute address (AUIPC+JALR).
However there is no reason to force inlining as the test code works
perfectly fine without it.
GCC has a bug report for a similar case (with conditionals):
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93062
Fixes: a9fe152363 test/ring: add custom element size functional tests
Signed-off-by: Stanislaw Kardach <kda@semihalf.com>
---
app/test/test_ring.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/app/test/test_ring.h b/app/test/test_ring.h
index c8bfec8399..45c263f3ff 100644
--- a/app/test/test_ring.h
+++ b/app/test/test_ring.h
@@ -97,7 +97,7 @@ test_ring_copy_from(struct rte_ring_zc_data *zcd, void *dst, int esize,
}
}
-static __rte_always_inline unsigned int
+static inline unsigned int
test_ring_enqueue(struct rte_ring *r, void **obj, int esize, unsigned int n,
unsigned int api_type)
{
@@ -158,7 +158,7 @@ test_ring_enqueue(struct rte_ring *r, void **obj, int esize, unsigned int n,
}
}
-static __rte_always_inline unsigned int
+static inline unsigned int
test_ring_dequeue(struct rte_ring *r, void **obj, int esize, unsigned int n,
unsigned int api_type)
{
@@ -222,7 +222,7 @@ test_ring_dequeue(struct rte_ring *r, void **obj, int esize, unsigned int n,
/* This function is placed here as it is required for both
* performance and functional tests.
*/
-static __rte_always_inline void *
+static inline void *
test_ring_calloc(unsigned int rsize, int esize)
{
unsigned int sz;
--
2.30.2
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 1/1] test/ring: remove excessive inlining
2022-05-11 15:07 ` [PATCH v2 " Stanislaw Kardach
@ 2022-05-11 15:48 ` Bruce Richardson
2022-05-23 13:31 ` David Marchand
2022-05-11 16:51 ` Honnappa Nagarahalli
2022-05-19 22:50 ` Konstantin Ananyev
2 siblings, 1 reply; 9+ messages in thread
From: Bruce Richardson @ 2022-05-11 15:48 UTC (permalink / raw)
To: Stanislaw Kardach
Cc: Honnappa Nagarahalli, dev, Frank Zhao, Sam Grove, mw, upstream
On Wed, May 11, 2022 at 05:07:25PM +0200, Stanislaw Kardach wrote:
> Forcing inlining in test_ring_enqueue and test_ring_dequeue can cause
> the compiled code to grow extensively when compiled with no optimization
> (-O0 or -Og). This is default in the meson's debug configuration. This
> can collide with compiler bugs and cause issues during linking of unit
> tests where the api_type or esize are non-const variables causing
> inlining cascade. In perf tests this is not the case in perf-tests as
> esize and api_type are const values.
>
> One such case was discovered when porting DPDK to RISC-V. GCC 11.2 (and
> no fix still in 12.1) is generating a short relative jump instruction
> (J <offset>) for goto and for loops. When loop body grows extensively in
> ring test, the target offset goes beyond supported offfset of +/- 1MB
> from PC. This is an obvious bug in the GCC as RISC-V has a
> two-instruction construct to jump to any absolute address (AUIPC+JALR).
>
> However there is no reason to force inlining as the test code works
> perfectly fine without it.
>
> GCC has a bug report for a similar case (with conditionals):
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93062
>
> Fixes: a9fe152363 test/ring: add custom element size functional tests
>
> Signed-off-by: Stanislaw Kardach <kda@semihalf.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 1/1] test/ring: remove excessive inlining
2022-05-11 15:48 ` Bruce Richardson
@ 2022-05-23 13:31 ` David Marchand
0 siblings, 0 replies; 9+ messages in thread
From: David Marchand @ 2022-05-23 13:31 UTC (permalink / raw)
To: Stanislaw Kardach
Cc: Bruce Richardson, Honnappa Nagarahalli, dev, Frank Zhao,
Sam Grove, Marcin Wojtas, upstream, Konstantin Ananyev
On Wed, May 11, 2022 at 5:49 PM Bruce Richardson
<bruce.richardson@intel.com> wrote:
>
> On Wed, May 11, 2022 at 05:07:25PM +0200, Stanislaw Kardach wrote:
> > Forcing inlining in test_ring_enqueue and test_ring_dequeue can cause
> > the compiled code to grow extensively when compiled with no optimization
> > (-O0 or -Og). This is default in the meson's debug configuration. This
> > can collide with compiler bugs and cause issues during linking of unit
> > tests where the api_type or esize are non-const variables causing
> > inlining cascade. In perf tests this is not the case in perf-tests as
> > esize and api_type are const values.
> >
> > One such case was discovered when porting DPDK to RISC-V. GCC 11.2 (and
> > no fix still in 12.1) is generating a short relative jump instruction
> > (J <offset>) for goto and for loops. When loop body grows extensively in
> > ring test, the target offset goes beyond supported offfset of +/- 1MB
> > from PC. This is an obvious bug in the GCC as RISC-V has a
> > two-instruction construct to jump to any absolute address (AUIPC+JALR).
> >
> > However there is no reason to force inlining as the test code works
> > perfectly fine without it.
> >
> > GCC has a bug report for a similar case (with conditionals):
> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93062
> >
> > Fixes: a9fe152363 test/ring: add custom element size functional tests
Fixes: a9fe152363e2 ("test/ring: add custom element size functional tests")
> >
> > Signed-off-by: Stanislaw Kardach <kda@semihalf.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Acked-by: Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>
Applied, thanks.
--
David Marchand
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH v2 1/1] test/ring: remove excessive inlining
2022-05-11 15:07 ` [PATCH v2 " Stanislaw Kardach
2022-05-11 15:48 ` Bruce Richardson
@ 2022-05-11 16:51 ` Honnappa Nagarahalli
2022-05-19 22:50 ` Konstantin Ananyev
2 siblings, 0 replies; 9+ messages in thread
From: Honnappa Nagarahalli @ 2022-05-11 16:51 UTC (permalink / raw)
To: Stanislaw Kardach; +Cc: dev, Frank Zhao, Sam Grove, mw, upstream, nd, nd
<snip>
>
> Forcing inlining in test_ring_enqueue and test_ring_dequeue can cause the
> compiled code to grow extensively when compiled with no optimization
> (-O0 or -Og). This is default in the meson's debug configuration. This can collide
> with compiler bugs and cause issues during linking of unit tests where the
> api_type or esize are non-const variables causing inlining cascade. In perf tests
> this is not the case in perf-tests as esize and api_type are const values.
>
> One such case was discovered when porting DPDK to RISC-V. GCC 11.2 (and no
> fix still in 12.1) is generating a short relative jump instruction (J <offset>) for
> goto and for loops. When loop body grows extensively in ring test, the target
> offset goes beyond supported offfset of +/- 1MB from PC. This is an obvious
> bug in the GCC as RISC-V has a two-instruction construct to jump to any
> absolute address (AUIPC+JALR).
>
> However there is no reason to force inlining as the test code works perfectly
> fine without it.
>
> GCC has a bug report for a similar case (with conditionals):
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93062
>
> Fixes: a9fe152363 test/ring: add custom element size functional tests
>
> Signed-off-by: Stanislaw Kardach <kda@semihalf.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 1/1] test/ring: remove excessive inlining
2022-05-11 15:07 ` [PATCH v2 " Stanislaw Kardach
2022-05-11 15:48 ` Bruce Richardson
2022-05-11 16:51 ` Honnappa Nagarahalli
@ 2022-05-19 22:50 ` Konstantin Ananyev
2 siblings, 0 replies; 9+ messages in thread
From: Konstantin Ananyev @ 2022-05-19 22:50 UTC (permalink / raw)
To: Stanislaw Kardach, Honnappa Nagarahalli
Cc: dev, Frank Zhao, Sam Grove, mw, upstream
11/05/2022 16:07, Stanislaw Kardach пишет:
> Forcing inlining in test_ring_enqueue and test_ring_dequeue can cause
> the compiled code to grow extensively when compiled with no optimization
> (-O0 or -Og). This is default in the meson's debug configuration. This
> can collide with compiler bugs and cause issues during linking of unit
> tests where the api_type or esize are non-const variables causing
> inlining cascade. In perf tests this is not the case in perf-tests as
> esize and api_type are const values.
>
> One such case was discovered when porting DPDK to RISC-V. GCC 11.2 (and
> no fix still in 12.1) is generating a short relative jump instruction
> (J <offset>) for goto and for loops. When loop body grows extensively in
> ring test, the target offset goes beyond supported offfset of +/- 1MB
> from PC. This is an obvious bug in the GCC as RISC-V has a
> two-instruction construct to jump to any absolute address (AUIPC+JALR).
>
> However there is no reason to force inlining as the test code works
> perfectly fine without it.
>
> GCC has a bug report for a similar case (with conditionals):
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93062
>
> Fixes: a9fe152363 test/ring: add custom element size functional tests
>
> Signed-off-by: Stanislaw Kardach <kda@semihalf.com>
> ---
> app/test/test_ring.h | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/app/test/test_ring.h b/app/test/test_ring.h
> index c8bfec8399..45c263f3ff 100644
> --- a/app/test/test_ring.h
> +++ b/app/test/test_ring.h
> @@ -97,7 +97,7 @@ test_ring_copy_from(struct rte_ring_zc_data *zcd, void *dst, int esize,
> }
> }
>
> -static __rte_always_inline unsigned int
> +static inline unsigned int
> test_ring_enqueue(struct rte_ring *r, void **obj, int esize, unsigned int n,
> unsigned int api_type)
> {
> @@ -158,7 +158,7 @@ test_ring_enqueue(struct rte_ring *r, void **obj, int esize, unsigned int n,
> }
> }
>
> -static __rte_always_inline unsigned int
> +static inline unsigned int
> test_ring_dequeue(struct rte_ring *r, void **obj, int esize, unsigned int n,
> unsigned int api_type)
> {
> @@ -222,7 +222,7 @@ test_ring_dequeue(struct rte_ring *r, void **obj, int esize, unsigned int n,
> /* This function is placed here as it is required for both
> * performance and functional tests.
> */
> -static __rte_always_inline void *
> +static inline void *
> test_ring_calloc(unsigned int rsize, int esize)
> {
> unsigned int sz;
Acked-by: Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2022-05-23 13:31 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-10 11:57 [PATCH 1/1] test/ring: remove excessive inlining Stanislaw Kardach
2022-05-10 23:23 ` Honnappa Nagarahalli
2022-05-11 9:14 ` Bruce Richardson
2022-05-11 14:39 ` Stanisław Kardach
2022-05-11 15:07 ` [PATCH v2 " Stanislaw Kardach
2022-05-11 15:48 ` Bruce Richardson
2022-05-23 13:31 ` David Marchand
2022-05-11 16:51 ` Honnappa Nagarahalli
2022-05-19 22:50 ` Konstantin Ananyev
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).