Commit b86184c5 authored by Michal Berger's avatar Michal Berger Committed by Jim Harris
Browse files

test/vhost: Add cpu gen wrapper around conf-generator



The goal here is to not use a static cpu configuration in vhost
tests, but rather determine it dynamically based on the underlying
topology.

Also, change vm[N]_node override var to VM[N]_NODE as existing
implementation didn't really allow the user to override the node
this way (since it was explicitly set by the conf-generator while
constructing initial NUMA-aware setup).

Change-Id: I791afaa8ebbd77de85d1e29c2fa43d442c22cac8
Signed-off-by: default avatarMichal Berger <michal.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/21420


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
parent 92244508
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -83,7 +83,7 @@ get_auto_cfg() {
		# all available nodes. If no cpus are left, fail. We don't allow to mix
		# cpus from different nodes for the sake of the performance.
		node_idx=0 node_idx_perc=0
		eval "vm_node=\$vm${vm}_node"
		eval "vm_node=\${VM${vm}_NODE:-\$vm${vm}_node}"

		local -n node_cpus=node_${vm_node}_cpu
		local -n vm_nodes=node_${vm_node}_vm
@@ -333,7 +333,7 @@ help() {
		vms_per_nvme  - Number of VMs to pin to a single nvme (default: 1)

		Override parameters:
		vmN_node      - overrides selected NUMA node for VM N - by default,
		VM[N]_NODE    - overrides selected NUMA node for VM N - by default,
		                this is allocated up to number of nvme drives
		cpu_out       - with -s, points at location where to save cpu conf
		disk_out      - with -s, points at location where to save disk conf
+25 −0
Original line number Diff line number Diff line
@@ -1447,3 +1447,28 @@ function limit_vhost_kernel_threads() {
		move_proc "$pid" "$cgroup/vhost" "$cgroup" cgroup.threads
	done
}

function gen_cpu_vm_spdk_config() (
	local vm_count=$1 vm_cpu_num=$2 vm
	local spdk_cpu_num=${3:-1} spdk_cpu_list=${4:-} spdk_cpus
	local nodes=("${@:5}") node
	local env

	spdk_cpus=spdk_cpu_num
	[[ -n $spdk_cpu_list ]] && spdk_cpus=spdk_cpu_list

	if ((${#nodes[@]} > 0)); then
		((${#nodes[@]} == 1)) && node=${nodes[0]}
		for ((vm = 0; vm < vm_count; vm++)); do
			env+=("VM${vm}_NODE=${nodes[vm]:-$node}")
		done
	fi

	env+=("$spdk_cpus=${!spdk_cpus}")
	env+=("vm_count=$vm_count")
	env+=("vm_cpu_num=$vm_cpu_num")

	export "${env[@]}"

	"$rootdir/scripts/perf/vhost/conf-generator" -p cpu
)