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: Curt 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: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Curt Bruns 2022-05-04 13:55:33 -07:00 committed by Tomasz Zawadzki
parent 95f747aef0
commit ad3634af31

View File

@ -40,6 +40,8 @@
static char g_path[256]; static char g_path[256];
static struct spdk_poller *g_poller; static struct spdk_poller *g_poller;
/* default sleep time in ms */
static uint32_t g_sleep_time = 1000;
struct ctrlr_entry { struct ctrlr_entry {
struct spdk_nvme_ctrlr *ctrlr; 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(" -n channel number of memory channels used for DPDK\n");
printf(" -p core main (primary) core for DPDK\n"); printf(" -p core main (primary) core for DPDK\n");
printf(" -s size memory size in MB 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"); printf(" -H show this usage\n");
} }
@ -109,7 +112,12 @@ attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
static int static int
stub_sleep(void *arg) 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; return 0;
} }
@ -155,7 +163,7 @@ main(int argc, char **argv)
opts.name = "stub"; opts.name = "stub";
opts.rpc_addr = NULL; 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') { if (ch == 'm') {
opts.reactor_mask = optarg; opts.reactor_mask = optarg;
} else if (ch == '?' || ch == 'H') { } else if (ch == '?' || ch == 'H') {
@ -180,6 +188,9 @@ main(int argc, char **argv)
case 's': case 's':
opts.mem_size = val; opts.mem_size = val;
break; break;
case 't':
g_sleep_time = val;
break;
default: default:
usage(argv[0]); usage(argv[0]);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);