numam-dpdk/lib
Fei Chen 9944bddf80 vhost: fix vid allocation race
vhost_new_device might be called in different threads at
the same time.

thread 1(config thread)
            rte_vhost_driver_start
               ->vhost_user_start_client
                   ->vhost_user_add_connection
                     -> vhost_new_device

thread 2(vhost-events)
	vhost_user_read_cb
           ->vhost_user_msg_handler (return value < 0)
             -> vhost_user_start_client
                 -> vhost_new_device

So there could be a case that a same vid has been allocated
twice, or some vid might be lost in DPDK lib however still
held by the upper applications.

Another place where race would happen is at the func
*vhost_destroy_device*, but after a detailed investigation,
the race does not exist as long as no two devices have the
same vid: Calling vhost_destroy_devices in different
threads with different vids is actually safe.

Fixes: a277c71598 ("vhost: refactor code structure")
Cc: stable@dpdk.org

Reported-by: Peng He <hepeng.0320@bytedance.com>
Signed-off-by: Fei Chen <chenwei.0515@bytedance.com>
Reviewed-by: Zhihong Wang <wangzhihong.wzh@bytedance.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
2021-02-04 18:19:36 +01:00
..
librte_acl build: remove library name from version map file name 2020-10-19 22:13:59 +02:00
librte_bbdev build: remove library name from version map file name 2020-10-19 22:13:59 +02:00
librte_bitratestats bitrate: fix missing header include 2021-01-21 10:27:44 +01:00
librte_bpf build: force pkg-config for dependency detection 2021-01-26 00:43:59 +01:00
librte_cfgfile build: remove library name from version map file name 2020-10-19 22:13:59 +02:00
librte_cmdline cmdline: avoid name clash with Windows system types 2020-11-05 17:49:00 +01:00
librte_compressdev lib: fix doxygen for parameters of function pointers 2021-01-29 15:58:06 +01:00
librte_cryptodev lib: fix doxygen for parameters of function pointers 2021-01-29 15:58:06 +01:00
librte_distributor build: remove library name from version map file name 2020-10-19 22:13:59 +02:00
librte_eal mem: fix deadlock on secondary allocation 2021-01-30 00:26:49 +01:00
librte_efd efd: fix tailq entry leak in error path 2020-10-22 22:07:15 +02:00
librte_ethdev ethdev: add MPLS RSS offload type 2021-01-29 18:16:08 +01:00
librte_eventdev eventdev: make driver-only headers private 2021-01-29 20:59:09 +01:00
librte_fib fib: fix missing header includes 2021-01-21 10:27:47 +01:00
librte_flow_classify build: remove library name from version map file name 2020-10-19 22:13:59 +02:00
librte_graph build: standardize component names and defines 2020-10-19 22:15:34 +02:00
librte_gro gro: fix packet type detection with IPv6 tunnel 2020-11-14 10:56:30 +01:00
librte_gso gso: support VXLAN UDP/IPv4 2021-01-15 11:31:28 +01:00
librte_hash build: add header includes check 2021-01-29 20:59:37 +01:00
librte_ip_frag ip_frag: remove padding length of fragment 2021-01-15 11:31:28 +01:00
librte_ipsec build: add header includes check 2021-01-29 20:59:37 +01:00
librte_jobstats build: remove library name from version map file name 2020-10-19 22:13:59 +02:00
librte_kni build: align wording of non-support reasons 2020-11-20 16:05:35 +01:00
librte_kvargs build: remove library name from version map file name 2020-10-19 22:13:59 +02:00
librte_latencystats latency: switch Rx timestamp to dynamic mbuf field 2020-11-03 16:21:15 +01:00
librte_lpm build: add header includes check 2021-01-29 20:59:37 +01:00
librte_mbuf mbuf: fix missing header include 2021-01-21 10:21:40 +01:00
librte_member build: remove library name from version map file name 2020-10-19 22:13:59 +02:00
librte_mempool build: remove library name from version map file name 2020-10-19 22:13:59 +02:00
librte_meter build: remove library name from version map file name 2020-10-19 22:13:59 +02:00
librte_metrics build: force pkg-config for dependency detection 2021-01-26 00:43:59 +01:00
librte_net net: fix missing header include 2021-01-21 10:21:40 +01:00
librte_node node: fix missing header include 2021-01-21 10:27:47 +01:00
librte_pci build: remove library name from version map file name 2020-10-19 22:13:59 +02:00
librte_pdump pdump: cleanup logs and variables 2021-01-19 15:24:46 +01:00
librte_pipeline pipeline: fix missing header includes 2021-01-21 10:27:47 +01:00
librte_port lib: fix doxygen for parameters of function pointers 2021-01-29 15:58:06 +01:00
librte_power power: fix missing header includes 2021-01-29 20:59:09 +01:00
librte_rawdev lib: fix doxygen for parameters of function pointers 2021-01-29 15:58:06 +01:00
librte_rcu rcu: use EAL memory barrier API 2021-01-11 15:34:21 +01:00
librte_regexdev build: add header includes check 2021-01-29 20:59:37 +01:00
librte_reorder reorder: switch sequence number to dynamic mbuf field 2020-10-31 22:14:30 +01:00
librte_rib rib: fix missing header include 2021-01-29 20:59:09 +01:00
librte_ring build: add header includes check 2021-01-29 20:59:37 +01:00
librte_sched build: remove library name from version map file name 2020-10-19 22:13:59 +02:00
librte_security lib: fix doxygen for parameters of function pointers 2021-01-29 15:58:06 +01:00
librte_stack build: add header includes check 2021-01-29 20:59:37 +01:00
librte_table build: add header includes check 2021-01-29 20:59:37 +01:00
librte_telemetry telemetry: fix missing header include 2021-01-21 10:21:40 +01:00
librte_timer build: remove library name from version map file name 2020-10-19 22:13:59 +02:00
librte_vhost vhost: fix vid allocation race 2021-02-04 18:19:36 +01:00
meson.build build: add header includes check 2021-01-29 20:59:37 +01:00