Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751401AbaKGJZr (ORCPT ); Fri, 7 Nov 2014 04:25:47 -0500 Received: from mail-wi0-f170.google.com ([209.85.212.170]:45016 "EHLO mail-wi0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751121AbaKGJZn (ORCPT ); Fri, 7 Nov 2014 04:25:43 -0500 Message-ID: <545C9013.1090406@linaro.org> Date: Fri, 07 Nov 2014 09:25:39 +0000 From: Zoltan Kiss User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: netdev@vger.kernel.org, "David S. Miller" , Konrad Rzeszutek Wilk , Boris Ostrovsky , David Vrabel , Stefan Bader , Jay Vosburgh , linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org Subject: Re: [Xen-devel] BUG in xennet_make_frags with paged skb data References: <20141106214940.GD44162@ubuntu-hedt> In-Reply-To: <20141106214940.GD44162@ubuntu-hedt> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, AFAIK in this scenario your skb frag is wrong. The page pointer should point to the original compound page (not a member of it), and offset should be set accordingly. For example, if your compound page is 16K (4 page), then the page pointer should point to the first page, and if the data starts at the 3rd page, then offset should be >8K Zoli On 06/11/14 21:49, Seth Forshee wrote: > We've had several reports of hitting the following BUG_ON in > xennet_make_frags with 3.2 and 3.13 kernels (I'm currently awaiting > results of testing with 3.17): > > /* Grant backend access to each skb fragment page. */ > for (i = 0; i < frags; i++) { > skb_frag_t *frag = skb_shinfo(skb)->frags + i; > struct page *page = skb_frag_page(frag); > > len = skb_frag_size(frag); > offset = frag->page_offset; > > /* Data must not cross a page boundary. */ > BUG_ON(len + offset > PAGE_SIZE< > When this happens the page in question is a "middle" page in a compound > page (i.e. it's a tail page but not the last tail page), and the data is > fully contained within the compound page. The data does however cross > the hardware page boundary, and since compound_order evaluates to 0 for > tail pages the check fails. > > In going over this I've been unable to determine whether the BUG_ON in > xennet_make_frags is incorrect or the paged skb data is wrong. I can't > find that it's documented anywhere, and the networking code itself is a > bit ambiguous when it comes to compound pages. On the one hand > __skb_fill_page_desc specifically handles adding tail pages as paged > data, but on the other hand skb_copy_bits kmaps frag->page.p which could > fail with data that extends into another page. > > Can anyone explain what the rules are here? My best guess based on > skb_copy_bits is that paged data should never cross the hardware page > boundary, but I'm not really sure how all of this works out when dealing > with compound pages. > > Thanks, > Seth > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/