Hi, This patch adds a netif_release_rx_bufs() function to the netfront driver. It intends to fix the rx buffer page leak. Unfortunaly it doesn''t work perfectly, the reason is that reclaiming the pages granted to the backend driver works only if the backend driver gave them back already, filled with network data. Reclaiming unfilled rx buffers does NOT work. I think we need either a way to get back pages with transfer grants without cooperation from the backend driver, or we need some way to say "pretty pretty please, give me back my rx buffers" to the netback driver. comments? Gerd -- Gerd Hoffmann <kraxel@suse.de> http://www.suse.de/~kraxel/julika-dora.jpeg _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On 17/8/06 3:13 pm, "Gerd Hoffmann" <kraxel@suse.de> wrote:> This patch adds a netif_release_rx_bufs() function to the netfront > driver. It intends to fix the rx buffer page leak. Unfortunaly it > doesn''t work perfectly, the reason is that reclaiming the pages granted > to the backend driver works only if the backend driver gave them back > already, filled with network data. Reclaiming unfilled rx buffers does > NOT work. > > I think we need either a way to get back pages with transfer grants > without cooperation from the backend driver, or we need some way to say > "pretty pretty please, give me back my rx buffers" to the netback driver.Unlike a map grant, you can reclaim a transfer grant at any time. The only question is whether it has been used to transfer a page, or not. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser wrote:>> I think we need either a way to get back pages with transfer grants >> without cooperation from the backend driver, or we need some way to say >> "pretty pretty please, give me back my rx buffers" to the netback driver. > > Unlike a map grant, you can reclaim a transfer grant at any time. The only > question is whether it has been used to transfer a page, or not.How can I do that? gnttab_end_foreign_transfer_ref() doesn''t cut it, it will not succeed unconditionally ... cheers, Gerd -- Gerd Hoffmann <kraxel@suse.de> http://www.suse.de/~kraxel/julika-dora.jpeg _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On 17/8/06 4:13 pm, "Gerd Hoffmann" <kraxel@suse.de> wrote:>>> I think we need either a way to get back pages with transfer grants >>> without cooperation from the backend driver, or we need some way to say >>> "pretty pretty please, give me back my rx buffers" to the netback driver. >> >> Unlike a map grant, you can reclaim a transfer grant at any time. The only >> question is whether it has been used to transfer a page, or not. > > How can I do that? gnttab_end_foreign_transfer_ref() doesn''t cut it, it > will not succeed unconditionally ...The function will not spin unboundedly and, when it returns, the grant is definitely no longer active. If any page was transferred via the grant, it is returned to the caller (else zero is returned). It does just what you need. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser wrote:> >> How can I do that? gnttab_end_foreign_transfer_ref() doesn''t cut it, it >> will not succeed unconditionally ... > > The function will not spin unboundedly and, when it returns, the grant is > definitely no longer active. If any page was transferred via the grant, it > is returned to the caller (else zero is returned). It does just what you > need.Oh, ok. I assumed zero return means it failed. Guess I just have to keep track of the original mfns so I can map them back into the address space in case no page was transfered, right? cheers, Gerd -- Gerd Hoffmann <kraxel@suse.de> http://www.suse.de/~kraxel/julika-dora.jpeg _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On 18/8/06 7:43 am, "Gerd Hoffmann" <kraxel@suse.de> wrote:>>> How can I do that? gnttab_end_foreign_transfer_ref() doesn''t cut it, it >>> will not succeed unconditionally ... >> >> The function will not spin unboundedly and, when it returns, the grant is >> definitely no longer active. If any page was transferred via the grant, it >> is returned to the caller (else zero is returned). It does just what you >> need. > > Oh, ok. I assumed zero return means it failed. Guess I just have to > keep track of the original mfns so I can map them back into the address > space in case no page was transfered, right?You''ve given up the original mfns at this point, to ensure you have enough reservation headroom for the transfer. You''ll be wanting to give the ''empty mfn'' to the balloon driver, which can simply stick the page on its ballooned-out list. You might need to add a new API function to balloon driver to do this. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser wrote:> You''ve given up the original mfns at this point, to ensure you have enough > reservation headroom for the transfer. You''ll be wanting to give the ''empty > mfn'' to the balloon driver, which can simply stick the page on its > ballooned-out list. You might need to add a new API function to balloon > driver to do this.Passing the page to the balloon driver works ok, but then I have trouble releasing the skb because shinfo(skb)->frags[0].page isn''t valid any more. Guess I better aquire a page from xen in netfront instead of letting the ballon driver do that ... cheers, Gerd -- Gerd Hoffmann <kraxel@suse.de> http://www.suse.de/~kraxel/julika-dora.jpeg _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On 18/8/06 12:34 pm, "Gerd Hoffmann" <kraxel@suse.de> wrote:> Keir Fraser wrote: >> You''ve given up the original mfns at this point, to ensure you have enough >> reservation headroom for the transfer. You''ll be wanting to give the ''empty >> mfn'' to the balloon driver, which can simply stick the page on its >> ballooned-out list. You might need to add a new API function to balloon >> driver to do this. > > Passing the page to the balloon driver works ok, but then I have trouble > releasing the skb because shinfo(skb)->frags[0].page isn''t valid any > more. Guess I better aquire a page from xen in netfront instead of > letting the ballon driver do that ...Best bet is to free the page to the balloon driver, and then set nr_frags to zero. This is perfectly valid -- it was netfront that set it to non-zero in the first place. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Hi,> Best bet is to free the page to the balloon driver, and then set nr_frags to > zero. This is perfectly valid -- it was netfront that set it to non-zero in > the first place.Perfect. New version of the patch is attached below. cheers, Gerd -- Gerd Hoffmann <kraxel@suse.de> http://www.suse.de/~kraxel/julika-dora.jpeg _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel