[dpdk-dev] [PATCH v1] hash: add tsx support for cuckoo hash

Stephen Hemminger stephen at networkplumber.org
Sat May 7 06:56:32 CEST 2016


On Fri,  6 May 2016 21:05:02 +0100
Shen Wei <wei1.shen at intel.com> wrote:

> --- a/lib/librte_hash/rte_cuckoo_hash.c
> +++ b/lib/librte_hash/rte_cuckoo_hash.c
> @@ -1,7 +1,7 @@
>  /*-
>   *   BSD LICENSE
>   *
> - *   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
> + *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
>   *   All rights reserved.
>   *
>   *   Redistribution and use in source and binary forms, with or without
> @@ -100,7 +100,9 @@ EAL_REGISTER_TAILQ(rte_hash_tailq)
>  
>  #define KEY_ALIGNMENT			16
>  
> -#define LCORE_CACHE_SIZE		8
> +#define LCORE_CACHE_SIZE		64
> +
> +#define RTE_HASH_BFS_QUEUE_MAX_LEN  5000
>  
>  #if defined(RTE_ARCH_X86) || defined(RTE_ARCH_ARM64)
>  /*
> @@ -190,6 +192,7 @@ struct rte_hash {
>  							memory support */
>  	struct lcore_cache *local_free_slots;
>  	/**< Local cache per lcore, storing some indexes of the free slots */
> +	uint8_t multiwrite_add; /**< Multi-write safe hash add behavior */
>  } __rte_cache_aligned;
>  

I like the idea of using TSX to allow multi-writer safety, but there are
several problems with this patch.

1) It changes ABI, so it breaks old programs
2) What about older processors, need to detect and handle them at runtime.
3) Why can't this just be the default behavior with correct
   fallback to locking on older processors.

Actually lock ellision in DPDK is an interesting topic in general that
needs to be addressed.


More information about the dev mailing list