On Thu, 5 May 2022 19:43:43 +0200 Stanisław Kardach <k...@semihalf.com> wrote:
> On Thu, May 5, 2022 at 7:35 PM Stephen Hemminger <step...@networkplumber.org> > wrote: > > > On Thu, 5 May 2022 19:30:01 +0200 > > Stanislaw Kardach <k...@semihalf.com> wrote: > > > > > When compiling for RISC-V in debug mode the large amount of inlining in > > > test_ring_basic_ex() and test_ring_with_exact_size() (in test_ring.c) > > > leads to large loop bodies. This causes 'goto' and 'for' loop > > > PC-relative jumps generated by the compiler to go beyond the architecture > > > limitation of +/-1MB offset (the 'j <offset>' instruction). This > > > instruction should not be generated by the compiler since C language does > > > not limit the maximum distance for 'goto' or 'for' loop jumps. > > > > > > This only happens in the unit test for ring which tries to perform long > > > loops with ring enqueue/dequeue and it seems to be caused by excessive > > > __rte_always_inline usage. ring perf test compiles just fine under > > > debug. > > > > > > To work around this, disable the offending tests in debug mode. > > > > > > Signed-off-by: Stanislaw Kardach <k...@semihalf.com> > > > Sponsored-by: Frank Zhao <frank.z...@starfivetech.com> > > > Sponsored-by: Sam Grove <sam.gr...@sifive.com> > > > --- > > > > It seems to me that fixing the excessive inlining in the ring code > > could benefit all architectures, rather than neutering the tests > > on RISCV. > > > 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. > 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). There is no good reason the __rte_always_inline should be in the ring code. The purpose of always inline should be only for code that would break if not inlined.