setup.sh: Speed up the VMD device unbind by running in parallel.

If a VMD device present, add message to communicate to the user to use next steps.
Allow for DRIVER_OVERRIDE="none" to just unbind the driver without binding it to any other.

Fixes #2423

Signed-off-by: Samir Raval <samir.raval@intel.com>
Change-Id: Ifef6ed50dd619ce7629eabf458edd54e6bb22fa4
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12035
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Samir Raval 2022-03-24 16:37:50 +00:00 committed by Jim Harris
parent 6301f8915d
commit b0aba3fcd5

View File

@ -141,6 +141,10 @@ function linux_bind_driver() {
pci_dev_echo "$bdf" "$old_driver_name -> $driver_name" pci_dev_echo "$bdf" "$old_driver_name -> $driver_name"
if [[ $driver_name == "none" ]]; then
return 0
fi
echo "$ven_dev_id" > "/sys/bus/pci/drivers/$driver_name/new_id" 2> /dev/null || true echo "$ven_dev_id" > "/sys/bus/pci/drivers/$driver_name/new_id" 2> /dev/null || true
echo "$bdf" > "/sys/bus/pci/drivers/$driver_name/bind" 2> /dev/null || true echo "$bdf" > "/sys/bus/pci/drivers/$driver_name/bind" 2> /dev/null || true
@ -248,6 +252,17 @@ function collect_devices() {
if [[ $PCI_ALLOWED != *"$bdf"* ]]; then if [[ $PCI_ALLOWED != *"$bdf"* ]]; then
pci_dev_echo "$bdf" "Skipping not allowed VMD controller at $bdf" pci_dev_echo "$bdf" "Skipping not allowed VMD controller at $bdf"
in_use=1 in_use=1
elif [[ " ${drivers_d[*]} " =~ "nvme" ]]; then
if [[ "${DRIVER_OVERRIDE}" != "none" ]]; then
if [ "$mode" == "config" ]; then
cat <<- MESSAGE
Binding new driver to VMD device. If there are NVMe SSDs behind the VMD endpoint
which are attached to the kernel NVMe driver,the binding process may go faster
if you first run this script with DRIVER_OVERRIDE="none" to unbind only the
NVMe SSDs, and then run again to unbind the VMD devices."
MESSAGE
fi
fi
fi fi
fi fi
fi fi
@ -305,7 +320,9 @@ function configure_linux_pci() {
fi fi
fi fi
if [[ -n "${DRIVER_OVERRIDE}" ]]; then if [[ "${DRIVER_OVERRIDE}" == "none" ]]; then
driver_name=none
elif [[ -n "${DRIVER_OVERRIDE}" ]]; then
driver_path="$DRIVER_OVERRIDE" driver_path="$DRIVER_OVERRIDE"
driver_name="${DRIVER_OVERRIDE##*/}" driver_name="${DRIVER_OVERRIDE##*/}"
# modprobe and the sysfs don't use the .ko suffix. # modprobe and the sysfs don't use the .ko suffix.
@ -337,10 +354,12 @@ function configure_linux_pci() {
fi fi
# modprobe assumes the directory of the module. If the user passes in a path, we should use insmod # modprobe assumes the directory of the module. If the user passes in a path, we should use insmod
if [[ -n "$driver_path" ]]; then if [[ $driver_name != "none" ]]; then
insmod $driver_path || true if [[ -n "$driver_path" ]]; then
else insmod $driver_path || true
modprobe $driver_name else
modprobe $driver_name
fi
fi fi
for bdf in "${!all_devices_d[@]}"; do for bdf in "${!all_devices_d[@]}"; do