|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH net-next v5 1/9] xen-netback: Introduce TX grant map definitions
On 18/02/14 17:06, Ian Campbell wrote: I've created two patches because they are quite huge even now, separately. Together they would be a ~500 line change. That was the best I could figure out keeping in mind that bisect should work. But as I wrote in the first email, I welcome other suggestions. If you and Wei prefer this two patch in one big one, I merge them in the next version.On Mon, 2014-01-20 at 21:24 +0000, Zoltan Kiss wrote:This patch contains the new definitions necessary for grant mapping.Is this just adding a bunch of (currently) unused functions? That's a slightly odd way to structure a series. They don't seem to be "generic helpers" or anything so it would be more normal to introduce these as they get used -- it's a bit hard to review them out of context. v2:This sort of intraversion changelog should go after the S-o-b and a "---" marker. This way they are not included in the final commit message. Ok, I'll do that. If you haven't unmapped it before, then you have to call it. I'll clarify the comment@@ -226,6 +248,12 @@ bool xenvif_rx_ring_slots_available(struct xenvif *vif, int needed); void xenvif_stop_queue(struct xenvif *vif); +/* Callback from stack when TX packet can be released */ +void xenvif_zerocopy_callback(struct ubuf_info *ubuf, bool zerocopy_success); + +/* Unmap a pending page, usually has to be called before xenvif_idx_release */"usually" or always? How does one determine when it is or isn't appropriate to call it later? diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c index 7669d49..f0f0c3d 100644 --- a/drivers/net/xen-netback/interface.c +++ b/drivers/net/xen-netback/interface.c @@ -38,6 +38,7 @@ #include <xen/events.h> #include <asm/xen/hypercall.h> +#include <xen/balloon.h>What is this for? For alloc/free_xenballooned_pages It is called from tx_build_gop and get_requests, and the non-mapping code will go away. I have a patch on top of this series which does grant copy for the header part, but it doesn't create a separate function for the single copy operation, and you'll still call this function from build_gops to handle the rest of the first slot (if any) So TX will have only one kind of gop. Yes. I moved this to an ubuf_to_vif helper for the next version of the patch series Yes, as the comment right above explains. This actually comes from classic kernel's netif_idx_release Or what is dealloc_lock protecting against? The callbacks from each other. So it is checjed only in this function. Nope, if the dealloc ring is full, the value of the last increment won't be used to index the dealloc ring again until some space made available. Of course if something broke and we have more pending slots than tx ring or dealloc slots then it can happen. Do you suggest a BUG_ON(vif->dealloc_prod - vif->dealloc_cons >= MAX_PENDING_REQS)?+ vif->dealloc_prod++;What happens if the dealloc ring becomes full, will this wrap and cause havoc? No, unless the same thing happen as at my previous answer. BUG_ON() here as well? dealloc_cons only used in the dealloc_thread. dealloc_prod is used by the callback and the thread as well, that's why we need mb() in previous. Btw. this function comes from classic's net_tx_action_dealloc+ } + + } while (dp != vif->dealloc_prod); + + vif->dealloc_cons = dc;No barrier here?
Ok, I'll change that. Not yet, good point. I guess if we successfully mapped the page, then there is no way a frontend to prevent unmapping. But worth further checking.Have you considered whether or not the frontend can force this error to occur? This is called only from the NAPI instance. Using the dealloc ring require synchronization with the callback which can increase lock contention. On the other hand, if the guest sends small packets (<PAGE_SIZE), the TLB flushing can cause performance penalty. The above mentioned upcoming patch which gntcopy the header can prevent that (together with Malcolm's Xen side patch, which prevents TLB flush if the page were not touched in Dom0) Yes. In the first versions I've put the dealloc in the NAPI instance (similarly as in classic, where it happened in tx_action), but that had an unexpected performance penalty: the callback has to notify whoever does the dealloc, that there is something to do. If it is the NAPI instance, it has to call napi_schedule. But if the packet were delivered to an another guest, the callback is called from thread context, and according to Eric Dumazet, napi_schedule from thread context can significantly delay softirq handling. So NAPI instance were delayed with miliseconds, and it caused terrible performance. Moving this to the RX thread haven't seemed like a wise decision, so I made a new thread. Actually in the next version of the patches I'll reintroduce __napi_schedule in the callback again, because if the NAPI instance still have unconsumed requests but not enough pending slots, it deschedule itself, and the callback has to schedule it again, if: - unconsumed requests in the ring < XEN_NETBK_LEGACY_SLOTS_MAX - there are enough free pending slots to handle them - and the NAPI instance is not scheduled yetThis should really happen if netback is faster than target devices, but then it doesn't mean a bottleneck. Zoli _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |