From: Keir Fraser Subject: Re: SetPageForeign in netback Date: Thu, 19 Jun 2008 08:22:58 +0100 Message-ID: References: <20080619003236.AD8D813681C@ncic.ac.cn> Mime-Version: 1.0 Content-Type: text/plain; charset="GB2312" Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <20080619003236.AD8D813681C@ncic.ac.cn> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Zang Hongyong , gm281 Cc: xen-devel List-Id: xen-devel@lists.xenproject.org The aim is to achieve batching and scheduling of work (to some extent) on both the transmit and receive paths. So no vif gets starved, and larger batches of packets are handled more efficiently. -- Keir On 19/6/08 01:40, "Zang Hongyong" wrote: > Thanks again! > Another question about netback. > tasklet is used in both tx and rx. Lets take a look at rx, Before tasklet= , > packets of all vnifs must be queued together, and in tasklet packet will = be > dequeued, and handled to its proper netfront of domU. > 1)why not handle packet directly without the overall queue and tasklet st= uff? > 2)Is the overall queue and tasklet stuff fair to all vnifs? For example=A3=AC= when > vif1.0 rx, the netback driver put its packet to overall queue and do task= let, > while in tasklet, packets belonging to other vif maybe handled. > I've noticed when tx, netfront handle packet directly to its proper > Ring,Request stuff. >=20 >=20 >=20 > =3D=3D=3D=3D=3D=3D=3D 2008-06-19 00:37:40 =C4=FA=D4=DA=C0=B4=D0=C5=D6=D0=D0=B4=B5=C0=A3=BA=3D=3D=3D=3D=3D=3D=3D >=20 >>> Many thanks! >>> And that is, when tx, after the data page is sent by native Nic driver = in >>> dom0, the data page will be freed, then netif_page_release() called whi= ch >>> indicates netback to unmap the page offered by domU, and moves on its t= x >>> response. >>>=20 >>> Is that so? >>=20 >> Correct. >>=20 >>> If so, how about a bad NIC driver which doen't call free_page() after >>> sending data out of machine ? >>=20 >> Well, it could happen if there was a memory leak in the driver. This >> would also be present in non-xenified linux. We are hoping for >> bug-free device drivers. >>=20 >>=20 >>> and Why mmap_pages is allocated by >>> alloc_empty_pages_and_pagevec(MAX_PENDING_REQS)? >>> can mmap_pages be allocated by alloc_vm_area() and vmalloc_to_page() ?= ? >>=20 >> alloc_empty_pages_and_pagevec() balloons machine memory frames away >> from Dom0, you are therefore left with pseudo-physical page that's not >> backed by real memory. You want that, because you'll substitute DomU's >> memory frame in it's place. I don't think alloc_vm_area does that. It >> would only allocate virtually continuous range of memory. >>=20 >> Cheers >> Gr(z)egor(z) >>=20 >>>=20 >>> Forgive my silly questions above please. >>>=20 >>>=20 >>> =3D=3D=3D=3D=3D=3D=3D 2008-06-18 18:52:27 =C4=FA=D4=DA=C0=B4=D0=C5=D6=D0=D0=B4=B5=C0=A3=BA=3D=3D=3D=3D=3D=3D=3D >>>=20 >>>>> hi, >>>>> in netback init mmap_pages, >>>>> SetPageForeign(page, netif_page_release); >>>>> that is, page->index =3D netif_page_release >>>>> while netif_page_release is a function. >>>>=20 >>>> netif_page_release is a function, and therefore: >>>> page->index =3D netif_page_release >>>> will store netif_page_release function pointer in 'index' >>>>=20 >>>>> so what's the meaning of SetPageForeign? >>>>=20 >>>> Setting a page foreign means that the page is owned by another domain, >>>> and that some care needs to be taken when freeing it. >>>>=20 >>>>> And when the function netif_page_release() will be called? >>>>=20 >>>> Whenever PageForeignDestructor is called (as it calls the destructor >>>> function stored in the 'index' field). >>>> PageForeignDestructor is called from: >>>> __free_pages_ok >>>> and >>>> free_hot_cold_page >>>>=20 >>>> Hope this helps. >>>>=20 >>>> Cheers >>>> Gr(z)egor(z) >>>>=20 >>>> _______________________________________________ >>>> Xen-devel mailing list >>>> Xen-devel@lists.xensource.com >>>> http://lists.xensource.com/xen-devel >>>>=20 >>>>=20 >>>=20 >>> =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D >>> Zang Hongyong >>> zanghongyong@ncic.ac.cn >>> 2008-06-18 >>>=20 >>>=20 >>> _______________________________________________ >>> Xen-devel mailing list >>> Xen-devel@lists.xensource.com >>> http://lists.xensource.com/xen-devel >>>=20 >>>=20 >> _______________________________________________ >> Xen-devel mailing list >> Xen-devel@lists.xensource.com >> http://lists.xensource.com/xen-devel >>=20 >=20 > =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D > Zang Hongyong > zanghongyong@ncic.ac.cn > 2008-06-19 >=20 > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel