test/json_config: detach virtio controllers before shutdown

If the controllers are left attached when the application is terminated,
the virtio library might receive notifications about memory being
unregistered from the mem_map.  The apps in json_config test are
preallocating 1GB of memory, which should stop DPDK from releasing the
hugepages back to the system, but if they allocate more, that extra
pages can be released, which would generate the mem_map notifications .

This actually happened in #2951 - spdk_tgt was built with ocf support,
which preallocates an extra ~300MB mempools, exceeding 1GB, which caused
mem_map notifications to be sent when iscsi mempools were destroyed
triggering an assertion in virtio.

Another option to fix this would be to increase the size of the
preallocated memory, but detaching the controllers achieves the same
thing without requiring more resources.

Fixes #2951.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I743af39acfee68caba55ec4fccd593a696ab688b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17265
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Konrad Sztyber 2023-03-17 11:45:27 +01:00
parent e6f5dbb02b
commit 2a463e3e26

View File

@ -362,6 +362,10 @@ function json_config_test_fini() {
local ret=0
if [[ -n "${app_pid[initiator]}" ]]; then
if [[ $SPDK_TEST_VHOST_INIT -eq 1 ]]; then
initiator_rpc bdev_virtio_detach_controller VirtioScsiCtrlr0 || :
initiator_rpc bdev_virtio_detach_controller VirtioBlk0 || :
fi
killprocess ${app_pid[initiator]}
fi