From patchwork Fri Feb 3 19:55:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Gherzan X-Patchwork-Id: 1737233 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=c/ZofmYs; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4P7mcl6Qxmz23qx for ; Sat, 4 Feb 2023 06:56:23 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1pO2AT-0005Vv-37; Fri, 03 Feb 2023 19:56:17 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1pO2AR-0005VT-LS for kernel-team@lists.ubuntu.com; Fri, 03 Feb 2023 19:56:15 +0000 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id B71684166C for ; Fri, 3 Feb 2023 19:56:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1675454174; bh=PyM0ZPMlsvEESwQQZnDSTfbbzTPKFE1KIEhcSWDO4l4=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=c/ZofmYs4I0lkIsZxsrZEBxbv9getMFMbN9csEqPBnQqloax2BWdmzxO93XwEO+nG I6OEpplydk4DKYFT87D8WwkZkpPKr2UtTIJl7r9UvJ3DO8d8B7rCizmnHwgch9xXes uwfnVqxAiWA8IIfV/Cp1iGjgppVjQ+dDowJqR1PI5+i3Y3GDfyDGbaGZ7gJsgbKO3i qvLxn4cCR1LLXrfMQyeyilUcrtf/xTMWcd6zK7chXm+Z/+xnSbCwxGcEL2Bq4V+RcA 4Wpmo2OsiD1Xz5ypZnG7YCclztrbNsmXAvCSkw8QXVD720y+m6oCkRdQ/tIA7YRleY 7r4uJ2ZGioFIw== Received: by mail-wm1-f70.google.com with SMTP id d18-20020a05600c34d200b003df901ab982so3196031wmq.4 for ; Fri, 03 Feb 2023 11:56:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PyM0ZPMlsvEESwQQZnDSTfbbzTPKFE1KIEhcSWDO4l4=; b=msrXS9BhhKSPeXJamE7NZJm2jjPxNoSbB3e6y7mo8f6cOqwfw2+gbrd1FkjJd17Kp7 yQ0VflbGESqYSqf8H+9ZxikMgQaKZG9X5ecc+pwVdH0kR9uuXgx9rWKPvXdWbp9FRirr 4q7kwmnBUzjm4RrsqDH01g7C1XMqQXYO4/Tp8DGI2x5/q7536kPsLkA0pOl3MxFZUMmI IUR/MFsKY3o8iXeahwYR/k20IIbaTMSqEedjKHR7EL+T2gNl9tY4M1YTZ+YqBiWlSiHM 6wyfXwmmIchgXEHgTLClrTQNgboNheDOd97nk0FQbmN/OmqCLVFw7c7u/2CP5W/udUxe dTxg== X-Gm-Message-State: AO0yUKXOkJUyhpAiijhCK455t+bxkzwG/wJzWTYRtNHwquF8KId5doY+ XJ+9WohIYjNGOnTSi1RLDXuQstOT/xyF/kdsWmkIJeT/9Niiq06SHZ1/OTevGJKrNLicA7ZPOeD 92fPasLRbbEv8xkUmO6QaMxfTU66fgZIXSx2witK1gQ== X-Received: by 2002:adf:de08:0:b0:2bf:e535:3f9a with SMTP id b8-20020adfde08000000b002bfe5353f9amr4032426wrm.39.1675454173900; Fri, 03 Feb 2023 11:56:13 -0800 (PST) X-Google-Smtp-Source: AK7set9NLsv8mx5/ub9ds+NR0eKm3YKwBRivTXsA0ZGBng+0EuB76ra7g/bgd4wIzx8ssejQSis9/g== X-Received: by 2002:adf:de08:0:b0:2bf:e535:3f9a with SMTP id b8-20020adfde08000000b002bfe5353f9amr4032420wrm.39.1675454173733; Fri, 03 Feb 2023 11:56:13 -0800 (PST) Received: from qwirkle.internal ([81.2.157.149]) by smtp.gmail.com with ESMTPSA id i11-20020a5d630b000000b0029a06f11022sm2686736wru.112.2023.02.03.11.56.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 11:56:13 -0800 (PST) From: Andrei Gherzan To: kernel-team@lists.ubuntu.com Subject: [SRU][F][J][K][PATCH 1/1] selftests: net: udpgso_bench: Fix racing bug between the rx/tx programs Date: Fri, 3 Feb 2023 19:55:50 +0000 Message-Id: <20230203195550.182433-2-andrei.gherzan@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230203195550.182433-1-andrei.gherzan@canonical.com> References: <20230203195550.182433-1-andrei.gherzan@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" BugLink: https://bugs.launchpad.net/ubuntu-kernel-tests/+bug/1951447 "udpgro_bench.sh" invokes udpgso_bench_rx/udpgso_bench_tx programs subsequently and while doing so, there is a chance that the rx one is not ready to accept socket connections. This racing bug could fail the test with at least one of the following: ./udpgso_bench_tx: connect: Connection refused ./udpgso_bench_tx: sendmsg: Connection refused ./udpgso_bench_tx: write: Connection refused This change addresses this by making udpgro_bench.sh wait for the rx program to be ready before firing off the tx one - up to a 10s timeout. Fixes: 3a687bef148d ("selftests: udp gso benchmark") Signed-off-by: Andrei Gherzan Cc: Paolo Abeni Cc: Willem de Bruijn (cherry-picked from commit dafe93b9ee21028d625dce347118b82659652eff netdev) Acked-by: Stefan Bader --- tools/testing/selftests/net/udpgso_bench.sh | 24 +++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/net/udpgso_bench.sh b/tools/testing/selftests/net/udpgso_bench.sh index dc932fd653634..640bc43452faa 100755 --- a/tools/testing/selftests/net/udpgso_bench.sh +++ b/tools/testing/selftests/net/udpgso_bench.sh @@ -7,6 +7,7 @@ readonly GREEN='\033[0;92m' readonly YELLOW='\033[0;33m' readonly RED='\033[0;31m' readonly NC='\033[0m' # No Color +readonly TESTPORT=8000 readonly KSFT_PASS=0 readonly KSFT_FAIL=1 @@ -56,11 +57,26 @@ trap wake_children EXIT run_one() { local -r args=$@ + local nr_socks=0 + local i=0 + local -r timeout=10 + + ./udpgso_bench_rx -p "$TESTPORT" & + ./udpgso_bench_rx -p "$TESTPORT" -t & + + # Wait for the above test program to get ready to receive connections. + while [ "$i" -lt "$timeout" ]; do + nr_socks="$(ss -lnHi | grep -c "\*:${TESTPORT}")" + [ "$nr_socks" -eq 2 ] && break + i=$((i + 1)) + sleep 1 + done + if [ "$nr_socks" -ne 2 ]; then + echo "timed out while waiting for udpgso_bench_rx" + exit 1 + fi - ./udpgso_bench_rx & - ./udpgso_bench_rx -t & - - ./udpgso_bench_tx ${args} + ./udpgso_bench_tx -p "$TESTPORT" ${args} } run_in_netns() {