From mboxrd@z Thu Jan 1 00:00:00 1970 From: Qin Chuanyu Subject: Re: [PATCH] tun: use netif_receive_skb instead of netif_rx_ni Date: Wed, 12 Feb 2014 09:50:03 +0800 Message-ID: <52FAD34B.3030902@huawei.com> References: <52FA32C5.9040601@huawei.com> <1392132244.6615.83.camel@edumazet-glaptop2.roam.corp.google.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Eric Dumazet , "Michael S. Tsirkin" , KVM list To: Return-path: Received: from szxga03-in.huawei.com ([119.145.14.66]:50524 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752179AbaBLBuW (ORCPT ); Tue, 11 Feb 2014 20:50:22 -0500 In-Reply-To: <1392132244.6615.83.camel@edumazet-glaptop2.roam.corp.google.com> Sender: kvm-owner@vger.kernel.org List-ID: On 2014/2/11 23:24, Eric Dumazet wrote: >> diff --git a/drivers/net/tun.c b/drivers/net/tun.c >> index 44c4db8..90b4e58 100644 >> --- a/drivers/net/tun.c >> +++ b/drivers/net/tun.c >> @@ -1184,7 +1184,9 @@ static ssize_t tun_get_user(struct tun_struct >> *tun, struct tun_file *tfile, >> skb_probe_transport_header(skb, 0); >> >> rxhash =3D skb_get_hash(skb); >> - netif_rx_ni(skb); >> + rcu_read_lock_bh(); >> + netif_receive_skb(skb); >> + rcu_read_unlock_bh(); >> >> tun->dev->stats.rx_packets++; >> tun->dev->stats.rx_bytes +=3D len; > > I already said this patch is not good : > > rcu_read_lock_bh() makes no sense here. > > What is really needed is local_bh_disable(); > > Herbert patch ( http://patchwork.ozlabs.org/patch/52963/ ) had a much > cleaner form. > > Just use it, CC him, credit him, please ? > To: Herbert Xu I saw that you had delivered a patch to resolve the problem of cgroup. patch num is f845172531fb7410c7fb7780b1a6e51ee6df7d52 so would you deliver your patch for tun again? I had test it and found=20 it work well. To: Eric I approve your idea that rcu_read_lock make no sense. but I couldn't understand why dev_queue_xmit use it. What is the difference between vhost thread using tap to xmit skb and=20 another thread use dev_queue_xmit to xmit skb=EF=BC=9F It is really my honor if you could explain it for me. Thanks.