From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38F79C636CB for ; Mon, 30 Jan 2023 16:23:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236351AbjA3QXT (ORCPT ); Mon, 30 Jan 2023 11:23:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235054AbjA3QXO (ORCPT ); Mon, 30 Jan 2023 11:23:14 -0500 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60B2B3A587 for ; Mon, 30 Jan 2023 08:23:13 -0800 (PST) Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (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-0.canonical.com (Postfix) with ESMTPS id BC7FF4421B for ; Mon, 30 Jan 2023 16:23:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1675095791; bh=EKh99Av2dVI8br/juDJKkzbI27Y8Tv0MgpqioM20Ax8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:In-Reply-To; b=d8qvpAuw3iuOJK5+LkUKDWhL0JS/Rb+wcI4C/JpdxK9uB6EHWHtKEUfkcsKeXwVT+ u5ac6TSWS6zAEcTi7BJcprR/a31NttZXlcCxiIR0YmQn4mj9VGheIaearPrmnBf2AW LrjEOFF+BaP97LhKBChJBXQ+1mkFtusMxVmq0MxnhdEQRK2no9NreKRCC0J/04fsIa g2k0PxDmvpGA5pQ7V17scsv/jJogNUz+tnsGM3B5/d4i53mxHwSEK+qQVQeouO6WKy eyGLyFSOodhJYyzcz/KacczviL1g9j1SmXBY9iIUYdZGKVP5iqFrXrkZ972n7aZJMb yd8h30aWaWZvQ== Received: by mail-wr1-f72.google.com with SMTP id o9-20020adfa109000000b002bfc062eaa8so2105997wro.20 for ; Mon, 30 Jan 2023 08:23:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=EKh99Av2dVI8br/juDJKkzbI27Y8Tv0MgpqioM20Ax8=; b=mreAlNDdzaBeTBCIJIRpqawabn3znIwbDfxIh+mlu1Exv94RA8XJW4z92glZiqsYKZ yFNeIt0P/jf5S5T2HB6gQEsOG8MveN9iImRmTPQQqoFxLwXFpMznV+MhfumgVboelxRw 4RyZ/L0pwq/VSShpHj1U6DG89ypLauCHoQkfRRjRh+88yovk3WUgYOwCiohGyfmZs1sa KrYOKFfJ3epE/fjAK8eYjfZzX2X/Ti4vK9eA7eFxPgJ5Sw/pGLaQvMM2voaRo0iZT41l Qa84uJBpTIB1augCA/SwmmD9t8fQtlc83sGiTSi0u8lDSlzKr7MyoQLHTDX7hjK8vxad 89YQ== X-Gm-Message-State: AFqh2kohdG2lk6j98/2By0hROHdnasFgtOucikM9qUDAIgzHvber5A+r Bmmu9ekDowAMpuZMVxBe/NKHZddeo5jK3hb9wYDrucxbT1N52SrE3W8Cj8o0VcJKa3wJUVyvqyK DOHIRL6xG9MOhoCGNTIbVqWuQu9f9K0sp4nibirp0TQ== X-Received: by 2002:a05:600c:34d1:b0:3db:1434:c51a with SMTP id d17-20020a05600c34d100b003db1434c51amr44052399wmq.40.1675095791479; Mon, 30 Jan 2023 08:23:11 -0800 (PST) X-Google-Smtp-Source: AMrXdXv94g3xcpSkCieUluATJV/IVwfPvR4IZ+IgwNWXiloi8TwBETu25mp6RUhJ8NieWs4+Q2LF9A== X-Received: by 2002:a05:600c:34d1:b0:3db:1434:c51a with SMTP id d17-20020a05600c34d100b003db1434c51amr44052387wmq.40.1675095791314; Mon, 30 Jan 2023 08:23:11 -0800 (PST) Received: from qwirkle ([81.2.157.149]) by smtp.gmail.com with ESMTPSA id l10-20020a05600c47ca00b003dc58637163sm4063283wmo.45.2023.01.30.08.23.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jan 2023 08:23:10 -0800 (PST) Date: Mon, 30 Jan 2023 16:23:09 +0000 From: Andrei Gherzan To: Willem de Bruijn Cc: Paolo Abeni , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Shuah Khan , netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] selftests: net: udpgso_bench_tx: Introduce exponential back-off retries Message-ID: References: <20230127181625.286546-1-andrei.gherzan@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 23/01/30 04:15PM, Andrei Gherzan wrote: > On 23/01/30 11:03AM, Willem de Bruijn wrote: > > On Mon, Jan 30, 2023 at 9:28 AM Andrei Gherzan > > wrote: > > > > > > On 23/01/30 08:35AM, Willem de Bruijn wrote: > > > > On Mon, Jan 30, 2023 at 7:51 AM Andrei Gherzan > > > > wrote: > > > > > > > > > > On 23/01/30 09:26AM, Paolo Abeni wrote: > > > > > > On Fri, 2023-01-27 at 17:03 -0500, Willem de Bruijn wrote: > > > > > > > On Fri, Jan 27, 2023 at 1:16 PM Andrei Gherzan > > > > > > > wrote: > > > > > > > > > > > > > > > > The tx and rx test programs are used in a couple of test scripts including > > > > > > > > "udpgro_bench.sh". Taking this as an example, when the rx/tx programs > > > > > > > > are invoked subsequently, 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 adding routines that retry the socket > > > > > > > > operations with an exponential back off algorithm from 100ms to 2s. > > > > > > > > > > > > > > > > Fixes: 3a687bef148d ("selftests: udp gso benchmark") > > > > > > > > Signed-off-by: Andrei Gherzan > > > > > > > > > > > > > > Synchronizing the two processes is indeed tricky. > > > > > > > > > > > > > > Perhaps more robust is opening an initial TCP connection, with > > > > > > > SO_RCVTIMEO to bound the waiting time. That covers all tests in one > > > > > > > go. > > > > > > > > > > > > Another option would be waiting for the listener(tcp)/receiver(udp) > > > > > > socket to show up in 'ss' output before firing-up the client - quite > > > > > > alike what mptcp self-tests are doing. > > > > > > > > > > I like this idea. I have tested it and it works as expected with the > > > > > exeception of: > > > > > > > > > > ./udpgso_bench_tx: sendmsg: No buffer space available > > > > > > > > > > Any ideas on how to handle this? I could retry and that works. > > > > > > > > This happens (also) without the zerocopy flag, right? That > > > > > > > > It might mean reaching the sndbuf limit, which can be adjusted with > > > > SO_SNDBUF (or SO_SNDBUFFORCE if CAP_NET_ADMIN). Though I would not > > > > expect this test to bump up against that limit. > > > > > > > > A few zerocopy specific reasons are captured in > > > > https://www.kernel.org/doc/html/latest/networking/msg_zerocopy.html#transmission. > > > > > > I have dug a bit more into this, and it does look like your hint was in > > > the right direction. The fails I'm seeing are only with the zerocopy > > > flag. > > > > > > From the reasons (doc) above I can only assume optmem limit as I've > > > reproduced it with unlimited locked pages and the fails are transient. > > > That leaves optmem limit. Bumping the value I have by default (20480) to > > > (2048000) made the sendmsg succeed as expected. On the other hand, the > > > tests started to fail with something like: > > > > > > ./udpgso_bench_tx: Unexpected number of Zerocopy completions: 774783 > > > expected 773707 received > > > > More zerocopy completions than number of sends. I have not seen this before. > > > > The completions are ranges of IDs, one per send call for datagram sockets. > > > > Even with segmentation offload, the counter increases per call, not per segment. > > > > Do you experience this without any other changes to udpgso_bench_tx.c. > > Or are there perhaps additional sendmsg calls somewhere (during > > initial sync) that are not accounted to num_sends? > > Indeed, that looks off. No, I have run into this without any changes in > the tests (besides the retry routine in the shell script that waits for > rx to come up). Also, as a data point. Actually wait. I don't think that is the case here. "expected" is the number of sends. In this case we sent 1076 more messages than completions. Am I missing something obvious? > > As an additional data point, this was only seen on the IPv6 tests. I've > never been able to replicate it on the IPv4 run. I was also fast to send this but it is not correct. I managed to reproduce it on both IPv4 and IPv6. -- Andrei Gherzan