netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Xi Wang <xii@google.com>, "David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org, "Michael S. Tsirkin" <mst@redhat.com>,
	Maxim Krasnyansky <maxk@qti.qualcomm.com>,
	Neal Cardwell <ncardwell@google.com>,
	Eric Dumazet <edumazet@google.com>
Subject: Re: [PATCH v2] net-tun: restructure tun_do_read for better sleep/wakeup efficiency
Date: Tue, 20 May 2014 12:44:01 +0800	[thread overview]
Message-ID: <537ADD91.4000609@redhat.com> (raw)
In-Reply-To: <1400508587.5367.37.camel@edumazet-glaptop2.roam.corp.google.com>

On 05/19/2014 10:09 PM, Eric Dumazet wrote:
> On Mon, 2014-05-19 at 17:27 +0800, Jason Wang wrote:
>
>> Still a little bit difference. We check the reg_state after we're sure
>> there's nothing left in sk_receive_queue. But this patch returns -EIO
>> before trying to dequeue skb.
> Do you think its a problem, other than a simple difference of behavior ?

 I just point out the possible issues.
>
> Is this -EIO thing a hard requirement, or a side effect ?

Probably not, but it's really not hard to keep this.
>
> Either we try to converge things, or we keep this driver a pile of
> copy/pasted stuff from other locations, missing improvements we did
> in core networking stack, because of some supposed differences.

Agree, but we'd better separate the unrelated changes into other patches
to simplify review and speed up convergence.
>
> About the sk_data_ready() and wake_up_all(), you missed the whole part
> of the patch I think.
>
> Check how sock_def_readable() does everything properly and efficiently,
> including the async part.

But this changes (sk_data_ready()) has nothing related to switching to
use __skb_recv_datagram()

The async part may not work since tun has its own implementation of fasync.
>
> static void sock_def_readable(struct sock *sk)
> {
>         struct socket_wq *wq;
>
>         rcu_read_lock();
>         wq = rcu_dereference(sk->sk_wq);
>         if (wq_has_sleeper(wq))
>                 wake_up_interruptible_sync_poll(&wq->wait, POLLIN | POLLPRI |
>                                                 POLLRDNORM | POLLRDBAND);
>         sk_wake_async(sk, SOCK_WAKE_WAITD, POLL_IN);
>         rcu_read_unlock();
> }
>
> Using sk_data_ready() is the way to reach sock_def_readable()
> as its not an EXPORT_SYMBOL.
>
> If this driver was using the common interface, we would not have
> these false sharing problems, that were solved a long time ago.

Yes, but better with a separate patch.

We can probably rework the tun_fasync() to use sock_fasync(), but using
sk_data_ready() in tun_detach_all() is still questionable. We may not
want to send EIO to userspace when tun device is destroying.
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2014-05-20  4:44 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-16 22:11 [PATCH v2] net-tun: restructure tun_do_read for better sleep/wakeup efficiency Xi Wang
2014-05-19  9:27 ` Jason Wang
2014-05-19 14:09   ` Eric Dumazet
2014-05-20  4:44     ` Jason Wang [this message]
2014-05-20  4:52       ` Eric Dumazet
2014-05-20  6:35         ` Michael S. Tsirkin
2014-05-20  5:11       ` Eric Dumazet
2014-05-20  6:03         ` Jason Wang
2014-05-20  6:34           ` Michael S. Tsirkin
2014-05-20  6:55             ` Jason Wang
2014-05-20 13:59           ` Eric Dumazet
2014-05-21  4:45             ` Jason Wang
2014-05-19 16:06   ` Michael S. Tsirkin
2014-05-20  4:51     ` Jason Wang
2014-05-20  6:22       ` Michael S. Tsirkin
2014-05-20  6:40         ` Jason Wang
2014-05-21  7:54 ` Michael S. Tsirkin
2014-05-21 19:51 ` David Miller

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=537ADD91.4000609@redhat.com \
    --to=jasowang@redhat.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=maxk@qti.qualcomm.com \
    --cc=mst@redhat.com \
    --cc=ncardwell@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=xii@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).