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 ACD27A04DB for ; Mon, 30 Nov 2020 12:50:35 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 612414C93; Mon, 30 Nov 2020 12:50:34 +0100 (CET) Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) by dpdk.org (Postfix) with ESMTP id BC9A64C93 for ; Mon, 30 Nov 2020 12:50:33 +0100 (CET) Received: by mail-wm1-f43.google.com with SMTP id c198so18167150wmd.0 for ; Mon, 30 Nov 2020 03:50:33 -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=T4xKaM7ftcOnjx2m7mYIbroMSrGGC7LsDj7dNk3w13A=; b=k3EfMz5/EF1Nx2H9nJ2jJXRmkNxTDZ3X3TE9RWCyX83I9gFhjr2rjQnG0Xriks0YQU BKN4jgCT4gZkOb9kCbIYHpatieo4JmSGVluUk/rAlItkzuZ1Wa/8j2cd4k8kH/NX/Ixz eNIfLzyoUXebrlkUA4TYQPm1yL0UrPXRqrjDdSV/Z4gdYwnsHPAR/cb2hmG7cKWdd2KZ tldo6FHTVjC4Lo8bv9ZYJRkT00rgy2EyVmGWbw3zal12eTvAk7GT3YQ5cK2Xfn+93T93 +sW7xp1JU4fXBKt2v3AH7PJlZnd57kr03Mm5lqhs9aD5/dNYCXo9qssSxRCBCr1zmJN8 X1PQ== 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=T4xKaM7ftcOnjx2m7mYIbroMSrGGC7LsDj7dNk3w13A=; b=Wc0R+/OMQKwmMhYyKvaEC8bP55rbsH8iJ+anGUBP2A+gwqklHnxrs7HWLV56kt7Hwo igBLsM2exAnsXZsCL7DfM2UefkrDzob7iDr3psEQAT8DMvyMSI3+RpEm8Pcey3fEkgIx tkkmo9ZzkGtIZxyCV8U/YtZPW4gy0/dBkL1R/KVQbYq2ItT/LgjZwm7gODWKs49XBuhm MkkPzq4QRSi6jIlH3YlNr2T5SMYRaOWH/pN5qch8gZ0cdfCSnsTAX7yMzxN3xxYRVByn WHohbicSQ5/Zvph5Me+j2RFX+DcVnNjxg1IB4MZUtbLR+KhoI5ybcH1z5Mlg86Eegi46 TCtQ== X-Gm-Message-State: AOAM530o+pmFReQC91edeDCWRvv13RYIHsIhkAS3oQBKOb/qtxI4k+TU QhImot8KBw6CXZuJPObMGJw= X-Google-Smtp-Source: ABdhPJxVdJLUqiV/MNdskQyopbFfwbZNArjiuR+YoHIiBrsDOw+qhyeYTX4Aw0Or8FGnoawhvkEN7g== X-Received: by 2002:a05:600c:2308:: with SMTP id 8mr5413143wmo.188.1606737032369; Mon, 30 Nov 2020 03:50:32 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id o21sm29240183wra.40.2020.11.30.03.50.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2020 03:50:31 -0800 (PST) From: luca.boccassi@gmail.com To: Diogo Behrens Cc: Honnappa Nagarahalli , dpdk stable Date: Mon, 30 Nov 2020 11:50:19 +0000 Message-Id: <20201130115027.64046-1-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.27.0 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 'mcslock: fix hang in weak memory model' 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 12/02/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/22023fd68b0f0fff0c4a2fefcd3c33b5a941a5d7 Thanks. Luca Boccassi --- >From 22023fd68b0f0fff0c4a2fefcd3c33b5a941a5d7 Mon Sep 17 00:00:00 2001 From: Diogo Behrens Date: Wed, 26 Aug 2020 11:20:02 +0200 Subject: [PATCH] mcslock: fix hang in weak memory model [ upstream commit 021b698eb56e48009d74d818bea5a9bdad4f54fa ] The initialization me->locked=1 in lock() must happen before next->locked=0 in unlock(), otherwise a thread may hang forever, waiting me->locked become 0. On weak memory systems (such as ARMv8), the current implementation allows me->locked=1 to be reordered with announcing the node (pred->next=me) and, consequently, to be reordered with next->locked=0 in unlock(). This fix adds a release barrier to pred->next=me, forcing me->locked=1 to happen before this operation. Fixes: 2173f3333b61 ("mcslock: add MCS queued lock implementation") Signed-off-by: Diogo Behrens Acked-by: Honnappa Nagarahalli --- lib/librte_eal/common/include/generic/rte_mcslock.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/common/include/generic/rte_mcslock.h b/lib/librte_eal/common/include/generic/rte_mcslock.h index 2bef28351c..ce553f5475 100644 --- a/lib/librte_eal/common/include/generic/rte_mcslock.h +++ b/lib/librte_eal/common/include/generic/rte_mcslock.h @@ -68,7 +68,14 @@ rte_mcslock_lock(rte_mcslock_t **msl, rte_mcslock_t *me) */ return; } - __atomic_store_n(&prev->next, me, __ATOMIC_RELAXED); + /* The store to me->next above should also complete before the node is + * visible to predecessor thread releasing the lock. Hence, the store + * prev->next also requires release semantics. Note that, for example, + * on ARM, the release semantics in the exchange operation is not + * strong as a release fence and is not sufficient to enforce the + * desired order here. + */ + __atomic_store_n(&prev->next, me, __ATOMIC_RELEASE); /* The while-load of me->locked should not move above the previous * store to prev->next. Otherwise it will cause a deadlock. Need a -- 2.27.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-11-30 11:49:30.431485317 +0000 +++ 0001-mcslock-fix-hang-in-weak-memory-model.patch 2020-11-30 11:49:30.382271364 +0000 @@ -1 +1 @@ -From 021b698eb56e48009d74d818bea5a9bdad4f54fa Mon Sep 17 00:00:00 2001 +From 22023fd68b0f0fff0c4a2fefcd3c33b5a941a5d7 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 021b698eb56e48009d74d818bea5a9bdad4f54fa ] + @@ -17 +18,0 @@ -Cc: stable@dpdk.org @@ -22 +23 @@ - lib/librte_eal/include/generic/rte_mcslock.h | 9 ++++++++- + lib/librte_eal/common/include/generic/rte_mcslock.h | 9 ++++++++- @@ -25,5 +26,5 @@ -diff --git a/lib/librte_eal/include/generic/rte_mcslock.h b/lib/librte_eal/include/generic/rte_mcslock.h -index 78b0df295e..d370bef17a 100644 ---- a/lib/librte_eal/include/generic/rte_mcslock.h -+++ b/lib/librte_eal/include/generic/rte_mcslock.h -@@ -64,7 +64,14 @@ rte_mcslock_lock(rte_mcslock_t **msl, rte_mcslock_t *me) +diff --git a/lib/librte_eal/common/include/generic/rte_mcslock.h b/lib/librte_eal/common/include/generic/rte_mcslock.h +index 2bef28351c..ce553f5475 100644 +--- a/lib/librte_eal/common/include/generic/rte_mcslock.h ++++ b/lib/librte_eal/common/include/generic/rte_mcslock.h +@@ -68,7 +68,14 @@ rte_mcslock_lock(rte_mcslock_t **msl, rte_mcslock_t *me)