netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin KaFai Lau <kafai@fb.com>
To: Cong Wang <xiyou.wangcong@gmail.com>
Cc: netdev <netdev@vger.kernel.org>,
	Eric Dumazet <edumazet@google.com>, Wei Wang <weiwan@google.com>,
	Kernel Team <kernel-team@fb.com>
Subject: Re: [RFC PATCH net 3/4] ipv6: datagram: Update dst cache of a connected datagram sk during pmtu update
Date: Wed, 6 Apr 2016 11:49:10 -0700	[thread overview]
Message-ID: <20160406184851.GA14894@kafai-mba.local> (raw)
In-Reply-To: <CAM_iQpUrcXwBH0BuCh-cjo0st6ykpUgdjRo3Cn-ViO40vtbHKA@mail.gmail.com>

On Wed, Apr 06, 2016 at 10:58:23AM -0700, Cong Wang wrote:
> On Tue, Apr 5, 2016 at 5:11 PM, Martin KaFai Lau <kafai@fb.com> wrote:
> > On Mon, Apr 04, 2016 at 01:45:02PM -0700, Cong Wang wrote:
> >> I see your point, but calling __ip6_datagram_connect() seems overkill
> >> here, we don't need to update so many things in the pmtu update context,
> >> at least IPv4 doesn't do that either. I don't think you have to do that.
> >>
> >> So why just updating the dst cache (also some addr cache) here is not
> >> enough?
> > I am not sure I understand.  I could be missing something.
> >
> > This patch uses ip6_datagram_dst_update() to do the route lookup and
> > sk->sk_dst_cache update.  ip6_datagram_dst_update() is
> > created in the first two refactoring patches and is also used by
> > __ip6_datagram_connect().
> >
> > Which operations in ip6_datagram_dst_update() could be saved
> > during the pmtu update?
>
> I thought you call the same ip6_datagram_dst_update() for both
> pmtu update and __ip6_datagram_connect(), but you actually skip
> some sk operations for pmtu case, which means you don't need
> to worry about parallel ip6_datagram_connect().
>
> IPv6 UDP sendmsg() path stores the dst without sock lock anyway,
> we don't cope with a concurrent connect() on another cpu.
A parallel sendmsg and connect could be an issue.  The user is connecting
to a new dest while another parallel sendmsg is sending to (could be the old
dest, new dest or somewhere between old and new dest?)

However, it is the userland making and it will be another patch if we want
to protect this case too.

In pmtu update, the kernel is doing the lookup and update without the
userland conscious.

> But still, I don't see this is a problem here, because even if we store
> an obsolete address in cache, it would be corrected later.
The sendmsg() path will correct it (relookup and update sk_dst_cache) but not
the getsockopt(IPV6_MTU) path which is what this patch is trying to fix: Update
a _valid_ dst to sk->sk_dst_cache.

  reply	other threads:[~2016-04-06 18:49 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-01 22:56 [RFC PATCH net 0/4] ip6: datagram: Update dst cache of a connected datagram sk during pmtu update Martin KaFai Lau
2016-04-01 22:56 ` [RFC PATCH net 1/4] ipv6: datagram: Refactor flowi6 init codes to a new function Martin KaFai Lau
2016-04-01 22:56 ` [RFC PATCH net 2/4] ipv6: datagram: Refactor dst lookup and update " Martin KaFai Lau
2016-04-01 22:56 ` [RFC PATCH net 3/4] ipv6: datagram: Update dst cache of a connected datagram sk during pmtu update Martin KaFai Lau
2016-04-01 23:13   ` Cong Wang
2016-04-01 23:15     ` Cong Wang
2016-04-03  2:33     ` Martin KaFai Lau
2016-04-04 20:45       ` Cong Wang
2016-04-05 23:56         ` David Miller
2016-04-11 17:56           ` Martin KaFai Lau
2016-04-06  0:11         ` Martin KaFai Lau
2016-04-06 17:58           ` Cong Wang
2016-04-06 18:49             ` Martin KaFai Lau [this message]
2016-04-07 18:37               ` Cong Wang
2016-04-07 19:09                 ` Martin KaFai Lau
2016-04-01 22:56 ` [RFC PATCH net 4/4] ipv6: udp: Do a route lookup and update during release_cb Martin KaFai Lau

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=20160406184851.GA14894@kafai-mba.local \
    --to=kafai@fb.com \
    --cc=edumazet@google.com \
    --cc=kernel-team@fb.com \
    --cc=netdev@vger.kernel.org \
    --cc=weiwan@google.com \
    --cc=xiyou.wangcong@gmail.com \
    /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).