From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id D5149A0527 for ; Mon, 9 Nov 2020 19:41:50 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CA0E89AFA; Mon, 9 Nov 2020 19:41:49 +0100 (CET) Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) by dpdk.org (Postfix) with ESMTP id 2509C72ED for ; Mon, 9 Nov 2020 19:41:48 +0100 (CET) Received: by mail-wm1-f45.google.com with SMTP id h2so466577wmm.0 for ; Mon, 09 Nov 2020 10:41:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LvkiRqiRzYrglsyRGzuxPmZZJSHsQtXU6d2tQiw9mq4=; b=LRKr1uNC8eWzxG1BSysnITJN1KmyI/r/c1jqBLBzd7IlCKwB3yl5E0XTk1RqRFIJVD wcpiQLCvikOXdRFNHAuC/d7lMSw1NfUTNNIgxfIE0RRU5VUq6CJczZmynWsDiSzPKnz8 G5ikmxAmYQ4e+LrEReZrH0y471avu4i2ankgFDXzNn9K4LfKu0zELP1tPDebMRkQ0SLY sqLrLs4p1CbDujZStxEd0B4FNO3NVHuScgksiE2s2vo1O/MZwRLfFy89Amo9LC1qb4Hd I/pLP/dlQMGgIwc8Sg7WFr0+o01qPngS2ul3gqLQFZTZWoCTwajp+dwjvtfxY+uHqsHL 7I5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LvkiRqiRzYrglsyRGzuxPmZZJSHsQtXU6d2tQiw9mq4=; b=bYWvTTSdIWCijOxK30AoOtjS9SgGpgmbWREAgDzZvvINjfGX1uNLWEzAn4Oh4yqZvF oa6utaG23wpsbUFfeAiEZpWhAS/6r9i40EKvCBxUhomsGh3FCv2jH0gmFQuI/4aCZGbk q5Px5Er1xzKww5/jr99kVmzsSTbfepifFKWHTUCMT0BK6Zj3ewZM9+JpbtAH8Fw7MKsA g2xxArBlec53C4T3qAOswHX/I+c4db3VEeQz4YbFp8KgfI5fMLVVYBq+eHT7jqFmnA/B Ay+yANKJvL+oozW2QMu4YV3Jr0ZBHlNvwJShFS4Oe085smfEXoXWa8GZrM3U7cuWsAxA Jqmg== X-Gm-Message-State: AOAM533J7cnEJzjs5uqIzZVRGHB/YRm9JRU6PZIhXn86kKof8zKgULob sJHMQbkTonGChD1u7j6Ji9we5y33lDMBlw== X-Google-Smtp-Source: ABdhPJyIr7qaV2/wS8JRPi+iOFchbT69j88Gy6QDq3Kav66bVL1gSSxDl/O6l4k9rHiSdzXVXa5rAQ== X-Received: by 2002:a1c:a7ce:: with SMTP id q197mr565244wme.138.1604947306894; Mon, 09 Nov 2020 10:41:46 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id i6sm277960wma.42.2020.11.09.10.41.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Nov 2020 10:41:46 -0800 (PST) From: luca.boccassi@gmail.com To: Honnappa Nagarahalli Cc: Ruifeng Wang , Lukasz Wojciechowski , dpdk stable Date: Mon, 9 Nov 2020 18:39:58 +0000 Message-Id: <20201109184111.3463090-10-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201109184111.3463090-1-luca.boccassi@gmail.com> References: <20201028104606.3504127-207-luca.boccassi@gmail.com> <20201109184111.3463090-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'test/rcu: fix build with low core count' has been queued to stable release 19.11.6 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 19.11.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/11/20. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/9d663d0e983b52192354372076b8be2e254f194f Thanks. Luca Boccassi --- >From 9d663d0e983b52192354372076b8be2e254f194f Mon Sep 17 00:00:00 2001 From: Honnappa Nagarahalli Date: Fri, 16 Oct 2020 01:03:48 -0500 Subject: [PATCH] test/rcu: fix build with low core count [ upstream commit 0ca6007efc3a74f5d4184a7844a40cc7f4ad2c1d ] When RTE_MAX_LCORE value is small, following compiler errors are observed. ../app/test/test_rcu_qsbr.c:296:54: error: iteration 2 invokes undefined behavior [-Werror=aggressive-loop-optimizations] ../app/test/test_rcu_qsbr.c:315:55: error: array subscript is above array bounds [-Werror=array-bounds] Fixes: b87089b0bb19 ("test/rcu: add API and functional tests") Signed-off-by: Honnappa Nagarahalli Reviewed-by: Ruifeng Wang Tested-by: Lukasz Wojciechowski Reviewed-by: Lukasz Wojciechowski --- app/test/test_rcu_qsbr.c | 56 +++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 23 deletions(-) diff --git a/app/test/test_rcu_qsbr.c b/app/test/test_rcu_qsbr.c index b60dc5099c..5542b3c175 100644 --- a/app/test/test_rcu_qsbr.c +++ b/app/test/test_rcu_qsbr.c @@ -273,13 +273,13 @@ static int test_rcu_qsbr_start(void) { uint64_t token; - int i; + unsigned int i; printf("\nTest rte_rcu_qsbr_start()\n"); rte_rcu_qsbr_init(t[0], RTE_MAX_LCORE); - for (i = 0; i < 3; i++) + for (i = 0; i < num_cores; i++) rte_rcu_qsbr_thread_register(t[0], enabled_core_ids[i]); token = rte_rcu_qsbr_start(t[0]); @@ -293,14 +293,18 @@ test_rcu_qsbr_check_reader(void *arg) { struct rte_rcu_qsbr *temp; uint8_t read_type = (uint8_t)((uintptr_t)arg); + unsigned int i; temp = t[read_type]; /* Update quiescent state counter */ - rte_rcu_qsbr_quiescent(temp, enabled_core_ids[0]); - rte_rcu_qsbr_quiescent(temp, enabled_core_ids[1]); - rte_rcu_qsbr_thread_unregister(temp, enabled_core_ids[2]); - rte_rcu_qsbr_quiescent(temp, enabled_core_ids[3]); + for (i = 0; i < num_cores; i++) { + if (i % 2 == 0) + rte_rcu_qsbr_quiescent(temp, enabled_core_ids[i]); + else + rte_rcu_qsbr_thread_unregister(temp, + enabled_core_ids[i]); + } return 0; } @@ -311,7 +315,8 @@ test_rcu_qsbr_check_reader(void *arg) static int test_rcu_qsbr_check(void) { - int i, ret; + int ret; + unsigned int i; uint64_t token; printf("\nTest rte_rcu_qsbr_check()\n"); @@ -329,7 +334,7 @@ test_rcu_qsbr_check(void) ret = rte_rcu_qsbr_check(t[0], token, true); TEST_RCU_QSBR_RETURN_IF_ERROR((ret == 0), "Blocking QSBR check"); - for (i = 0; i < 3; i++) + for (i = 0; i < num_cores; i++) rte_rcu_qsbr_thread_register(t[0], enabled_core_ids[i]); ret = rte_rcu_qsbr_check(t[0], token, false); @@ -344,7 +349,7 @@ test_rcu_qsbr_check(void) /* Threads are offline, hence this should pass */ TEST_RCU_QSBR_RETURN_IF_ERROR((ret == 0), "Non-blocking QSBR check"); - for (i = 0; i < 3; i++) + for (i = 0; i < num_cores; i++) rte_rcu_qsbr_thread_unregister(t[0], enabled_core_ids[i]); ret = rte_rcu_qsbr_check(t[0], token, true); @@ -352,7 +357,7 @@ test_rcu_qsbr_check(void) rte_rcu_qsbr_init(t[0], RTE_MAX_LCORE); - for (i = 0; i < 4; i++) + for (i = 0; i < num_cores; i++) rte_rcu_qsbr_thread_register(t[0], enabled_core_ids[i]); token = rte_rcu_qsbr_start(t[0]); @@ -591,7 +596,7 @@ test_rcu_qsbr_thread_offline(void) static int test_rcu_qsbr_dump(void) { - int i; + unsigned int i; printf("\nTest rte_rcu_qsbr_dump()\n"); @@ -608,7 +613,7 @@ test_rcu_qsbr_dump(void) rte_rcu_qsbr_thread_register(t[0], enabled_core_ids[0]); - for (i = 1; i < 3; i++) + for (i = 1; i < num_cores; i++) rte_rcu_qsbr_thread_register(t[1], enabled_core_ids[i]); rte_rcu_qsbr_dump(stdout, t[0]); @@ -758,7 +763,7 @@ test_rcu_qsbr_sw_sv_3qs(void) { uint64_t token[3]; uint32_t c; - int i; + int i, num_readers; int32_t pos[3]; writer_done = 0; @@ -781,7 +786,11 @@ test_rcu_qsbr_sw_sv_3qs(void) thread_info[0].ih = 0; /* Reader threads are launched */ - for (i = 0; i < 4; i++) + /* Keep the number of reader threads low to reduce + * the execution time. + */ + num_readers = num_cores < 4 ? num_cores : 4; + for (i = 0; i < num_readers; i++) rte_eal_remote_launch(test_rcu_qsbr_reader, &thread_info[0], enabled_core_ids[i]); @@ -814,7 +823,7 @@ test_rcu_qsbr_sw_sv_3qs(void) /* Check the quiescent state status */ rte_rcu_qsbr_check(t[0], token[0], true); - for (i = 0; i < 4; i++) { + for (i = 0; i < num_readers; i++) { c = hash_data[0][0][enabled_core_ids[i]]; if (c != COUNTER_VALUE && c != 0) { printf("Reader lcore %d did not complete #0 = %d\n", @@ -832,7 +841,7 @@ test_rcu_qsbr_sw_sv_3qs(void) /* Check the quiescent state status */ rte_rcu_qsbr_check(t[0], token[1], true); - for (i = 0; i < 4; i++) { + for (i = 0; i < num_readers; i++) { c = hash_data[0][3][enabled_core_ids[i]]; if (c != COUNTER_VALUE && c != 0) { printf("Reader lcore %d did not complete #3 = %d\n", @@ -850,7 +859,7 @@ test_rcu_qsbr_sw_sv_3qs(void) /* Check the quiescent state status */ rte_rcu_qsbr_check(t[0], token[2], true); - for (i = 0; i < 4; i++) { + for (i = 0; i < num_readers; i++) { c = hash_data[0][6][enabled_core_ids[i]]; if (c != COUNTER_VALUE && c != 0) { printf("Reader lcore %d did not complete #6 = %d\n", @@ -869,7 +878,7 @@ test_rcu_qsbr_sw_sv_3qs(void) writer_done = 1; /* Wait and check return value from reader threads */ - for (i = 0; i < 4; i++) + for (i = 0; i < num_readers; i++) if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0) goto error; rte_hash_free(h[0]); @@ -899,6 +908,12 @@ test_rcu_qsbr_mw_mv_mqs(void) unsigned int i, j; unsigned int test_cores; + if (RTE_MAX_LCORE < 5 || num_cores < 4) { + printf("Not enough cores for %s, expecting at least 5\n", + __func__); + return TEST_SKIPPED; + } + writer_done = 0; test_cores = num_cores / 4; test_cores = test_cores * 4; @@ -984,11 +999,6 @@ test_rcu_qsbr_main(void) { uint16_t core_id; - if (rte_lcore_count() < 5) { - printf("Not enough cores for rcu_qsbr_autotest, expecting at least 5\n"); - return TEST_SKIPPED; - } - num_cores = 0; RTE_LCORE_FOREACH_SLAVE(core_id) { enabled_core_ids[num_cores] = core_id; -- 2.27.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-11-09 18:40:11.620316516 +0000 +++ 0010-test-rcu-fix-build-with-low-core-count.patch 2020-11-09 18:40:11.075310411 +0000 @@ -1 +1 @@ -From 0ca6007efc3a74f5d4184a7844a40cc7f4ad2c1d Mon Sep 17 00:00:00 2001 +From 9d663d0e983b52192354372076b8be2e254f194f Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 0ca6007efc3a74f5d4184a7844a40cc7f4ad2c1d ] + @@ -16 +17,0 @@ -Cc: stable@dpdk.org @@ -27 +28 @@ -index 7ae66e4dfb..ab37a068cd 100644 +index b60dc5099c..5542b3c175 100644 @@ -30 +31 @@ -@@ -286,13 +286,13 @@ static int +@@ -273,13 +273,13 @@ static int @@ -46 +47 @@ -@@ -306,14 +306,18 @@ test_rcu_qsbr_check_reader(void *arg) +@@ -293,14 +293,18 @@ test_rcu_qsbr_check_reader(void *arg) @@ -69 +70 @@ -@@ -324,7 +328,8 @@ test_rcu_qsbr_check_reader(void *arg) +@@ -311,7 +315,8 @@ test_rcu_qsbr_check_reader(void *arg) @@ -79 +80 @@ -@@ -342,7 +347,7 @@ test_rcu_qsbr_check(void) +@@ -329,7 +334,7 @@ test_rcu_qsbr_check(void) @@ -88 +89 @@ -@@ -357,7 +362,7 @@ test_rcu_qsbr_check(void) +@@ -344,7 +349,7 @@ test_rcu_qsbr_check(void) @@ -97 +98 @@ -@@ -365,7 +370,7 @@ test_rcu_qsbr_check(void) +@@ -352,7 +357,7 @@ test_rcu_qsbr_check(void) @@ -106 +107 @@ -@@ -928,7 +933,7 @@ end: +@@ -591,7 +596,7 @@ test_rcu_qsbr_thread_offline(void) @@ -115 +116 @@ -@@ -945,7 +950,7 @@ test_rcu_qsbr_dump(void) +@@ -608,7 +613,7 @@ test_rcu_qsbr_dump(void) @@ -124 +125 @@ -@@ -1095,7 +1100,7 @@ test_rcu_qsbr_sw_sv_3qs(void) +@@ -758,7 +763,7 @@ test_rcu_qsbr_sw_sv_3qs(void) @@ -133 +134 @@ -@@ -1118,7 +1123,11 @@ test_rcu_qsbr_sw_sv_3qs(void) +@@ -781,7 +786,11 @@ test_rcu_qsbr_sw_sv_3qs(void) @@ -146 +147 @@ -@@ -1151,7 +1160,7 @@ test_rcu_qsbr_sw_sv_3qs(void) +@@ -814,7 +823,7 @@ test_rcu_qsbr_sw_sv_3qs(void) @@ -155 +156 @@ -@@ -1169,7 +1178,7 @@ test_rcu_qsbr_sw_sv_3qs(void) +@@ -832,7 +841,7 @@ test_rcu_qsbr_sw_sv_3qs(void) @@ -164 +165 @@ -@@ -1187,7 +1196,7 @@ test_rcu_qsbr_sw_sv_3qs(void) +@@ -850,7 +859,7 @@ test_rcu_qsbr_sw_sv_3qs(void) @@ -173 +174 @@ -@@ -1206,7 +1215,7 @@ test_rcu_qsbr_sw_sv_3qs(void) +@@ -869,7 +878,7 @@ test_rcu_qsbr_sw_sv_3qs(void) @@ -182 +183 @@ -@@ -1236,6 +1245,12 @@ test_rcu_qsbr_mw_mv_mqs(void) +@@ -899,6 +908,12 @@ test_rcu_qsbr_mw_mv_mqs(void) @@ -195 +196 @@ -@@ -1321,11 +1336,6 @@ test_rcu_qsbr_main(void) +@@ -984,11 +999,6 @@ test_rcu_qsbr_main(void) @@ -205 +206 @@ - RTE_LCORE_FOREACH_WORKER(core_id) { + RTE_LCORE_FOREACH_SLAVE(core_id) {