From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4D995A00C2; Thu, 5 May 2022 19:31:28 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C7D0842855; Thu, 5 May 2022 19:30:37 +0200 (CEST) Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) by mails.dpdk.org (Postfix) with ESMTP id 1DF2C42849 for ; Thu, 5 May 2022 19:30:35 +0200 (CEST) Received: by mail-lf1-f51.google.com with SMTP id w1so8627905lfa.4 for ; Thu, 05 May 2022 10:30:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mPv2df3GWGEGSeivbo+U202bk5gf7E+r+1iOsSwMG1E=; b=NaAC8aJCvYdn76egG+1SwB3/0ccqfBdf+Qp/IqFtkfIb7L/tStzA6H08jX3KrcYgwv LyYGVXK1ft3NiTbl2wMs2hjc3knuEe3248cbIouEMY4tFqvPJ2nRhcikwoV4ZN8JzIIH T35buqUOv6MYdjh+8YV6vij+DRVkf7aFZqg3QNSujOmhrtOWooTwEZzNR7h9GV9mESsm +0KrBvlX/4OxYFNj5MBSiK2DC5qx+whnNwlYI9VDdjYdBiao4j8GMBpDWOi+8BiTtq07 fPgr9d+C8ejUWb+8OHjWlB/QEj7IA3lGXwYKJ3t/xSCGpIlbsWhYZWTuHjXftRchVzdb CHuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mPv2df3GWGEGSeivbo+U202bk5gf7E+r+1iOsSwMG1E=; b=Y4ODmlJ5QqdYwmRn734iIW1LX1U6R/+d3EteEO3/oCSyTRPdRY2mFS4vdCdGO9tkW5 WkPjC9BPp/q2hmJnqGkREdIeOUnIQ8VD2MfvbWCbYRsGBKi+U717la06FXNZrM18B8FS DFAVnBkFDAdjtjveTa9Me5THUmESWkCMB+PPtFrI/K3/qxWxk7dMLg2b3EVF4gqS6VBf TK8Y8dBZSrubVpxvAlu2BcbBqrd8DEERQGp5DIR1iEoh34R9ZGO8K0o5cHMRINn9jt0J agajm5sJHqKHPw/t6ia2dD1aCiOoeIrljcnAmVJ6bjaI9PDKPvQV9YDvBYXHd68Vgimf /GhQ== X-Gm-Message-State: AOAM533REHfE1xD4Rb5mkS6LhACJ8hORW2qPmh+CdxYrxhk8rAT/3RXr S9L8aDoRb17xwQd6cyJPEhGNsA== X-Google-Smtp-Source: ABdhPJzqCods3oHKBvZTRYu6L0W47mxY2qcQq7gZ7/B5T0XyA/931Ag8t0SNvmda1PxUFwgC6m5Lww== X-Received: by 2002:a05:6512:132a:b0:471:af97:77b7 with SMTP id x42-20020a056512132a00b00471af9777b7mr18628152lfu.115.1651771834836; Thu, 05 May 2022 10:30:34 -0700 (PDT) Received: from localhost.localdomain (89-73-146-138.dynamic.chello.pl. [89.73.146.138]) by smtp.gmail.com with ESMTPSA id z26-20020ac25dfa000000b0047255d21203sm289640lfq.306.2022.05.05.10.30.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 May 2022 10:30:34 -0700 (PDT) From: Stanislaw Kardach To: Honnappa Nagarahalli Cc: Stanislaw Kardach , dev@dpdk.org, Frank Zhao , Sam Grove , mw@semihalf.com, upstream@semihalf.com Subject: [PATCH 09/11] test/ring: disable problematic tests for RISC-V Date: Thu, 5 May 2022 19:30:01 +0200 Message-Id: <20220505173003.3242618-10-kda@semihalf.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220505173003.3242618-1-kda@semihalf.com> References: <20220505173003.3242618-1-kda@semihalf.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 ' 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 Sponsored-by: Frank Zhao Sponsored-by: Sam Grove --- app/test/test_ring.c | 8 ++++++++ config/riscv/meson.build | 5 +++++ doc/guides/rel_notes/release_22_07.rst | 3 ++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/app/test/test_ring.c b/app/test/test_ring.c index bde33ab4a1..7d809c147b 100644 --- a/app/test/test_ring.c +++ b/app/test/test_ring.c @@ -955,6 +955,7 @@ test_ring_burst_bulk_tests4(unsigned int test_idx) return -1; } +#if !defined(RTE_RISCV_WO_DISABLE_RING_TESTS) /* * Test default, single element, bulk and burst APIs */ @@ -1189,6 +1190,7 @@ test_ring_with_exact_size(void) rte_ring_free(exact_sz_r); return -1; } +#endif static int test_ring(void) @@ -1200,12 +1202,18 @@ test_ring(void) if (test_ring_negative_tests() < 0) goto test_fail; +/* Disable the following tests on RISC-V in debug mode. This is a work-around + * GCC bug for RISC-V which fails to generate proper jumps for loops with large + * bodies. + */ +#if !defined(RTE_RISCV_WO_DISABLE_RING_TESTS) /* Some basic operations */ if (test_ring_basic_ex() < 0) goto test_fail; if (test_ring_with_exact_size() < 0) goto test_fail; +#endif /* Burst and bulk operations with sp/sc, mp/mc and default. * The test cases are split into smaller test cases to diff --git a/config/riscv/meson.build b/config/riscv/meson.build index 0c16c31fc2..50d0b513bf 100644 --- a/config/riscv/meson.build +++ b/config/riscv/meson.build @@ -141,3 +141,8 @@ foreach flag: dpdk_flags endforeach message('Using machine args: @0@'.format(machine_args)) +# Enable work-around for ring unit tests in debug mode which fail to link +# properly due to bad code generation by GCC. +if get_option('optimization') == '0' or get_option('optimization') == 'g' + add_project_arguments('-DRTE_RISCV_WO_DISABLE_RING_TESTS', language: 'c') +endif diff --git a/doc/guides/rel_notes/release_22_07.rst b/doc/guides/rel_notes/release_22_07.rst index 453591e568..4d64b68dfd 100644 --- a/doc/guides/rel_notes/release_22_07.rst +++ b/doc/guides/rel_notes/release_22_07.rst @@ -76,7 +76,8 @@ New Features * Debug build of ``app/test/dpdk-test`` fails currently on RISC-V due to seemingly invalid loop and goto jump code generation by GCC in ``test_ring.c`` where extensive inlining increases the code size beyond the - capability of the generated instruction (JAL: +/-1MB PC-relative). + capability of the generated instruction (JAL: +/-1MB PC-relative). The + workaround is to disable ``test_ring_basic_ex()`` and ``test_ring_with_exact_size()`` on RISC-V on ``-O0`` or ``-Og``. * **Updated Intel iavf driver.** -- 2.30.2