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 EC53EA04DD for ; Wed, 28 Oct 2020 11:56:08 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E4FCCCABF; Wed, 28 Oct 2020 11:56:07 +0100 (CET) Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) by dpdk.org (Postfix) with ESMTP id 1F6D6CABF for ; Wed, 28 Oct 2020 11:56:05 +0100 (CET) Received: by mail-wm1-f53.google.com with SMTP id c194so4101661wme.2 for ; Wed, 28 Oct 2020 03:56:05 -0700 (PDT) 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=gD6K5HjH3knXITl7r4jvWivVU4olLzo4tXk/Xae5yjc=; b=egfSLuT3nXkqzqc7nK+518oHX22bUXo8wHxFxkC2zq9c9MCeTFCDsMewFXe7N5xEaG KF6DlkvPGJnB+UIXR6qgvNPaVtHHgI4O9gPXpomWNIyNNOvMZ/PodNhatrv7v4z51SsX eVDKaEqeu7xX2w/1qhWWslROYa1ZlLL7peQsMErr0QS+HaG8h1dAObnb5M97Rw5tZH3x R8S1V824d5ql7RT8eS+V8CoVHlMNeodpCcjE0EwwRjUQ1fWuHxko4ZqAVkTXvQ7Xu7nl P3AMxHkSEj7xxzgUyJva5cv9qXIlPKFNFXm6GvTFeMfdThjUjCn2oZ2g9nN/iGGUzSpm o2Qg== 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=gD6K5HjH3knXITl7r4jvWivVU4olLzo4tXk/Xae5yjc=; b=cV28Du4uOQ9RPy60q0LxVFdrpnOroZSp4RH6cUAXqNnvGWJqZDn5ce9rc+18ICRUv4 oQniaHmV5cXjSAIFdcScdg3s/hykOWPLpeyP4cF+KfN72O5erImFgAFzdGXxFy2e2oJ3 Z9Q3lk/t1GFguXZrblP5EMte673DV4th866/rU0neILUmFRok3dClLsmIdIQSGDor1tw Wj9fOvfqR/anxU1nRkOLsmjFS3EVVNFa6OzW1tM2nLPfHeNxulL/rf5xKXbklnwletWf kv9TkJBigcVw6AINqctFIy/ma/mAko2Go01a+uRJO1Vgzs+cfXVDU3xfT2+7EffLYKFv JV1A== X-Gm-Message-State: AOAM533msvFkmgStR+Jh0xIpc+cdE9o5QLa3mEaic/pQ4e6Vex3Z92sw VT30GinwnKH5rotJfxP5s2A= X-Google-Smtp-Source: ABdhPJz1L93FyNNlbt8ptwykSOJsDefXnmFdbRRv7SMFCCX0IK/84Xepprkk5UKvXhPoDSflIi6tuA== X-Received: by 2002:a1c:203:: with SMTP id 3mr7377505wmc.128.1603882564870; Wed, 28 Oct 2020 03:56:04 -0700 (PDT) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id t6sm7176398wre.30.2020.10.28.03.56.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Oct 2020 03:56:04 -0700 (PDT) From: luca.boccassi@gmail.com To: Lukasz Wojciechowski Cc: David Hunt , dpdk stable Date: Wed, 28 Oct 2020 10:45:45 +0000 Message-Id: <20201028104606.3504127-186-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201028104606.3504127-1-luca.boccassi@gmail.com> References: <20201028104606.3504127-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'test/distributor: fix shutdown of busy worker' 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 10/30/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. Thanks. Luca Boccassi --- >From 6b792339111a059ebe146e9ea984628f94555958 Mon Sep 17 00:00:00 2001 From: Lukasz Wojciechowski Date: Sat, 17 Oct 2020 05:06:49 +0200 Subject: [PATCH] test/distributor: fix shutdown of busy worker [ upstream commit cf669d6930116b80493d67cdc5d7a1a568eed8e9 ] The sanity test with worker shutdown delegates all bufs to be processed by a single lcore worker, then it freezes one of the lcore workers and continues to send more bufs. The freezed core shuts down first by calling rte_distributor_return_pkt(). The test intention is to verify if packets assigned to the shut down lcore will be reassigned to another worker. However the shutdown core was not always the one, that was processing packets. The lcore processing mbufs might be different every time test is launched. This is caused by keeping the value of wkr static variable in rte_distributor_process() function between running test cases. Test freezed always lcore with 0 id. The patch stores the id of worker that is processing the data in zero_idx global atomic variable. This way the freezed lcore is always the proper one. Fixes: c3eabff124e6 ("distributor: add unit tests") Signed-off-by: Lukasz Wojciechowski Tested-by: David Hunt --- app/test/test_distributor.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c index 52230d2504..dcc4e76a9a 100644 --- a/app/test/test_distributor.c +++ b/app/test/test_distributor.c @@ -28,6 +28,7 @@ struct worker_params worker_params; static volatile int quit; /**< general quit variable for all threads */ static volatile int zero_quit; /**< var for when we just want thr0 to quit*/ static volatile unsigned worker_idx; +static volatile unsigned zero_idx; struct worker_stats { volatile unsigned handled_packets; @@ -340,26 +341,43 @@ handle_work_for_shutdown_test(void *arg) unsigned int total = 0; unsigned int i; unsigned int returned = 0; + unsigned int zero_id = 0; + unsigned int zero_unset; const unsigned int id = __atomic_fetch_add(&worker_idx, 1, __ATOMIC_RELAXED); num = rte_distributor_get_pkt(d, id, buf, NULL, 0); + if (num > 0) { + zero_unset = RTE_MAX_LCORE; + __atomic_compare_exchange_n(&zero_idx, &zero_unset, id, + 0, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE); + } + zero_id = __atomic_load_n(&zero_idx, __ATOMIC_ACQUIRE); + /* wait for quit single globally, or for worker zero, wait * for zero_quit */ - while (!quit && !(id == 0 && zero_quit)) { + while (!quit && !(id == zero_id && zero_quit)) { worker_stats[id].handled_packets += num; count += num; for (i = 0; i < num; i++) rte_pktmbuf_free(buf[i]); num = rte_distributor_get_pkt(d, id, buf, NULL, 0); + + if (num > 0) { + zero_unset = RTE_MAX_LCORE; + __atomic_compare_exchange_n(&zero_idx, &zero_unset, id, + 0, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE); + } + zero_id = __atomic_load_n(&zero_idx, __ATOMIC_ACQUIRE); + total += num; } worker_stats[id].handled_packets += num; count += num; returned = rte_distributor_return_pkt(d, id, buf, num); - if (id == 0) { + if (id == zero_id) { /* for worker zero, allow it to restart to pick up last packet * when all workers are shutting down. */ @@ -578,6 +596,7 @@ quit_workers(struct worker_params *wp, struct rte_mempool *p) rte_eal_mp_wait_lcore(); quit = 0; worker_idx = 0; + zero_idx = RTE_MAX_LCORE; } static int -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-10-28 10:35:17.482204903 +0000 +++ 0186-test-distributor-fix-shutdown-of-busy-worker.patch 2020-10-28 10:35:11.796834322 +0000 @@ -1,8 +1,10 @@ -From cf669d6930116b80493d67cdc5d7a1a568eed8e9 Mon Sep 17 00:00:00 2001 +From 6b792339111a059ebe146e9ea984628f94555958 Mon Sep 17 00:00:00 2001 From: Lukasz Wojciechowski Date: Sat, 17 Oct 2020 05:06:49 +0200 Subject: [PATCH] test/distributor: fix shutdown of busy worker +[ upstream commit cf669d6930116b80493d67cdc5d7a1a568eed8e9 ] + The sanity test with worker shutdown delegates all bufs to be processed by a single lcore worker, then it freezes one of the lcore workers and continues to send more bufs. @@ -23,7 +25,6 @@ variable. This way the freezed lcore is always the proper one. Fixes: c3eabff124e6 ("distributor: add unit tests") -Cc: stable@dpdk.org Signed-off-by: Lukasz Wojciechowski Tested-by: David Hunt @@ -32,7 +33,7 @@ 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c -index 52230d2504..6cd7a2edda 100644 +index 52230d2504..dcc4e76a9a 100644 --- a/app/test/test_distributor.c +++ b/app/test/test_distributor.c @@ -28,6 +28,7 @@ struct worker_params worker_params; @@ -57,7 +58,7 @@ + if (num > 0) { + zero_unset = RTE_MAX_LCORE; + __atomic_compare_exchange_n(&zero_idx, &zero_unset, id, -+ false, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE); ++ 0, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE); + } + zero_id = __atomic_load_n(&zero_idx, __ATOMIC_ACQUIRE); + @@ -74,7 +75,7 @@ + if (num > 0) { + zero_unset = RTE_MAX_LCORE; + __atomic_compare_exchange_n(&zero_idx, &zero_unset, id, -+ false, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE); ++ 0, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE); + } + zero_id = __atomic_load_n(&zero_idx, __ATOMIC_ACQUIRE); +