Commit 30bfdc9c authored by Qingmin Liu's avatar Qingmin Liu Committed by Darek Stojaczyk
Browse files

scripts/setup: Check that numa_node exists before reading



On non NUMA architectures the numa_node sysfs entry doesn't exist.
Check if it exists before reading to prevent an error causing 'status'
to fail.

Reviewed-by: default avatarQingmin Liu <qingmin.liu@broadcom.com>
Tested-by: default avatarJonathan Richardson <jonathan.richardson@broadcom.com>
Reviewed-by: default avatarJonathan Richardson <jonathan.richardson@broadcom.com>
Reviewed-by: default avatarScott Branden <scott.branden@broadcom.com>
Signed-off-by: default avatarJonathan Richardson <jonathan.richardson@broadcom.com>
Change-Id: Iacf5b062a4f5db5e049d2cfcff7c991d4ac5d3c3
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/448576


Reviewed-by: default avatarScott Branden <sbranden@gmail.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarQingmin Liu <calmarrow@gmail.com>
Reviewed-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 93984d25
Loading
Loading
Loading
Loading
+15 −3
Original line number Diff line number Diff line
@@ -487,7 +487,11 @@ function status_linux {
	echo -e "BDF\t\tVendor\tDevice\tNUMA\tDriver\t\tDevice name"
	for bdf in $(iter_all_pci_class_code 01 08 02); do
		driver=$(grep DRIVER /sys/bus/pci/devices/$bdf/uevent |awk -F"=" '{print $2}')
		if [ "$numa_nodes" = "0" ]; then
			node="-"
		else
			node=$(cat /sys/bus/pci/devices/$bdf/numa_node)
		fi
		device=$(cat /sys/bus/pci/devices/$bdf/device)
		vendor=$(cat /sys/bus/pci/devices/$bdf/vendor)
		if [ "$driver" = "nvme" -a -d /sys/bus/pci/devices/$bdf/nvme ]; then
@@ -508,7 +512,11 @@ function status_linux {
	for dev_id in $TMP; do
		for bdf in $(iter_all_pci_dev_id 8086 $dev_id); do
			driver=$(grep DRIVER /sys/bus/pci/devices/$bdf/uevent |awk -F"=" '{print $2}')
			if [ "$numa_nodes" = "0" ]; then
				node="-"
			else
				node=$(cat /sys/bus/pci/devices/$bdf/numa_node)
			fi
			device=$(cat /sys/bus/pci/devices/$bdf/device)
			vendor=$(cat /sys/bus/pci/devices/$bdf/vendor)
			echo -e "$bdf\t${vendor#0x}\t${device#0x}\t$node\t${driver:--}"
@@ -525,7 +533,11 @@ function status_linux {
	for dev_id in $TMP; do
		for bdf in $(iter_all_pci_dev_id 1af4 $dev_id); do
			driver=$(grep DRIVER /sys/bus/pci/devices/$bdf/uevent |awk -F"=" '{print $2}')
			if [ "$numa_nodes" = "0" ]; then
				node="-"
			else
				node=$(cat /sys/bus/pci/devices/$bdf/numa_node)
			fi
			device=$(cat /sys/bus/pci/devices/$bdf/device)
			vendor=$(cat /sys/bus/pci/devices/$bdf/vendor)
			blknames=''