Commit 2c646ca9 authored by Krzysztof Goreczny's avatar Krzysztof Goreczny Committed by Konrad Sztyber
Browse files

sock/posix: fix busy poller in the interrupt mode



Setting EPOLLOUT flag makes the epoll_wait exit immidiately on the
tqpair socket as it's always ready for the write operation.
This was a bad fix for the async writes in the interrupt mode. Proper
fix is to flush async writes on nvmf/tcp level.

Extend test script for the interrupt mode to include case of idle
initiator in which CPU cores shall not be busy looping.

Change-Id: I17a97a74be9740dd67531f6e3b72bf38f0850edd
Signed-off-by: default avatarKrzysztof Goreczny <krzysztof.goreczny@dell.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/24959


Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeliu@tencent.com>
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
parent a2ae7b96
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -1921,10 +1921,6 @@ posix_sock_group_impl_add_sock(struct spdk_sock_group_impl *_group, struct spdk_
	memset(&event, 0, sizeof(event));
	/* EPOLLERR is always on even if we don't set it, but be explicit for clarity */
	event.events = EPOLLIN | EPOLLERR;
	if (spdk_interrupt_mode_is_enabled()) {
		event.events |= EPOLLOUT;
	}

	event.data.ptr = sock;

	rc = epoll_ctl(group->fd, EPOLL_CTL_ADD, sock->fd, &event);
+15 −4
Original line number Diff line number Diff line
@@ -9,14 +9,16 @@ source $rootdir/test/common/autotest_common.sh
source $rootdir/test/nvmf/common.sh
source $rootdir/test/interrupt/common.sh

NQN=nqn.2016-06.io.spdk:cnode1

nvmftestinit
nvmfappstart -m 0x3
setup_bdev_aio

$rpc_py nvmf_create_transport $NVMF_TRANSPORT_OPTS -u 8192 -q 256
$rpc_py nvmf_create_subsystem nqn.2016-06.io.spdk:cnode1 -a -s SPDK00000000000001
$rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode1 AIO0
$rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode1 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT
$rpc_py nvmf_create_subsystem $NQN -a -s $NVMF_SERIAL
$rpc_py nvmf_subsystem_add_ns $NQN AIO0
$rpc_py nvmf_subsystem_add_listener $NQN -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT

# Confirm that with no traffic all cpu cores are idle
for i in {0..1}; do
@@ -28,7 +30,7 @@ perf="$SPDK_BIN_DIR/spdk_nvme_perf"
# run traffic
$perf -q 256 -o 4096 -w randrw -M 30 -t 10 -c 0xC \
	-r "trtype:${TEST_TRANSPORT} adrfam:IPv4 traddr:${NVMF_FIRST_TARGET_IP} trsvcid:${NVMF_PORT} \
subnqn:nqn.2016-06.io.spdk:cnode1" "${NO_HUGE[@]}" &
subnqn:${NQN}" "${NO_HUGE[@]}" &

perf_pid=$!

@@ -44,5 +46,14 @@ for i in {0..1}; do
	reactor_is_idle $nvmfpid $i
done

# connecting initiator should not cause cores to be busy
$NVME_CONNECT "${NVME_HOST[@]}" -t $TEST_TRANSPORT -n "$NQN" -a "$NVMF_FIRST_TARGET_IP" -s "$NVMF_PORT"
waitforserial "$NVMF_SERIAL"
for i in {0..1}; do
	reactor_is_idle $nvmfpid $i
done
nvme disconnect -n "$NQN"
waitforserial_disconnect "$NVMF_SERIAL"

trap - SIGINT SIGTERM EXIT
nvmftestfini