From: Hannes Frederic Sowa <hannes@redhat.com>
To: Willem de Bruijn <willemb@google.com>
Cc: Network Development <netdev@vger.kernel.org>,
David Miller <davem@davemloft.net>
Subject: Re: [PATCH net-next] sock: consistent errqueue errors and signals
Date: Tue, 02 Sep 2014 23:18:11 +0200 [thread overview]
Message-ID: <1409692691.15984.16.camel@localhost> (raw)
In-Reply-To: <CA+FuTScAYY1ZhQPwY=pqW9hXf3UYB70Dxq5+aPH4D4pB7QRPbg@mail.gmail.com>
Hello,
On Di, 2014-09-02 at 11:20 -0400, Willem de Bruijn wrote:
> > From my experience in IPv6 code, we only do sk->sk_err updates directly
> > in protocol error handling code. In case of UDP IPv6 errors for example
> > we now notify sk_error_report two times with this patch (before the
> > patch we did sk_data_ready (this is what you changed) and
> > sk_error_report).
>
> If the event is that an error is ready, is this not correct? The
> wake up key should be POLLERR in both cases. In implementation
> of sock_def_error_report and sock_def_readable, the difference
> otherwise seems slim. I haven't checked all sk_data_ready and
> sk_error_report implementations, though, so may have missed
> differences for specific protocols. If this is not as obviously a strict
> improvement as I thought, I'll just drop it.
I am not sure if waking up the socket two times has unforeseen
consequences, we do so e.g. in __udp6_lib_err if recverr is set.
> > I really wonder if setting sk->sk_err in this function is the right
> > thing to do.
>
> I agree, in that it is hard to verify that this does not overwrite
> an existing error. This patch only makes the behavior
> consistent between enqueue and dequeue, but perhaps a
> better way to achieve that is to change the dequeue side:
> remove the assignment to sk->sk_err there. If so, then all
> locations that currently check the state of sk->sk_err should
> be changed to also check the qlen of the error queue and
> if non-zero return the embedded error of the first skb. I'll
> take a look whether that is feasible without adding locks
> or atomics in the common path.
That would be great.
>
> > It also depends on socket state bits (e.g. np->recverr) if
> > the update happens. So we still cannot get rid of the protocol dependent
> > sk->sk_err updates.
> >
> > It looks like we have to check all error handling functions in the
> > protocols. Maybe timestamp code needs to adapt?
>
> Does the above sound okay, or did you mean something else?
Best thing would be to not keep the error status two times per socket.
Maybe it would make sense to always synchronize on the error queue and
don't check for sk->sk_err at all? It seems to get very hairy without
taking any locks though.
I even don't know what the semantics for sk_err should be. Should we
leave the oldest error in place until it got fetched? Then we could use
cmpxchg in slow path with 0 as the old value. They could easily become
unsynchronized if the user switches off recverr setsockopt. But I don't
think we need to handle that.
I think best effort should would be ok, too. Not having locked
instructions in fast path is much more important.
Thanks,
Hannes
next prev parent reply other threads:[~2014-09-02 21:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-01 1:28 [PATCH net-next] sock: consistent errqueue errors and signals Willem de Bruijn
2014-09-01 21:25 ` Hannes Frederic Sowa
2014-09-02 15:20 ` Willem de Bruijn
2014-09-02 21:18 ` Hannes Frederic Sowa [this message]
2014-09-03 2:34 ` Willem de Bruijn
2014-09-03 12:14 ` Hannes Frederic Sowa
2014-09-03 19:40 ` Willem de Bruijn
2014-09-04 0:17 ` Hannes Frederic Sowa
2014-09-04 18:13 ` Willem de Bruijn
2014-09-04 18:18 ` Willem de Bruijn
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=1409692691.15984.16.camel@localhost \
--to=hannes@redhat.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=willemb@google.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).