From: Alexander Aring <aring@mojatatu.com>
To: Tariq Toukan <tariqt@mellanox.com>
Cc: David Miller <davem@davemloft.net>,
edumazet@google.com, netdev@vger.kernel.org, fw@strlen.de,
herbert@gondor.apana.org.au, tgraf@suug.ch, brouer@redhat.com,
alex.aring@gmail.com, stefan@osg.samsung.com,
ktkhai@virtuozzo.com, eric.dumazet@gmail.com,
Moshe Shemesh <moshe@mellanox.com>,
Eran Ben Elisha <eranbe@mellanox.com>
Subject: Re: [PATCH v4 net-next 00/19] inet: frags: bring rhashtables to IP defrag
Date: Mon, 28 May 2018 10:52:24 -0400 [thread overview]
Message-ID: <20180528145224.3ih6urfixwv4fwkf@x220t> (raw)
In-Reply-To: <9329021e-2d77-7e90-b0e2-8b391508f6cb@mellanox.com>
Hi,
On Mon, May 28, 2018 at 12:12:42PM +0300, Tariq Toukan wrote:
>
>
> On 01/04/2018 6:25 AM, David Miller wrote:
> > From: Eric Dumazet <edumazet@google.com>
> > Date: Sat, 31 Mar 2018 12:58:41 -0700
> >
> > > IP defrag processing is one of the remaining problematic layer in linux.
> > >
> > > It uses static hash tables of 1024 buckets, and up to 128 items per bucket.
> > >
> > > A work queue is supposed to garbage collect items when host is under memory
> > > pressure, and doing a hash rebuild, changing seed used in hash computations.
> > >
> > > This work queue blocks softirqs for up to 25 ms when doing a hash rebuild,
> > > occurring every 5 seconds if host is under fire.
> > >
> > > Then there is the problem of sharing this hash table for all netns.
> > >
> > > It is time to switch to rhashtables, and allocate one of them per netns
> > > to speedup netns dismantle, since this is a critical metric these days.
> > >
> > > Lookup is now using RCU, and 64bit hosts can now provision whatever amount
> > > of memory needed to handle the expected workloads.
> > ...
> >
> > Series applied, thanks Eric.
> >
>
> Hi Eric,
>
> Recently my colleague (Moshe Shemesh) got a failure in upstream regression,
> which is related to this patchset. We don’t see the failure before it was
> merged.
> We checked again on net-next (from May 24th), it still reproduces.
>
> The test case runs netperf with ipv6 udp single stream (64K message size).
> After the change we see huge packet loss:
> 145,134 messages failed out of 145,419 (only 285 fully received)
>
as somebody who had similar issues with this patch series I can tell you
about what happened for the 6LoWPAN fragmentation.
The issue sounds similar, but there is too much missing information here
to say something about if you have exactly the issue which we had.
Our problem:
The patch series uses memcmp() to compare hash keys, we had some padding
bytes in our hash key and it occurs that we had sometimes random bytes
in this structure when it's put on stack. We solved it by a struct
foo_key bar = {}, which in case of gcc it _seems_ it makes a whole
memset(bar, 0, ..) on the structure.
I asked on the netdev mailinglist how to deal with this problem in
general, because = {} works in case of gcc, others compilers may have a
different handling or even gcc will changes this behaviour in future.
I got no reply so I did what it works for me. :-)
At least maybe a memcmp() on structures should never be used, it should
be compared by field. I would recommend this way when the compiler is
always clever enough to optimize it in some cases, but I am not so a
compiler expert to say anything about that.
I checked the hash key structures for x86_64 and pahole, so far I didn't
find any padding bytes there, but it might be different on
architectures or ?compiler?.
Additional useful information to check if you running into the same problem
would be:
- Which architecture do you use?
- Do you have similar problems with a veth setup?
You could also try this:
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index b939b94e7e91..40ece9ab8b12 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -142,19 +142,19 @@ static void ip6_frag_expire(struct timer_list *t)
static struct frag_queue *
fq_find(struct net *net, __be32 id, const struct ipv6hdr *hdr, int iif)
{
- struct frag_v6_compare_key key = {
- .id = id,
- .saddr = hdr->saddr,
- .daddr = hdr->daddr,
- .user = IP6_DEFRAG_LOCAL_DELIVER,
- .iif = iif,
- };
+ struct frag_v6_compare_key key = {};
struct inet_frag_queue *q;
if (!(ipv6_addr_type(&hdr->daddr) & (IPV6_ADDR_MULTICAST |
IPV6_ADDR_LINKLOCAL)))
key.iif = 0;
+ key.id = id;
+ key.saddr = hdr->saddr;
+ key.daddr = hdr->daddr;
+ key.user = IP6_DEFRAG_LOCAL_DELIVER;
+ key.iif = iif;
+
q = inet_frag_find(&net->ipv6.frags, &key);
if (!q)
return NULL;
- Alex
next prev parent reply other threads:[~2018-05-28 14:52 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-31 19:58 [PATCH v4 net-next 00/19] inet: frags: bring rhashtables to IP defrag Eric Dumazet
2018-03-31 19:58 ` [PATCH v4 net-next 01/19] ipv6: frag: remove unused field Eric Dumazet
2018-03-31 19:58 ` [PATCH v4 net-next 02/19] inet: frags: change inet_frags_init_net() return value Eric Dumazet
2018-03-31 19:58 ` [PATCH v4 net-next 03/19] inet: frags: add a pointer to struct netns_frags Eric Dumazet
2018-03-31 19:58 ` [PATCH v4 net-next 04/19] inet: frags: refactor ipv6_frag_init() Eric Dumazet
2018-03-31 19:58 ` [PATCH v4 net-next 05/19] inet: frags: refactor lowpan_net_frag_init() Eric Dumazet
2018-03-31 19:58 ` [PATCH v4 net-next 06/19] inet: frags: refactor ipfrag_init() Eric Dumazet
2018-03-31 19:58 ` [PATCH v4 net-next 07/19] rhashtable: add schedule points Eric Dumazet
2018-03-31 19:58 ` [PATCH v4 net-next 08/19] inet: frags: use rhashtables for reassembly units Eric Dumazet
2018-04-16 12:54 ` Stefan Schmidt
2018-03-31 19:58 ` [PATCH v4 net-next 09/19] inet: frags: remove some helpers Eric Dumazet
2018-03-31 19:58 ` [PATCH v4 net-next 10/19] inet: frags: get rif of inet_frag_evicting() Eric Dumazet
2018-03-31 19:58 ` [PATCH v4 net-next 11/19] inet: frags: remove inet_frag_maybe_warn_overflow() Eric Dumazet
2018-03-31 19:58 ` [PATCH v4 net-next 12/19] inet: frags: break the 2GB limit for frags storage Eric Dumazet
2018-03-31 19:58 ` [PATCH v4 net-next 13/19] inet: frags: do not clone skb in ip_expire() Eric Dumazet
2018-03-31 19:58 ` [PATCH v4 net-next 14/19] ipv6: frags: rewrite ip6_expire_frag_queue() Eric Dumazet
2018-03-31 19:58 ` [PATCH v4 net-next 15/19] rhashtable: reorganize struct rhashtable layout Eric Dumazet
2018-03-31 19:58 ` [PATCH v4 net-next 16/19] inet: frags: reorganize struct netns_frags Eric Dumazet
2018-03-31 19:58 ` [PATCH v4 net-next 17/19] inet: frags: get rid of ipfrag_skb_cb/FRAG_CB Eric Dumazet
2018-04-01 3:02 ` kbuild test robot
2018-03-31 19:58 ` [PATCH v4 net-next 18/19] ipv6: frags: get rid of ip6frag_skb_cb/FRAG6_CB Eric Dumazet
2018-03-31 19:59 ` [PATCH v4 net-next 19/19] inet: frags: get rid of nf_ct_frag6_skb_cb/NFCT_FRAG6_CB Eric Dumazet
2018-04-01 3:25 ` [PATCH v4 net-next 00/19] inet: frags: bring rhashtables to IP defrag David Miller
2018-05-28 9:12 ` Tariq Toukan
2018-05-28 14:52 ` Alexander Aring [this message]
2018-05-28 16:09 ` Eric Dumazet
2018-05-30 7:20 ` Tariq Toukan
2018-05-30 7:36 ` Eric Dumazet
2018-05-30 14:42 ` Tariq Toukan
2018-05-31 12:18 ` Moshe Shemesh
2018-05-31 14:05 ` Eric Dumazet
2018-05-30 9:20 ` Jesper Dangaard Brouer
2018-05-30 10:36 ` Eric Dumazet
2018-05-30 10:56 ` Eric Dumazet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180528145224.3ih6urfixwv4fwkf@x220t \
--to=aring@mojatatu.com \
--cc=alex.aring@gmail.com \
--cc=brouer@redhat.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eranbe@mellanox.com \
--cc=eric.dumazet@gmail.com \
--cc=fw@strlen.de \
--cc=herbert@gondor.apana.org.au \
--cc=ktkhai@virtuozzo.com \
--cc=moshe@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=stefan@osg.samsung.com \
--cc=tariqt@mellanox.com \
--cc=tgraf@suug.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox