From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) by dpdk.org (Postfix) with ESMTP id F33D55B30 for ; Mon, 30 Jul 2018 18:17:56 +0200 (CEST) Received: from 1.general.paelzer.uk.vpn ([10.172.196.172] helo=lap.fritz.box) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1fkArN-00009D-8G; Mon, 30 Jul 2018 16:17:25 +0000 From: Christian Ehrhardt To: Yipeng Wang Cc: Pablo de Lara , dpdk stable Date: Mon, 30 Jul 2018 18:12:27 +0200 Message-Id: <20180730161342.16566-102-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180730161342.16566-1-christian.ehrhardt@canonical.com> References: <20180730161342.16566-1-christian.ehrhardt@canonical.com> Subject: [dpdk-stable] patch 'hash: fix a multi-writer race condition' has been queued to stable release 18.05.1 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: , X-List-Received-Date: Mon, 30 Jul 2018 16:17:57 -0000 Hi, FYI, your patch has been queued to stable release 18.05.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 08/01/18. So please shout if anyone has objections. Thanks. Christian Ehrhardt --- >>From 2d95ec64b377cb47f6d63249e47c9c48dd888631 Mon Sep 17 00:00:00 2001 From: Yipeng Wang 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 Acked-by: Pablo de Lara --- 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 2c5b017e3..981d7bdd6 100644 --- a/lib/librte_hash/rte_cuckoo_hash_x86.h +++ b/lib/librte_hash/rte_cuckoo_hash_x86.h @@ -66,6 +66,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.17.1