SetPageForeign in netback
Many thanks.
and netbk_tx_pending_timeout() is added since xen3.2. I've not found this timer in xen3.1.
===================================
what about another question:
In netback netif_be_start_xmit()
if (!netif->copying_receiver ||
((skb_headlen(skb) + offset_in_page(skb->data)) >= PAGE_SIZE)) {
struct sk_buff *nskb = netbk_copy_skb(skb);which calls skb_copy_bits()
it means when rx-flip, the skb data and frags are copied to another buffer. then the buffer flip with domU's pages.
so before page flip with domU, copying happens in dom0. Does rx-flip make any sense?
======= 2008-06-23 19:22:37 您在来信中写道:=======
Quoted 184 lines
Quoted 10 lines
thanks. Maybe I understand.
Another question
In netback:
static inline voidmaybe_schedule_tx_action(void){ smp_mb(); if ((NR_PENDING_REQS < (MAX_PENDING_REQS/2)) && !list_empty(&net_schedule_list)) tasklet_schedule(&net_tx_tasklet); }Quoted 8 lines
... ...
while
#defineNR_PENDING_REQS(MAX_PENDING_REQS-pending_prod+pending_cons) that isNR_PENDING_REQS=MAX_PENDING_REQS- (pending_prod-pending_cons)My question is when
NR_PENDING_REQScannot satisfy the above condition "(NR_PENDING_REQS< (MAX_PENDING_REQS/2)"? why not handle the condition of "NR_PENDING_REQS>= (MAX_PENDING_REQS/2)"?If there are many pending requests (more then MAX/2), new requests will have to wait on frontend-backend rings (a form of congestion control). When some of the pending requests get dealt with (and
NR_PENDING_REQSfalls below MAX/2) new ones will be accepted.Also, note that
net_tx_taskletdoesn't only get scheduled bymaybe_schedule_tx_action. There also is:
-netbk_tx_pending_timeout: triggered by a timeout timer
-netif_idx_release: triggered by a net data page being released The threenet_tx_taskletschedulers guarantee continuous flow of skbs out of netback.Cheers
Gr(z)egor(z)Quoted 143 lines
======= 2008-06-19 15:22:58 您在来信中写道:=======
Quoted 128 lines
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
Quoted 112 lines · Zang Hongyong
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 stuff? 2)Is the overall queue and tasklet stuff fair to all vnifs? For example, when vif1.0 rx, the netback driver put its packet to overall queue and do tasklet, 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.======= 2008-06-19 00:37:40 您在来信中写道:=======
Quoted 85 lines
Quoted 7 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, thennetif_page_release()called which indicates netback to unmap the page offered by domU, and moves on its tx response.Is that so?
Correct.
Quoted 2 lines
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 3 lines
and Why
mmap_pagesis allocated byalloc_empty_pages_and_pagevec(MAX_PENDING_REQS)?
canmmap_pagesbe allocated byalloc_vm_area()andvmalloc_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 thinkalloc_vm_areadoes 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 initmmap_pages,SetPageForeign(page, netif_page_release);that is,
page->index=netif_page_release
whilenetif_page_releaseis a function.
netif_page_releaseis a function, and therefore:page->index=netif_page_release
will storenetif_page_releasefunction 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
andfree_hot_cold_pageHope 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-18Quoted 6 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-develQuoted 5 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel= = = = = = = = = = = = = = = = = = = =
Zang Hongyong
[email protected]
2008-06-19Quoted 4 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-develQuoted 4 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel= = = = = = = = = = = = = = = = = = = =
Zang Hongyong
[email protected]
2008-06-22Quoted 6 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 5 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
= = = = = = = = = = = = = = = = = = = =
Zang Hongyong
[email protected]
2008-06-23
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 11 lines
what about another question:
In netback
netif_be_start_xmit()if (!netif->copying_receiver || ((skb_headlen(skb) + offset_in_page(skb->data)) >= PAGE_SIZE)) { struct sk_buff *nskb = netbk_copy_skb(skb);which calls
skb_copy_bits()it means when rx-flip, the skb data and frags are copied to another buffer. then the buffer flip with domU's pages.
so before page flip with domU, copying happens in dom0. Does rx-flip make any sense?
The reason why you have to copy is to make sure that you pull the skb into a fresh page (which doesn't have any other pieces of data in it). It's only then that you can flip it to DomU.
It used to be the case that the backend was more efficient in the rx-flip mode. Some/most skbs copies were avoided by keeping a close eye on the skb allocation. Since rx-flip is now only/mostly kept for backward compatibility (rx-copy is the default) the code was simplified.
Note: with grant table copy you can ask the hypervisor to copy sub-page regions (in our case you can match the size of the skb)
Cheers
Gr(z)egor(z)
Quoted 201 lines
======= 2008-06-23 19:22:37 您在来信中写道:=======
Quoted 184 lines
Quoted 10 lines
thanks. Maybe I understand.
Another question
In netback:
static inline voidmaybe_schedule_tx_action(void){ smp_mb(); if ((NR_PENDING_REQS < (MAX_PENDING_REQS/2)) && !list_empty(&net_schedule_list)) tasklet_schedule(&net_tx_tasklet); }Quoted 8 lines
... ...
while
#defineNR_PENDING_REQS(MAX_PENDING_REQS-pending_prod+pending_cons) that isNR_PENDING_REQS=MAX_PENDING_REQS- (pending_prod-pending_cons)My question is when
NR_PENDING_REQScannot satisfy the above condition "(NR_PENDING_REQS< (MAX_PENDING_REQS/2)"? why not handle the condition of "NR_PENDING_REQS>= (MAX_PENDING_REQS/2)"?If there are many pending requests (more then MAX/2), new requests will have to wait on frontend-backend rings (a form of congestion control). When some of the pending requests get dealt with (and
NR_PENDING_REQSfalls below MAX/2) new ones will be accepted.Also, note that
net_tx_taskletdoesn't only get scheduled bymaybe_schedule_tx_action. There also is:
-netbk_tx_pending_timeout: triggered by a timeout timer
-netif_idx_release: triggered by a net data page being released The threenet_tx_taskletschedulers guarantee continuous flow of skbs out of netback.Cheers
Gr(z)egor(z)Quoted 143 lines
======= 2008-06-19 15:22:58 您在来信中写道:=======
Quoted 128 lines
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
Quoted 112 lines · Zang Hongyong
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 stuff? 2)Is the overall queue and tasklet stuff fair to all vnifs? For example, when vif1.0 rx, the netback driver put its packet to overall queue and do tasklet, 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.======= 2008-06-19 00:37:40 您在来信中写道:=======
Quoted 85 lines
Quoted 7 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, thennetif_page_release()called which indicates netback to unmap the page offered by domU, and moves on its tx response.Is that so?
Correct.
Quoted 2 lines
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 3 lines
and Why
mmap_pagesis allocated byalloc_empty_pages_and_pagevec(MAX_PENDING_REQS)?
canmmap_pagesbe allocated byalloc_vm_area()andvmalloc_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 thinkalloc_vm_areadoes 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 initmmap_pages,SetPageForeign(page, netif_page_release);that is,
page->index=netif_page_release
whilenetif_page_releaseis a function.
netif_page_releaseis a function, and therefore:page->index=netif_page_release
will storenetif_page_releasefunction 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
andfree_hot_cold_pageHope 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-18Quoted 6 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-develQuoted 5 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel= = = = = = = = = = = = = = = = = = = =
Zang Hongyong
[email protected]
2008-06-19Quoted 4 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-develQuoted 4 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel= = = = = = = = = = = = = = = = = = = =
Zang Hongyong
[email protected]
2008-06-22Quoted 6 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-develQuoted 5 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel= = = = = = = = = = = = = = = = = = = =
Zang Hongyong
[email protected]
2008-06-23
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