Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp661420ybl; Fri, 6 Dec 2019 04:17:57 -0800 (PST) X-Google-Smtp-Source: APXvYqz06hjZ7cj+qKZL554axbmMyaJJ+Yf4ZlQ5rpaOCfJzhAQSLkwASWdbix/rtSCag5T1VrzY X-Received: by 2002:a9d:7ccc:: with SMTP id r12mr11048064otn.22.1575634677385; Fri, 06 Dec 2019 04:17:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575634677; cv=none; d=google.com; s=arc-20160816; b=A8g7x8p/yybH5QP5yiS/JQk5ewx0Ool8AVR5cRweTRdMjmx6xrKGFYr0RzIn+pdeN5 o3FJAwTM3XwWmffsvX7jZsl+g6DiYM9X+H17FJv6aTu94xFT47GlZNjJlkpnr9PS7EpY sMtZCDJlcNMtzrAeWBSL3NYUXm0ZYUXtz7bAlVDfShgeBBH7KXJXJ0jFUaxS+XpJ5jXX 9TGg/1OUEKJ/7g23EzSTzilF7bSYiqJgeX5PqyiJDnuJLlqFG+D4yorKBiie0PoxzUzc mB18uRhb+CUioFNwDUPREgQDXvfQyRsLdsyaKAKt7VJ9/l3T4Wm3fr8j6QZRfWjrQ3vV kTrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=mhAXA6h5oJvfd+hBWAi6/gCYYsQ4uVqa8ukDUc8LA/A=; b=XLyllQxjZjZ4QxCCOTbVul28LJBAB5z07moXMMxb7BLwjPcpVCo3GgA23jyW7UwlgG AGia693gqQ+uvl6ODX7+/AzXoMrtcKJaiyWfbj/6X+7OvfUIlnKvGd9jeNIPyU+pKVmB DoRnRWDdU1jxx83YqMwUvIo9SPQtNbDIBPndq0Um1eYevw6nRP4nt19FzOgyUuIUiy4+ cB14bByl8JNQBxH9RcDBcLjNd3oPlgxO523WEXjf9XTIqbfE7NddaEIWUoDiZpL2HuWw j3qzvVD87PgCW6XZJrpsRVs9x381F0EPEOzx2C2CVcc92B3sQvo/54EzAx2GZOYZ++S5 LfwQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c2si7052051otn.311.2019.12.06.04.17.44; Fri, 06 Dec 2019 04:17:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726250AbfLFMRP (ORCPT + 99 others); Fri, 6 Dec 2019 07:17:15 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:43255 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726116AbfLFMRP (ORCPT ); Fri, 6 Dec 2019 07:17:15 -0500 Received: from 1.general.cascardo.us.vpn ([10.172.70.58] helo=calabresa) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1idCXo-00079d-9v; Fri, 06 Dec 2019 12:17:12 +0000 Date: Fri, 6 Dec 2019 09:17:07 -0300 From: Thadeu Lima de Souza Cascardo To: Eric Dumazet Cc: netdev@vger.kernel.org, davem@davemloft.net, shuah@kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, posk@google.com Subject: Re: [PATCH] selftests: net: ip_defrag: increase netdev_max_backlog Message-ID: <20191206121707.GC5083@calabresa> References: <20191204195321.406365-1-cascardo@canonical.com> <483097a3-92ec-aedd-60d9-ab7f58b9708d@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <483097a3-92ec-aedd-60d9-ab7f58b9708d@gmail.com> User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 04, 2019 at 12:03:57PM -0800, Eric Dumazet wrote: > > > On 12/4/19 11:53 AM, Thadeu Lima de Souza Cascardo wrote: > > When using fragments with size 8 and payload larger than 8000, the backlog > > might fill up and packets will be dropped, causing the test to fail. This > > happens often enough when conntrack is on during the IPv6 test. > > > > As the larger payload in the test is 10000, using a backlog of 1250 allow > > the test to run repeatedly without failure. At least a 1000 runs were > > possible with no failures, when usually less than 50 runs were good enough > > for showing a failure. > > > > As netdev_max_backlog is not a pernet setting, this sets the backlog to > > 1000 during exit to prevent disturbing following tests. > > > > Hmmm... I would prefer not changing a global setting like that. > This is going to be flaky since we often run tests in parallel (using different netns) > > What about adding a small delay after each sent packet ? > > diff --git a/tools/testing/selftests/net/ip_defrag.c b/tools/testing/selftests/net/ip_defrag.c > index c0c9ecb891e1d78585e0db95fd8783be31bc563a..24d0723d2e7e9b94c3e365ee2ee30e9445deafa8 100644 > --- a/tools/testing/selftests/net/ip_defrag.c > +++ b/tools/testing/selftests/net/ip_defrag.c > @@ -198,6 +198,7 @@ static void send_fragment(int fd_raw, struct sockaddr *addr, socklen_t alen, > error(1, 0, "send_fragment: %d vs %d", res, frag_len); > > frag_counter++; > + usleep(1000); > } > > static void send_udp_frags(int fd_raw, struct sockaddr *addr, > That won't work because the issue only shows when we using conntrack, as the packet will be reassembled on output, then fragmented again. When this happens, the fragmentation code is transmitting the fragments in a tight loop, which floods the backlog. One other option is limit the number of fragments to a 1000, like the following patch: diff --git a/tools/testing/selftests/net/ip_defrag.c b/tools/testing/selftests/net/ip_defrag.c index c0c9ecb891e1..f4086ba9d16c 100644 --- a/tools/testing/selftests/net/ip_defrag.c +++ b/tools/testing/selftests/net/ip_defrag.c @@ -16,6 +16,9 @@ #include #include +#define ALIGN(x, sz) ((x + (sz-1)) & ~(sz-1)) +#define MAX(a, b) ((a < b) ? b : a) + static bool cfg_do_ipv4; static bool cfg_do_ipv6; static bool cfg_verbose; @@ -362,6 +365,7 @@ static void run_test(struct sockaddr *addr, socklen_t alen, bool ipv6) for (payload_len = min_frag_len; payload_len < MSG_LEN_MAX; payload_len += (rand() % 4096)) { + min_frag_len = MAX(8, ALIGN(payload_len / 1000, 8)); if (cfg_verbose) printf("payload_len: %d\n", payload_len);