Skip to contentSkip to conversation

SetPageForeign in netback

DISCUSSION Zang Hongyong 2 participants 2 messages Jun 18, 2008

lore
Share & tools
lore
#0 lore raw

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 which indicates netback to unmap the page offered by domU, and moves on its tx response.

Is that so?
If so, how about a bad NIC driver which doen't call free_page() after sending data out of machine ?

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() ??

Forgive my silly questions above please.

======= 2008-06-18 18:52:27 您在来信中写道:=======

Quoted 26 lines
Quoted 5 lines

hi,
in netback init mmap_pages,

               SetPageForeign(page, netif_page_release);

that is, page->index = netif_page_release
while netif_page_release is a function.

netif_page_release is a function, and therefore:
page->index = netif_page_release
will store netif_page_release function pointer in 'index'

Quoted 1 line

so what's the meaning of SetPageForeign?

Setting a page foreign means that the page is owned by another domain, and that some care needs to be taken when freeing it.

Quoted 1 line

And when the function netif_page_release() will be called?

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

Hope this helps.

Quoted 9 lines

Cheers
Gr(z)egor(z)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

= = = = = = = = = = = = = = = = = = = =
Zang Hongyong
[email protected]
2008-06-18

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 4 lines

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 which indicates netback to unmap the page offered by domU, and moves on its tx response.

Is that so?

Correct.

Quoted 1 line

If so, how about a bad NIC driver which doen't call free_page() after sending data out of machine ?

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.

Quoted 2 lines

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() ??

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.

Cheers
Gr(z)egor(z)

Quoted 48 lines

Forgive my silly questions above please.

======= 2008-06-18 18:52:27 您在来信中写道:=======

Quoted 26 lines
Quoted 5 lines

hi,
in netback init mmap_pages,

               SetPageForeign(page, netif_page_release);

that is, page->index = netif_page_release
while netif_page_release is a function.

netif_page_release is a function, and therefore:
page->index = netif_page_release
will store netif_page_release function pointer in 'index'

Quoted 1 line

so what's the meaning of SetPageForeign?

Setting a page foreign means that the page is owned by another domain, and that some care needs to be taken when freeing it.

Quoted 1 line

And when the function netif_page_release() will be called?

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

Hope this helps.

Quoted 9 lines

Cheers
Gr(z)egor(z)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

= = = = = = = = = = = = = = = = = = = =
Zang Hongyong
[email protected]
2008-06-18

Quoted 6 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel