From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762624AbdADDET (ORCPT ); Tue, 3 Jan 2017 22:04:19 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46654 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756490AbdADDEL (ORCPT ); Tue, 3 Jan 2017 22:04:11 -0500 Subject: Re: [PATCH net-next V2 3/3] tun: rx batching To: Stefan Hajnoczi References: <1482912571-3157-1-git-send-email-jasowang@redhat.com> <1482912571-3157-4-git-send-email-jasowang@redhat.com> <20170103133303.GC14707@stefanha-x1.localdomain> Cc: mst@redhat.com, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org From: Jason Wang Message-ID: <73da2ef8-2454-5614-d637-0ce7c5287433@redhat.com> Date: Wed, 4 Jan 2017 11:03:32 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20170103133303.GC14707@stefanha-x1.localdomain> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 04 Jan 2017 03:03:40 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2017年01月03日 21:33, Stefan Hajnoczi wrote: > On Wed, Dec 28, 2016 at 04:09:31PM +0800, Jason Wang wrote: >> +static int tun_rx_batched(struct tun_file *tfile, struct sk_buff *skb, >> + int more) >> +{ >> + struct sk_buff_head *queue = &tfile->sk.sk_write_queue; >> + struct sk_buff_head process_queue; >> + int qlen; >> + bool rcv = false; >> + >> + spin_lock(&queue->lock); > Should this be spin_lock_bh()? Below and in tun_get_user() there are > explicit local_bh_disable() calls so I guess BHs can interrupt us here > and this would deadlock. sk_write_queue were accessed only in this function which runs under process context, so no need for spin_lock_bh() here.