Commit 9dad1237 authored by Michal Berger's avatar Michal Berger Committed by Tomasz Zawadzki
Browse files

test/nvme/sw_hotplug: Use timing_cmd to debug hotplug events

This is done to keep track of how much time it takes for the
sw_hotplug to finish its tests depending on how many drives
are attached to hotplug.

Due to the https://review.spdk.io/gerrit/c/spdk/spdk/+/18078

 the
time to wait for each set of hotplug events is adjusted based on
the number of drives which means that each drive will add an extra
overhead - currently, this makes these tests to run for almost 2m
with just a single drive.

Debugging this process will help to adjust these tests in the future
if needed.

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


Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
parent 6c1f8e80
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -10,6 +10,14 @@ source $rootdir/test/common/autotest_common.sh

# Pci bus hotplug
# Helper function to remove/attach cotrollers
debug_remove_attach_helper() {
	local helper_time=0

	helper_time=$(timing_cmd remove_attach_helper "$@")
	printf 'remove_attach_helper took %ss to complete (handling %u nvme drive(s))' \
		"$helper_time" "$nvme_count" >&2
}

remove_attach_helper() {
	local hotplug_events=$1
	local hotplug_wait=$2
@@ -64,7 +72,7 @@ run_hotplug() {
		-l warning &
	hotplug_pid=$!

	remove_attach_helper "$hotplug_events" "$hotplug_wait" false
	debug_remove_attach_helper "$hotplug_events" "$hotplug_wait" false

	# Wait in case hotplug app is lagging behind
	# and kill it, if it hung.
@@ -99,12 +107,12 @@ tgt_run_hotplug() {

	rpc_cmd bdev_nvme_set_hotplug -e

	remove_attach_helper "$hotplug_events" "$hotplug_wait" true
	debug_remove_attach_helper "$hotplug_events" "$hotplug_wait" true
	# Verify reregistering hotplug poller
	rpc_cmd bdev_nvme_set_hotplug -d
	rpc_cmd bdev_nvme_set_hotplug -e

	remove_attach_helper "$hotplug_events" "$hotplug_wait" true
	debug_remove_attach_helper "$hotplug_events" "$hotplug_wait" true

	trap - SIGINT SIGTERM EXIT
	killprocess $spdk_tgt_pid