From: "Jan Beulich" Subject: Re: netback BUG_ON when using copy_skb=1 Date: Wed, 16 Oct 2013 12:10:14 +0100 Message-ID: <525E903602000078000FB6DF@nat28.tlf.novell.com> References: <525E125B.80100@huawei.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VWOzd-0007lZ-Nh for xen-devel@lists.xenproject.org; Wed, 16 Oct 2013 11:10:22 +0000 In-Reply-To: <525E125B.80100@huawei.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: jerry Cc: xen-devel , Wei Liu , stefano.stabellini@eu.citrix.com List-Id: xen-devel@lists.xenproject.org >>> On 16.10.13 at 06:13, jerry wrote: > Hi Wei Liu, > > I am doing some network performance on Xen4.1.2 and kernel 3.0, and get a > crash with BUG_ON(netbk->mmap_pages[idx] != page) in netbk_gop_frag() > accidentally. > > By analyzing the module drivers/xen/netback, You aren't looking at the upstream driver, are you? If so, Wei is very likely the wrong addressee. Assuming that you instead talk of the SLE11 kernel, I can only point out that a problem in that code was found and fixed a couple of months ago (resulting in the BUG_ON() you quoted not being there anymore), so you're simply not looking at up-to-date code. Jan > I think the reason is as > follows when sending packets from VM1 to VM2: > 1) The two netback thread(the first for VM1 sending, second for VM2 > receiving) run concurrently. > 2) In first netback thread, it will do delayed copy from a foreign granted > page to local memory when some outstanding packets have been pending too > long( above half of one HZ). > Then netbk->mmap_pages[idx] will be replaced with new allocated page. > 3) If the packets are forwarded to VM2 by virtual switch, netbk_gop_frag() > will be called in second netback thread. > And that function will judge whether the pages in skb frags[] is foreign > in order to make sure how to do grant copy. > 4) If the page replacing was done after the page foreign judge in > netbk_gop_frag(), the BUG will be invoked because the page from skb frags[] > are different with mmap_pages[idx]. > > I tried to using spin_lock to protect the page accessing, but no appropriate > solutions was found. > How to fix this problem? Would you like to share some opinions? > > In addition, I have tried to turn off copy_skb. Then the vif netdevice may > not be released after shutting down VM, > that's because outstanding packets hold the reference count of the device > too long for some unknown reason. > The reason may be that the NIC does not release packets after DMA. > Does anyone have met such problems? Thanks. > > Best regards, > Jerry > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel