hotplug: add check for uio_pci_generic driver

Add a check for this driver and enable iova=pa mode when it is
detected.
Add an option for the hotplug application to force iova mode.

This is to avoid:

EAL:   Expecting 'PA' IOVA mode but current mode is 'VA', not initializing
EAL: Requested device 0000:86:00.0 cannot be used

while using hw_hotplug test.

Change-Id: I7ff819c04b1e567b5ef88fc8f551ecec901806c8
Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9774
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Krzysztof Karas 2021-10-06 11:36:14 +00:00 committed by Tomasz Zawadzki
parent 1e6449d80a
commit ac1abb5be8
2 changed files with 17 additions and 2 deletions

View File

@ -72,6 +72,7 @@ static int g_expected_removal_times = -1;
static int g_insert_times;
static int g_removal_times;
static int g_shm_id = -1;
static const char *g_iova_mode = NULL;
static uint64_t g_timeout_in_us = SPDK_SEC_TO_USEC;
static struct spdk_nvme_detach_ctx *g_detach_ctx;
@ -425,6 +426,7 @@ static void usage(char *program_name)
printf("\t[-n expected hot insert times]\n");
printf("\t[-r expected hot removal times]\n");
printf("\t[-t time in seconds]\n");
printf("\t[-m iova mode: pa or va (optional)\n");
}
static int
@ -436,12 +438,17 @@ parse_args(int argc, char **argv)
/* default value */
g_time_in_sec = 0;
while ((op = getopt(argc, argv, "c:i:n:r:t:")) != -1) {
while ((op = getopt(argc, argv, "c:i:m:n:r:t:")) != -1) {
if (op == '?') {
usage(argv[0]);
return 1;
}
if (op == 'm') {
g_iova_mode = optarg;
continue;
}
val = spdk_strtol(optarg, 10);
if (val < 0) {
fprintf(stderr, "Converting a string to integer failed\n");
@ -508,6 +515,9 @@ int main(int argc, char **argv)
if (g_shm_id > -1) {
opts.shm_id = g_shm_id;
}
if (g_iova_mode) {
opts.iova_mode = g_iova_mode;
}
if (spdk_env_init(&opts) < 0) {
fprintf(stderr, "Unable to initialize SPDK env\n");
return 1;

View File

@ -45,10 +45,15 @@ timing_exit hotplug_hw_cfg
timing_enter hotplug_hw_test
mode=""
if [ "$driver" = "uio_pci_generic" ]; then
mode="-m pa"
fi
exec {log}> >(tee -a "$testdir/log.txt")
exec >&$log 2>&1
$SPDK_EXAMPLE_DIR/hotplug -i 0 -t 100 -n 2 -r 2 &
$SPDK_EXAMPLE_DIR/hotplug -i 0 -t 100 -n 2 -r 2 $mode &
hotplug_pid=$!
trap 'killprocess $hotplug_pid; exit 1' SIGINT SIGTERM EXIT