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 <james.r.harris@intel.com> Change-Id: I720d99118ba5e050f436612c9fd415db44294a63 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5275 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Mellanox Build Bot Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
parent
895ad89214
commit
a1280c9878
18
autotest.sh
18
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
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 \
|
||||
|
@ -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=$!
|
||||
|
@ -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}"
|
||||
|
@ -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}"
|
||||
|
@ -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
|
||||
|
@ -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}')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user