patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Yongseok Koh <yskoh@mellanox.com>
To: Yipeng Wang <yipeng1.wang@intel.com>
Cc: Pablo de Lara <pablo.de.lara.guarch@intel.com>,
	dpdk stable <stable@dpdk.org>
Subject: [dpdk-stable] patch 'hash: fix a multi-writer race condition' has been queued to LTS release 17.11.4
Date: Thu, 26 Jul 2018 19:27:41 -0700	[thread overview]
Message-ID: <20180727022746.38457-5-yskoh@mellanox.com> (raw)
In-Reply-To: <20180727022746.38457-1-yskoh@mellanox.com>

Hi,

FYI, your patch has been queued to LTS release 17.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 07/28/18. So please
shout if anyone has objections.

Thanks.

Yongseok

---
>From dabc158fbd4a9d581811dce0e5a7272452ba7f9e Mon Sep 17 00:00:00 2001
From: Yipeng Wang <yipeng1.wang@intel.com>
Date: Tue, 10 Jul 2018 09:59:55 -0700
Subject: [PATCH] hash: fix a multi-writer race condition

[ upstream commit eb067d431d9411a0054bc3ec084b0e9eadbb0a16 ]

Current multi-writer implementation uses Intel TSX to
protect the cuckoo path moving but not the cuckoo
path searching. After searching, we need to verify again if
the same empty slot still exists at the beginning of the TSX
region. Otherwise another writer could occupy the empty slot
before the TSX region. Current code does not verify.

Fixes: be856325cba3 ("hash: add scalable multi-writer insertion with Intel TSX")

Signed-off-by: Yipeng Wang <yipeng1.wang@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 lib/librte_hash/rte_cuckoo_hash_x86.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/librte_hash/rte_cuckoo_hash_x86.h b/lib/librte_hash/rte_cuckoo_hash_x86.h
index 0c94244a6..a2f1663ec 100644
--- a/lib/librte_hash/rte_cuckoo_hash_x86.h
+++ b/lib/librte_hash/rte_cuckoo_hash_x86.h
@@ -95,6 +95,9 @@ rte_hash_cuckoo_move_insert_mw_tm(const struct rte_hash *h,
 	while (try < RTE_HASH_TSX_MAX_RETRY) {
 		status = rte_xbegin();
 		if (likely(status == RTE_XBEGIN_STARTED)) {
+			/* In case empty slot was gone before entering TSX */
+			if (curr_bkt->key_idx[curr_slot] != EMPTY_SLOT)
+				rte_xabort(RTE_XABORT_CUCKOO_PATH_INVALIDED);
 			while (likely(curr_node->prev != NULL)) {
 				prev_node = curr_node->prev;
 				prev_bkt = prev_node->bkt;
-- 
2.11.0

  parent reply	other threads:[~2018-07-27  2:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-27  2:27 [dpdk-stable] patch 'mk: fix cross build' " Yongseok Koh
2018-07-27  2:27 ` [dpdk-stable] patch 'bus/dpaa: fix phandle support for Linux 4.16' " Yongseok Koh
2018-07-27  2:27 ` [dpdk-stable] patch 'bus/dpaa: fix buffer offset setting in FMAN' " Yongseok Koh
2018-07-27  2:27 ` [dpdk-stable] patch 'hash: fix multiwriter lock memory allocation' " Yongseok Koh
2018-07-27  2:27 ` Yongseok Koh [this message]
2018-07-27  2:27 ` [dpdk-stable] patch 'hash: fix key slot size accuracy' " Yongseok Koh
2018-07-27  2:27 ` [dpdk-stable] patch 'eal: fix return codes on thread naming failure' " Yongseok Koh
2018-07-27  2:27 ` [dpdk-stable] patch 'eal/linux: fix invalid syntax in interrupts' " Yongseok Koh
2018-07-27  2:27 ` [dpdk-stable] patch 'eal/linux: fix uninitialized value' " Yongseok Koh
2018-07-27  2:27 ` [dpdk-stable] patch 'vfio: fix PCI address comparison' " Yongseok Koh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180727022746.38457-5-yskoh@mellanox.com \
    --to=yskoh@mellanox.com \
    --cc=pablo.de.lara.guarch@intel.com \
    --cc=stable@dpdk.org \
    --cc=yipeng1.wang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).