Commit 798ad0fb authored by Tomasz Zawadzki's avatar Tomasz Zawadzki Committed by Ben Walker
Browse files

test/scheduler: reorder checks in interrupt test for debugging



Related to #1950
In the issue, CPU idle time measured from /proc/stats make it
seem like no reactor goes idle.

If true, then it would help for debugging to check stats from reactors.
Their busy/idle time and number of threads on them.

This patch reorders the checks in interrupt test,
to first show reactor stats, then confirm with idle time from
/proc/stats.

Signed-off-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ia1770833828ef688110473e45ed5998d213059f3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8223


Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarPaul Luse <paul.e.luse@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 57a2f03e
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -80,6 +80,12 @@ interrupt() {
	cpus_to_collect=("${cpus[@]}")
	collect_cpu_idle

	# Verify that each cpu, except the main cpu, has no threads assigned
	reactor_framework=$(rpc_cmd framework_get_reactors | jq -r '.reactors[]')
	for cpu in "${cpus[@]:1}"; do
		[[ -z $(jq -r "select(.lcore == $cpu) | .lw_threads[].id" <<< "$reactor_framework") ]]
	done

	# Standard scenario - spdk app is idle, all cpus, except the main cpu, should be
	# switched into interrupt mode. main cpu should remain busy, all remaining cpus
	# should become idle.
@@ -92,12 +98,6 @@ interrupt() {
		fi
	done

	# While cpus are still idle, verify that each cpu, except the main cpu, has no threads assigned
	reactor_framework=$(rpc_cmd framework_get_reactors | jq -r '.reactors[]')
	for cpu in "${cpus[@]:1}"; do
		[[ -z $(jq -r "select(.lcore == $cpu) | .lw_threads[].id" <<< "$reactor_framework") ]]
	done

	# select 3 cpus except the main one
	busy_cpus=("${cpus[@]:1:3}") threads=()

@@ -106,9 +106,9 @@ interrupt() {
	for cpu in "${busy_cpus[@]}"; do
		threads[cpu]=$(create_thread -n "thread$cpu" -m "$(mask_cpus "$cpu")" -a 100) cpus_to_collect=("$cpu")
		collect_cpu_idle
		((is_idle[cpu] == 0))
		reactor_framework=$(rpc_cmd framework_get_reactors | jq -r '.reactors[]')
		[[ -n $(jq -r "select(.lcore == $cpu) | .lw_threads[] | select(.name == \"thread$cpu\")" <<< "$reactor_framework") ]]
		((is_idle[cpu] == 0))
	done

	# Make all the threads idle and verify if their cpus have become idle as well and if they were
@@ -118,10 +118,10 @@ interrupt() {
		cpus_to_collect=("$cpu")
		# Give some extra time for the cpu to spin down
		collect_cpu_idle 10
		((is_idle[cpu] == 1))
		reactor_framework=$(rpc_cmd framework_get_reactors | jq -r '.reactors[]')
		[[ -z $(jq -r "select(.lcore == $cpu) | .lw_threads[].id" <<< "$reactor_framework") ]]
		[[ -n $(jq -r "select(.lcore == $spdk_main_core) | .lw_threads[] | select(.name == \"thread$cpu\")" <<< "$reactor_framework") ]]
		((is_idle[cpu] == 1))
	done

	for cpu in "${!threads[@]}"; do