Spdk/lib/env_dpdk
Darek Stojaczyk 814072fa4e env_dpdk/pci: delay device initialization on hotplug
A workaround for kernel deadlocks surfaced in #1275.

DPDK basically offers two APIs for hotplugging all PCI devices:
rte_bus_scan() and rte_bus_probe(). Scan iterates through
/sys/bus/pci/devices/* and creates corresponding rte_pci_device-s,
then rte_bus_probe() tries to initialize each device with the
supporting driver.

Previously we did scan and probe together, one after another, now
we'll have an intermediate step. After scanning the bus, we'll
iterate through all rte_pci_device-s and temporarily blacklist any
newly detected devices. We'll use devargs->data field to a store
a timeout value (integer) after which the device can be un-blacklisted
and initialized. devargs->data is documented in DPDK as "Device
string storage" and it's a char*, but it's not referenced anywhere
in DPDK. rte_bus_probe() respects the blacklist and doesn't do
absolutely anything with blacklisted ones.

The timeout value is 2 seconds, which should be plenty enough
for an NVMe device to reset, leave the critical lock sections in
kernel, and let us initialize it safely.

Note that direct attach by BDF doesn't respect the blacklist,
so an NVMe attach RPC won't be delayed in any way, it will continue
to work as it always did. Only the automatic discovery & enumeration
is deferred.

Change-Id: I62b719271bd0755bc2882331ea33f69897b1e5e5
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1733
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-07-23 20:48:47 +00:00
..
env_internal.h env_dpdk: drop DPDK 18.08 support 2020-07-23 20:48:47 +00:00
env.c env_dpdk: drop DPDK 18.08 support 2020-07-23 20:48:47 +00:00
env.mk dpdkbuild: build and link with rte_hash if RAID5 is built 2020-03-18 08:02:43 +00:00
init.c env_dpdk: drop DPDK 18.08 support 2020-07-23 20:48:47 +00:00
Makefile env_dpdk: expose base virtaddr as an option 2020-06-16 07:45:07 +00:00
memory.c env_dpdk: drop DPDK 18.08 support 2020-07-23 20:48:47 +00:00
pci_idxd.c lib/idxd: add low level idxd library 2020-04-23 15:48:32 +00:00
pci_ioat.c lib/env_dpdk: remove spdk prefix from internal functions. 2020-04-22 09:21:55 +00:00
pci_nvme.c env_dpdk: drop DPDK 18.08 support 2020-07-23 20:48:47 +00:00
pci_virtio.c env_dpdk: drop DPDK 18.08 support 2020-07-23 20:48:47 +00:00
pci_vmd.c env_dpdk: drop DPDK 18.08 support 2020-07-23 20:48:47 +00:00
pci.c env_dpdk/pci: delay device initialization on hotplug 2020-07-23 20:48:47 +00:00
spdk_env_dpdk.map module/idxd: accel framework plug-in for idxd 2020-04-23 15:48:32 +00:00
threads.c env: drop DPDK 16.07 support 2018-11-30 19:59:34 +00:00