<div dir="ltr"><div dir="ltr">On Thu, May 5, 2022 at 7:35 PM Stephen Hemminger <<a href="mailto:stephen@networkplumber.org" target="_blank">stephen@networkplumber.org</a>> wrote:<br></div><div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Thu, 5 May 2022 19:30:01 +0200<br>
Stanislaw Kardach <<a href="mailto:kda@semihalf.com" target="_blank">kda@semihalf.com</a>> wrote:<br>
<br>
> When compiling for RISC-V in debug mode the large amount of inlining in<br>
> test_ring_basic_ex() and test_ring_with_exact_size() (in test_ring.c)<br>
> leads to large loop bodies. This causes 'goto' and 'for' loop<br>
> PC-relative jumps generated by the compiler to go beyond the architecture<br>
> limitation of +/-1MB offset (the 'j <offset>' instruction). This<br>
> instruction should not be generated by the compiler since C language does<br>
> not limit the maximum distance for 'goto' or 'for' loop jumps.<br>
> <br>
> This only happens in the unit test for ring which tries to perform long<br>
> loops with ring enqueue/dequeue and it seems to be caused by excessive<br>
> __rte_always_inline usage. ring perf test compiles just fine under<br>
> debug.<br>
> <br>
> To work around this, disable the offending tests in debug mode.<br>
> <br>
> Signed-off-by: Stanislaw Kardach <<a href="mailto:kda@semihalf.com" target="_blank">kda@semihalf.com</a>><br>
> Sponsored-by: Frank Zhao <<a href="mailto:Frank.Zhao@starfivetech.com" target="_blank">Frank.Zhao@starfivetech.com</a>><br>
> Sponsored-by: Sam Grove <<a href="mailto:sam.grove@sifive.com" target="_blank">sam.grove@sifive.com</a>><br>
> ---<br>
<br>
It seems to me that fixing the excessive inlining in the ring code<br>
could benefit all architectures, rather than neutering the tests<br>
on RISCV.<br></blockquote><div> True. Since this only happened in the tests that I've mentioned, my other approach was to introduce a "slow" wrapper over test_ring_dequeue|enqueue() which did not force inlining via __rte_always_inline and use it in functional test functions. However after talking with Thomas Monjalon we've decided to guard the debug build of RISC-V only.</div><div>Another thing is that this is a clear bug in the compiler, the relaxation of the jump should not be done since RISC-V has long jump construct for arbitrary jumps (auipc+jalr).</div></div></div>
</div>