netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH v2 net 3/3] wireguard: send: account for mtu=0 devices
Date: Fri, 14 Feb 2020 22:57:09 +0100	[thread overview]
Message-ID: <CAHmME9r6gTCV8cpPgyjOVMWCbRJtswzqXMYBqTQmo001AZz05Q@mail.gmail.com> (raw)
In-Reply-To: <ec52e8cb-5649-9167-bb14-7e9775c6a8be@gmail.com>

Hey Eric,

On Fri, Feb 14, 2020 at 7:53 PM Eric Dumazet <eric.dumazet@gmail.com> wrote:
> > The before passings off to the udp tunnel api, we indicate that we
> > support ip segmentation, and then it gets handled and fragmented
> > deeper down. Check out socket.c.
>
> Okay. Speaking of socket.c, I found this wg_socket_reinit() snippet :
>
> synchronize_rcu();
> synchronize_net();
>
> Which makes little sense. Please add a comment explaining why these two
> calls are needed.

Thanks, I appreciate your scrutiny here. Right again, you are. It
looks like that was added in 2017 after observing the pattern in other
drivers and seeing the documentation comment, "Wait for packets
currently being received to be done." That sounds like an important
thing to do before tearing down a socket. But here it makes no sense
at all, since synchronize_net() is just a wrapper around
synchronize_rcu() (and sometimes _expedited). And here, the
synchronize_rcu() usage makes sense to have, since this is as boring
of an rcu pattern as can be:

mutex_lock()
old = rcu_dereference_protected(x->y)
rcu_assign(x->y, new)
mutex_unlock()
synchronize_rcu()
free_it(old)

Straight out of the documentation. Having the extra synchronize_net()
in there adds nothing at all. I'll send a v3 of this 5.6-rc2 cleanup
series containing that removal.

Jason

  reply	other threads:[~2020-02-14 21:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-14 17:34 [PATCH v2 net 0/3] wireguard fixes for 5.6-rc2 Jason A. Donenfeld
2020-02-14 17:34 ` [PATCH v2 net 1/3] wireguard: selftests: reduce complexity and fix make races Jason A. Donenfeld
2020-02-14 17:34 ` [PATCH v2 net 2/3] wireguard: receive: reset last_under_load to zero Jason A. Donenfeld
2020-02-14 17:34 ` [PATCH v2 net 3/3] wireguard: send: account for mtu=0 devices Jason A. Donenfeld
2020-02-14 17:56   ` Eric Dumazet
2020-02-14 18:15     ` Jason A. Donenfeld
2020-02-14 18:22       ` Eric Dumazet
2020-02-14 18:37         ` Jason A. Donenfeld
2020-02-14 18:53           ` Eric Dumazet
2020-02-14 21:57             ` Jason A. Donenfeld [this message]
2020-02-14 22:30               ` Eric Dumazet
2020-02-14 22:53                 ` Jason A. Donenfeld

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=CAHmME9r6gTCV8cpPgyjOVMWCbRJtswzqXMYBqTQmo001AZz05Q@mail.gmail.com \
    --to=jason@zx2c4.com \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).