From: Wei Liu Subject: Re: Is: SKB_MAX_LEN bites again. Was: Re: bug disabling guest interface Date: Tue, 12 Mar 2013 21:08:13 +0000 Message-ID: <20130312210812.GA21689@zion.uk.xensource.com> References: <5139A56D.30107@crc.id.au> <00bf01ce1c34$395a4f20$ac0eed60$@jacekowski.org> <20130308203636.GA5422@phenom.dumpdata.com> <1362797836.8941.189.camel@hastur.hellion.org.uk> <20130310191838.GA13011@zion.uk.xensource.com> <1363088434.29599.3.camel@zakaz.uk.xensource.com> <1363090704.29093.87.camel@zion.uk.xensource.com> <513F4499.9080804@oracle.com> <1363101940.29093.95.camel@zion.uk.xensource.com> <1363119219.29093.112.camel@zion.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1363119219.29093.112.camel@zion.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: ANNIE LI Cc: 'Steven Haigh' , Ian Campbell , "Palagummi, Siva" , Konrad Rzeszutek Wilk , "xen-devel@lists.xen.org" , "msw@amazon.com" , Jacek Milewicz List-Id: xen-devel@lists.xenproject.org On Tue, Mar 12, 2013 at 08:13:39PM +0000, Wei Liu wrote: > > Actually the copy is done with Hypervisor, I don't know how it is > possible to do coalesce while copying. > > FWIW I came up with an idea. Netback maintains a ring of skb_frag_t > groups. Each group has NETBK_SKB_MAX_FRAGS frags. So overall the size of > this ring is MAX_PENGING_REQS * NETBK_SKB_MAX_FRAGS * > sizeof(skb_frag_t). If NETBK_SKB_MAX_FRAGS == 20, skb_frag_t size == 16, > this ring is 80K large. Just realized two things: 1. the ring size estimation is wrong; 2. we don't need a extra ring for this. :-) We can alter how frags are handled inside netback to solve this issue. We can store start of pending_idx and end of pending_idx in skb->frags[0] and skb->frags[1] if frontend's MAX_SKB_FRAGS is larger than backend's. Wei. > > If we detect frontend's frags > backend's SKB_MAX_FRAGS, we switch to > use the new ring, and set skb->nr_frags to some specific number (say -1) > and has frag[0].page.p set to ring index. Then we copy data as usual. > Later in before xen_netbk_fill_frags if we detect this skb is should be > constructed via previous skb frag ring, we accommodate those frags to > that skb. > > if (skb should be constructed via frag ring) > construct_skb() > else /* normal path > xen_netbk_fill_frags > > This idea is essentially adding a slow path though, because > construct_skb() potentially needs to copy / move data around. > > > Wei. >