Commit ad3634af authored by Curt Bruns's avatar Curt Bruns Committed by Tomasz Zawadzki
Browse files

test: process admin completions during stub sleep



The stub app runs during NVMe CI testing to minimize test time.
It runs as the primary process and all other NVMe tests
run as secondary processes and connect to the NVMe controller
via shared memory. The issue is when there is an Async Event
Notification, the secondary processes are not informed of the
event because the stub app does not process admin completions
and therefore they do not get added to other processes async
event list. This change adds a call to process admin
completions during the stub_sleep routine to cover this type
of AEN case. A configurable sleep time was also added to
allow the admin completion calls to occur more rapidly to help
minimize test time, if needed.

Signed-off-by: default avatarCurt Bruns <curt.e.bruns@gmail.com>
Change-Id: I72d5afc511c4409ec4a03cd969dbbc0d7dd4f256
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12555


Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 95f747ae
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -40,6 +40,8 @@

static char g_path[256];
static struct spdk_poller *g_poller;
/* default sleep time in ms */
static uint32_t g_sleep_time = 1000;

struct ctrlr_entry {
	struct spdk_nvme_ctrlr *ctrlr;
@@ -75,6 +77,7 @@ usage(char *executable_name)
	printf(" -n channel number of memory channels used for DPDK\n");
	printf(" -p core    main (primary) core for DPDK\n");
	printf(" -s size    memory size in MB for DPDK\n");
	printf(" -t msec    sleep time (ms) between checking for admin completions\n");
	printf(" -H         show this usage\n");
}

@@ -109,7 +112,12 @@ attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
static int
stub_sleep(void *arg)
{
	usleep(1000 * 1000);
	struct ctrlr_entry *ctrlr_entry, *tmp;

	usleep(g_sleep_time * 1000);
	TAILQ_FOREACH_SAFE(ctrlr_entry, &g_controllers, link, tmp) {
		spdk_nvme_ctrlr_process_admin_completions(ctrlr_entry->ctrlr);
	}
	return 0;
}

@@ -155,7 +163,7 @@ main(int argc, char **argv)
	opts.name = "stub";
	opts.rpc_addr = NULL;

	while ((ch = getopt(argc, argv, "i:m:n:p:s:H")) != -1) {
	while ((ch = getopt(argc, argv, "i:m:n:p:s:t:H")) != -1) {
		if (ch == 'm') {
			opts.reactor_mask = optarg;
		} else if (ch == '?' || ch == 'H') {
@@ -180,6 +188,9 @@ main(int argc, char **argv)
			case 's':
				opts.mem_size = val;
				break;
			case 't':
				g_sleep_time = val;
				break;
			default:
				usage(argv[0]);
				exit(EXIT_FAILURE);