hash: fix a multi-writer race condition
authorYipeng Wang <yipeng1.wang@intel.com>
Tue, 10 Jul 2018 16:59:55 +0000 (09:59 -0700)
committerThomas Monjalon <thomas@monjalon.net>
Thu, 12 Jul 2018 21:03:20 +0000 (23:03 +0200)
commiteb067d431d9411a0054bc3ec084b0e9eadbb0a16
tree452ca1c3e616bd1f3f8c07b29e67d76ca76358ca
parent27c813679ea961b94d3184c09e50a055ad726da3
hash: fix a multi-writer race condition

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")
Cc: stable@dpdk.org
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