From a1280c9878d5e148024f871bccb5692e1114aff1 Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Wed, 25 Nov 2020 20:31:42 +0000 Subject: [PATCH] scripts: replace PCI_WHITELIST with PCI_ALLOWED Similarly replace PCI_BLACKLIST with PCI_BLOCKED. Use of ALLOWED/BLOCKED matches similar changes made in DPDK. While here, replace use of term "blacklist" with "blocked" in one of the nvme perf scripts. The usage there was associated with how devices are blocked by using the environment variables that are changed by this patch. Signed-off-by: Jim Harris Change-Id: I720d99118ba5e050f436612c9fd415db44294a63 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5275 Tested-by: SPDK CI Jenkins Community-CI: Mellanox Build Bot Reviewed-by: Shuhei Matsumoto Reviewed-by: Changpeng Liu --- autotest.sh | 18 +++++++++--------- doc/vmd.md | 4 ++-- scripts/common.sh | 22 +++++++++++----------- scripts/setup.sh | 26 +++++++++++++------------- test/external_code/test_make.sh | 4 ++-- test/ftl/ftl.sh | 6 +++--- test/nvme/cuse/nvme_ns_manage_cuse.sh | 2 +- test/nvme/cuse/spdk_nvme_cli_cuse.sh | 2 +- test/nvme/cuse/spdk_smartctl_cuse.sh | 2 +- test/nvme/perf/common.sh | 2 +- test/vmd/vmd.sh | 2 +- 11 files changed, 45 insertions(+), 45 deletions(-) diff --git a/autotest.sh b/autotest.sh index 3c911a7bd..cc990dffc 100755 --- a/autotest.sh +++ b/autotest.sh @@ -90,7 +90,7 @@ rm -f /var/tmp/spdk*.sock if [ $(uname -s) = Linux ]; then # OCSSD devices drivers don't support IO issues by kernel so - # detect OCSSD devices and blacklist them (unbind from any driver). + # detect OCSSD devices and block them (unbind from any driver). # If test scripts want to use this device it needs to do this explicitly. # # If some OCSSD device is bound to other driver than nvme we won't be able to @@ -100,26 +100,26 @@ if [ $(uname -s) = Linux ]; then # Send Open Channel 2.0 Geometry opcode "0xe2" - not supported by NVMe device. if nvme admin-passthru $dev --namespace-id=1 --data-len=4096 --opcode=0xe2 --read > /dev/null; then bdf="$(basename $(readlink -e /sys/class/nvme/${dev#/dev/}/device))" - echo "INFO: blacklisting OCSSD device: $dev ($bdf)" - PCI_BLACKLIST+=" $bdf" + echo "INFO: blocking OCSSD device: $dev ($bdf)" + PCI_BLOCKED+=" $bdf" OCSSD_PCI_DEVICES+=" $bdf" fi done < <(find /dev -maxdepth 1 -regex '/dev/nvme[0-9]+' -print0) export OCSSD_PCI_DEVICES - # Now, bind blacklisted devices to pci-stub module. This will prevent + # Now, bind blocked devices to pci-stub module. This will prevent # automatic grabbing these devices when we add device/vendor ID to # proper driver. - if [[ -n "$PCI_BLACKLIST" ]]; then + if [[ -n "$PCI_BLOCKED" ]]; then # shellcheck disable=SC2097,SC2098 - PCI_WHITELIST="$PCI_BLACKLIST" \ - PCI_BLACKLIST="" \ + PCI_ALLOWED="$PCI_BLOCKED" \ + PCI_BLOCKED="" \ DRIVER_OVERRIDE="pci-stub" \ ./scripts/setup.sh - # Export our blacklist so it will take effect during next setup.sh - export PCI_BLACKLIST + # Export our blocked list so it will take effect during next setup.sh + export PCI_BLOCKED fi fi diff --git a/doc/vmd.md b/doc/vmd.md index 6794ecc17..4cac5b0e0 100644 --- a/doc/vmd.md +++ b/doc/vmd.md @@ -47,11 +47,11 @@ $ 5d:05.5 RAID bus controller: Intel Corporation Device 201d (rev 04) $ d7:05.5 RAID bus controller: Intel Corporation Device 201d (rev 04) ``` -Run setup.sh script with VMD devices set in PCI_WHITELIST. +Run setup.sh script with VMD devices set in PCI_ALLOWED. Example: ``` -$ PCI_WHITELIST="0000:5d:05.5 0000:d7:05.5" scripts/setup.sh +$ PCI_ALLOWED="0000:5d:05.5 0000:d7:05.5" scripts/setup.sh ``` Check for available devices behind the VMD with spdk_lspci. diff --git a/scripts/common.sh b/scripts/common.sh index 56369ff84..d560107bf 100644 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -1,25 +1,25 @@ # Common shell utility functions -# Check if PCI device is on PCI_WHITELIST and not on PCI_BLACKLIST +# Check if PCI device is in PCI_ALLOWED and not in PCI_BLOCKED # Env: -# if PCI_WHITELIST is empty assume device is whitelistened -# if PCI_BLACKLIST is empty assume device is NOT blacklistened +# if PCI_ALLOWED is empty assume device is allowed +# if PCI_BLOCKED is empty assume device is NOT blocked # Params: # $1 - PCI BDF function pci_can_use() { local i # The '\ ' part is important - if [[ " $PCI_BLACKLIST " =~ \ $1\ ]]; then + if [[ " $PCI_BLOCKED " =~ \ $1\ ]]; then return 1 fi - if [[ -z "$PCI_WHITELIST" ]]; then - #no whitelist specified, bind all devices + if [[ -z "$PCI_ALLOWED" ]]; then + #no allow list specified, bind all devices return 0 fi - for i in $PCI_WHITELIST; do + for i in $PCI_ALLOWED; do if [ "$i" == "$1" ]; then return 0 fi @@ -135,7 +135,7 @@ iter_all_pci_sysfs() { fi } -# This function will ignore PCI PCI_WHITELIST and PCI_BLACKLIST +# This function will ignore PCI PCI_ALLOWED and PCI_BLOCKED function iter_all_pci_class_code() { local class local subclass @@ -167,7 +167,7 @@ function iter_all_pci_class_code() { fi } -# This function will ignore PCI PCI_WHITELIST and PCI_BLACKLIST +# This function will ignore PCI PCI_ALLOWED and PCI_BLOCKED function iter_all_pci_dev_id() { local ven_id local dev_id @@ -199,7 +199,7 @@ function iter_pci_dev_id() { done } -# This function will filter out PCI devices using PCI_WHITELIST and PCI_BLACKLIST +# This function will filter out PCI devices using PCI_ALLOWED and PCI_BLOCKED # See function pci_can_use() function iter_pci_class_code() { local bdf="" @@ -213,7 +213,7 @@ function iter_pci_class_code() { function nvme_in_userspace() { # Check used drivers. If it's not vfio-pci or uio-pci-generic - # then most likely PCI_WHITELIST option was used for setup.sh + # then most likely PCI_ALLOWED option was used for setup.sh # and we do not want to use that disk. local bdf bdfs diff --git a/scripts/setup.sh b/scripts/setup.sh index f8deba0a4..97ace9d97 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -59,16 +59,16 @@ function usage() { echo " setting is used." echo "CLEAR_HUGE If set to 'yes', the attempt to remove hugepages from all nodes will" echo " be made prior to allocation". - echo "PCI_WHITELIST" - echo "PCI_BLACKLIST Whitespace separated list of PCI devices (NVMe, I/OAT, VMD, Virtio)." + echo "PCI_ALLOWED" + echo "PCI_BLOCKED Whitespace separated list of PCI devices (NVMe, I/OAT, VMD, Virtio)." echo " Each device must be specified as a full PCI address." - echo " E.g. PCI_WHITELIST=\"0000:01:00.0 0000:02:00.0\"" - echo " To blacklist all PCI devices use a non-valid address." - echo " E.g. PCI_WHITELIST=\"none\"" - echo " If PCI_WHITELIST and PCI_BLACKLIST are empty or unset, all PCI devices" + echo " E.g. PCI_ALLOWED=\"0000:01:00.0 0000:02:00.0\"" + echo " To block all PCI devices use a non-valid address." + echo " E.g. PCI_BLOCKED=\"none\"" + echo " If PCI_ALLOWED and PCI_BLOCKED are empty or unset, all PCI devices" echo " will be bound." - echo " Each device in PCI_BLACKLIST will be ignored (driver won't be changed)." - echo " PCI_BLACKLIST has precedence over PCI_WHITELIST." + echo " Each device in PCI_BLOCKED will be ignored (driver won't be changed)." + echo " PCI_BLOCKED has precedence over PCI_ALLOWED." echo "TARGET_USER User that will own hugepage mountpoint directory and vfio groups." echo " By default the current user will be used." echo "DRIVER_OVERRIDE Disable automatic vfio-pci/uio_pci_generic selection and forcefully" @@ -235,7 +235,7 @@ function collect_devices() { fi fi if [[ $dev_type == vmd ]]; then - if [[ $PCI_WHITELIST != *"$bdf"* ]]; then + if [[ $PCI_ALLOWED != *"$bdf"* ]]; then pci_dev_echo "$bdf" "Skipping not allowed VMD controller at $bdf" in_use=1 fi @@ -717,15 +717,15 @@ if [ -z "$mode" ]; then fi : ${HUGEMEM:=2048} -: ${PCI_WHITELIST:=""} -: ${PCI_BLACKLIST:=""} +: ${PCI_ALLOWED:=""} +: ${PCI_BLOCKED:=""} if [ -n "$NVME_WHITELIST" ]; then - PCI_WHITELIST="$PCI_WHITELIST $NVME_WHITELIST" + PCI_ALLOWED="$PCI_ALLOWED $NVME_WHITELIST" fi if [ -n "$SKIP_PCI" ]; then - PCI_WHITELIST="none" + PCI_ALLOWED="none" fi if [ -z "$TARGET_USER" ]; then diff --git a/test/external_code/test_make.sh b/test/external_code/test_make.sh index a58b9a392..f9d145e0a 100755 --- a/test/external_code/test_make.sh +++ b/test/external_code/test_make.sh @@ -9,7 +9,7 @@ set -e SPDK_DIR=$1 # Skip all pci devices. These tests don't rely on them. -sudo PCI_WHITELIST="NONE" HUGEMEM="$HUGEMEM" $SPDK_DIR/scripts/setup.sh +sudo PCI_ALLOWED="NONE" HUGEMEM="$HUGEMEM" $SPDK_DIR/scripts/setup.sh make -C $SPDK_DIR clean $SPDK_DIR/configure --with-shared --without-isal --without-ocf --disable-asan @@ -61,4 +61,4 @@ run_test "external_run_tc6" $test_root/hello_world/hello_bdev --json $test_root/ make -C $test_root clean make -C $SPDK_DIR -j$(nproc) clean -sudo PCI_WHITELIST="NONE" HUGEMEM="$HUGEMEM" $SPDK_DIR/scripts/setup.sh reset +sudo PCI_ALLOWED="NONE" HUGEMEM="$HUGEMEM" $SPDK_DIR/scripts/setup.sh reset diff --git a/test/ftl/ftl.sh b/test/ftl/ftl.sh index a474e5656..9cd448836 100755 --- a/test/ftl/ftl.sh +++ b/test/ftl/ftl.sh @@ -9,7 +9,7 @@ rpc_py=$rootdir/scripts/rpc.py function at_ftl_exit() { # restore original driver - PCI_WHITELIST="$device" PCI_BLACKLIST="" DRIVER_OVERRIDE="$ocssd_original_dirver" $rootdir/scripts/setup.sh + PCI_ALLOWED="$device" PCI_BLOCKED="" DRIVER_OVERRIDE="$ocssd_original_dirver" $rootdir/scripts/setup.sh } read -r device _ <<< "$OCSSD_PCI_DEVICES" @@ -26,8 +26,8 @@ ocssd_original_dirver="$(basename $(readlink /sys/bus/pci/devices/$device/driver trap 'at_ftl_exit' SIGINT SIGTERM EXIT -# OCSSD is blacklisted so bind it to vfio/uio driver before testing -PCI_WHITELIST="$device" PCI_BLACKLIST="" DRIVER_OVERRIDE="" $rootdir/scripts/setup.sh +# OCSSD is blocked so bind it to vfio/uio driver before testing +PCI_ALLOWED="$device" PCI_BLOCKED="" DRIVER_OVERRIDE="" $rootdir/scripts/setup.sh # Use first regular NVMe disk (non-OC) as non-volatile cache nvme_disks=$($rootdir/scripts/gen_nvme.sh | jq -r \ diff --git a/test/nvme/cuse/nvme_ns_manage_cuse.sh b/test/nvme/cuse/nvme_ns_manage_cuse.sh index bb708cc47..1c4a80e44 100755 --- a/test/nvme/cuse/nvme_ns_manage_cuse.sh +++ b/test/nvme/cuse/nvme_ns_manage_cuse.sh @@ -88,7 +88,7 @@ $NVME_CMD delete-ns ${nvme_dev} -n 0xffffffff || true reset_nvme_if_aer_unsupported ${nvme_dev} sleep 1 -PCI_WHITELIST="${bdf}" $rootdir/scripts/setup.sh +PCI_ALLOWED="${bdf}" $rootdir/scripts/setup.sh $SPDK_BIN_DIR/spdk_tgt -m 0x3 & spdk_tgt_pid=$! diff --git a/test/nvme/cuse/spdk_nvme_cli_cuse.sh b/test/nvme/cuse/spdk_nvme_cli_cuse.sh index da3698c8a..2648b1375 100755 --- a/test/nvme/cuse/spdk_nvme_cli_cuse.sh +++ b/test/nvme/cuse/spdk_nvme_cli_cuse.sh @@ -16,7 +16,7 @@ rpc_py=$rootdir/scripts/rpc.py bdf=$(get_first_nvme_bdf) -PCI_WHITELIST="${bdf}" $rootdir/scripts/setup.sh reset +PCI_ALLOWED="${bdf}" $rootdir/scripts/setup.sh reset nvme_name=$(get_nvme_ctrlr_from_bdf ${bdf}) if [[ -z "$nvme_name" ]]; then echo "setup.sh failed bind kernel driver to ${bdf}" diff --git a/test/nvme/cuse/spdk_smartctl_cuse.sh b/test/nvme/cuse/spdk_smartctl_cuse.sh index 69532ae58..07d748508 100755 --- a/test/nvme/cuse/spdk_smartctl_cuse.sh +++ b/test/nvme/cuse/spdk_smartctl_cuse.sh @@ -10,7 +10,7 @@ rpc_py=$rootdir/scripts/rpc.py bdf=$(get_first_nvme_bdf) -PCI_WHITELIST="${bdf}" $rootdir/scripts/setup.sh reset +PCI_ALLOWED="${bdf}" $rootdir/scripts/setup.sh reset nvme_name=$(get_nvme_ctrlr_from_bdf ${bdf}) if [[ -z "$nvme_name" ]]; then echo "setup.sh failed bind kernel driver to ${bdf}" diff --git a/test/nvme/perf/common.sh b/test/nvme/perf/common.sh index 4aecb7bfb..31ce5c736 100755 --- a/test/nvme/perf/common.sh +++ b/test/nvme/perf/common.sh @@ -123,7 +123,7 @@ function get_numa_node() { for bdf in $disks; do local driver driver=$(grep DRIVER /sys/bus/pci/devices/$bdf/uevent | awk -F"=" '{print $2}') - # Use this check to ommit blacklisted devices ( not binded to driver with setup.sh script ) + # Use this check to omit blocked devices ( not bound to driver with setup.sh script ) if [ "$driver" = "vfio-pci" ] || [ "$driver" = "uio_pci_generic" ]; then cat /sys/bus/pci/devices/$bdf/numa_node fi diff --git a/test/vmd/vmd.sh b/test/vmd/vmd.sh index ba5156b77..dcd6c1729 100755 --- a/test/vmd/vmd.sh +++ b/test/vmd/vmd.sh @@ -55,7 +55,7 @@ for bdf in $(iter_pci_dev_id 8086 $vmd_id); do VMD_WHITELIST+=("$bdf") fi done -PCI_WHITELIST="${VMD_WHITELIST[*]}" $rootdir/scripts/setup.sh +PCI_ALLOWED="${VMD_WHITELIST[*]}" $rootdir/scripts/setup.sh pci_devs=$($SPDK_BIN_DIR/spdk_lspci | grep "NVMe disk behind VMD" | awk '{print $1}')