numam-spdk/lib
Darek Stojaczyk 49c12890aa env_dpdk/pci: remove thread safety from PCI APIs
For VMD driver we'll need to introduce some way of
iterating over all spdk pci device objects and we would
like to achieve that with simple spdk_pci_get_first_dev()/get_next_dev()
APIs. To make it thread safe though, we would have to
expose some public pci mutex to be locked around the
iteration and we don't want to do that, so we'll make
PCI APIs usable from only a single thread - this will
prevent any pci devices from being removed inbetween
subsequent get_first/get_next calls.

We currently have the following players accessing pci
device state:
 1) public APIs, obviously (on any thread right now)
 2) VFIO hotremove callback (dpdk interrupt thread)
 3) rte_eal_alarm for detaching rte_pci_devices (dpdk
    interrupt thread)
 4) DPDK hotplug IPC (dpdk interrupt thread)

There is g_pci_mutex providing the thread safety, but
even today it doesn't protect #3 and #4, making the
entire pci layer prone to data corruption.

To make #3 and #4 safe, we would have to lock inside
device init/fini callbacks (spdk_pci_device_init/fini),
but those are called directly inside the public device
attach/detach functions which already lock.

So now, with the decision to drop thread safety from
public pci APIs, we narrow down the locks inside public
functions and introduce locks inside those lower-level
init/fini callbacks.

Change-Id: I5dcbc9cdcbab65ee76cd3c42890f596069ec9a8a
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458930
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-06-26 08:24:02 +00:00
..
bdev bdev/compress: add RPC to specify PMD 2019-06-26 07:57:09 +00:00
blob blobstore: Cleanup after power failure while creating snapshot 2019-06-26 08:00:14 +00:00
blobfs blobfs: fix the semphore usage issue in spdk_file_read 2019-05-30 17:56:16 +00:00
conf string: spdk_strtol to delegate additional error checking 2019-01-29 00:10:57 +00:00
copy misc/rpc: rename some C functions of rpc methods 2019-05-07 05:30:16 +00:00
env_dpdk env_dpdk/pci: remove thread safety from PCI APIs 2019-06-26 08:24:02 +00:00
event nvmf/tcp: Use the success optimization by default 2019-06-26 06:24:03 +00:00
ftl lib/ftl: Band seq is restored from head md only 2019-06-26 07:09:00 +00:00
ioat ioat: allocate device struct using regular calloc 2019-04-09 06:30:42 +00:00
iscsi iscsi: Fix the bug to add wrong size in _iscsi_sgl_append_with_md 2019-06-19 07:38:46 +00:00
json json_util: fix typo in debug message. 2019-05-31 14:39:53 +00:00
jsonrpc lib/jsonrpc: Fix memory leaks about connection request. 2019-06-26 06:26:50 +00:00
log log: passing user-defined log 2019-06-18 03:56:50 +00:00
lvol lvol: Fix for lvol failed deletion flow 2019-04-02 19:23:22 +00:00
nbd nbd: optional nbd_device in start_nbd_disk 2019-04-04 08:35:50 +00:00
net net: Use spdk_json_write_named_* APIs throughout 2019-02-04 07:08:04 +00:00
notify lib/notify: rename spdk_notify_get_events to spdk_notify_foreach_event 2019-05-07 06:11:27 +00:00
nvme nvme: fix the endless loop of aborting trackers 2019-06-21 08:34:41 +00:00
nvmf nvmf/tcp: Use the success optimization by default 2019-06-26 06:24:03 +00:00
reduce reduce: check pmem buf before unmap 2019-06-25 13:39:09 +00:00
rocksdb rocksdb: cleanup SpdkInitializeThread/SpdkFinalizeThread 2019-05-02 09:00:43 +00:00
rpc rpc: rename RPC get_rpc_methods to rpc_get_methods 2019-05-27 12:52:53 +00:00
scsi scsi: Add data offset to DIF context separately from start block address 2019-06-11 18:53:58 +00:00
sock sock: fix a uninitialized-variable error 2019-05-08 21:24:13 +00:00
thread env: Add free_space parameter to spdk_ring_enqueue 2019-06-05 05:23:58 +00:00
trace trace: print error message if event name is too long 2019-05-02 08:41:56 +00:00
ut_mock thread: Eliminate use of pthread_self and thread_ids 2019-01-15 16:53:12 +00:00
util dif: Process unaligned data segment properly in DIF insert 2019-06-26 06:56:25 +00:00
vhost lib/vhost: Fix unaligned pointer value error 2019-06-17 07:18:48 +00:00
virtio lib/virtio: change the definition of cookie 2019-06-26 08:03:37 +00:00
vmd lib/vmd: Hooking devices behind VMD endpoint to PCI subsystem 2019-06-11 04:35:31 +00:00
Makefile vmd: Initial SPDK VMD baseline code 2019-05-30 17:32:43 +00:00