|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH V6 net-next 1/5] xen-netback: Factor queue-specific data into queue struct.
On 14/03/14 15:55, Ian Campbell wrote: On Mon, 2014-03-03 at 11:47 +0000, Andrew J. Bennieston wrote:From: "Andrew J. Bennieston" <andrew.bennieston@xxxxxxxxxx> In preparation for multi-queue support in xen-netback, move the queue-specific data from struct xenvif into struct xenvif_queue, and update the rest of the code to use this. Also[...] Finally,[...]This is already quite a big patch, and I don't think the commit log covers everything it changes/refactors, does it? It's always a good idea to break these things apart but in particular separating the mechanical stuff (s/vif/queue/g) from the non-mechanical stuff, since the mechanical stuff is essentially trivial to review and getting it out the way makes the non-mechanical stuff much easier to check (or even spot). The vast majority of changes in this patch are s/vif/queue/g. The rest are related changes, such as inserting loops over queues, and moving queue-specific initialisation away from the vif-wide initialisation, so that it can be done once per queue. I consider these things to be logically related and definitely within the purview of this single patch. Without doing this, it is difficult to get a patch that results in something that even compiles, without putting in a bunch of placeholder code that will be removed in the very next patch. When I split this feature into multiple patches, I took care to group as little as possible into this first patch (and the same for netfront). It is still a large patch, but by my count most of this is a simple replacement of vif with queue... A first-order approximation, searching for line pairs where the first has 'vif' and the second has 'queue', yields:â xen-netback git:(saturn) git show HEAD~4 | grep -A 1 vif | grep queue | wc -l 380 i.e. 760 (=380*2) lines out of the 2240 (~ 40%) are trivial replacements of vif with queue, and this is not counting multi-line replacements, of which there are many. What remains is mostly adding loops over these queues. This could, in principle, be done in a second patch, but the impact of this is small.
interface.c contains the line: snprintf(name, IFNAMSIZ - 1, "vif%u.%u", domid, handle); This suggests that IFNAMSIZ counts the trailing NULL, so I can reduce this count by 1 on that basis. [...] - /* This array is allocated seperately as it is large */ - struct gnttab_copy *grant_copy_op; + struct gnttab_copy grant_copy_op[MAX_GRANT_COPY_OPS];Is this deliberate? It seems like a retrograde step reverting parts of ac3d5ac27735 "xen-netback: fix guest-receive-side array sizes" from Paul (at least you are nuking a speeling erorr) Yes, this was deliberate. These arrays were moved out to avoid problems with kmalloc for the struct net_device (which contains the struct xenvif in its netdev_priv space). Since the queues are now allocated via vzalloc, there is no need to do separate allocations (with the requirement to also separately free on every error/teardown path) so I moved these back into the main queue structure. How does this series interact with Zoltan's foreign mapping one? Badly I should imagine, are you going to rebase? I'm working on the rebase right now.
It seems to be what a bunch of other net drivers do in this scenario. I guess the reasoning is it'll be faster than a mod num_queues. + /* Obtain the queue to be used to transmit this packet */ + index = skb_get_queue_mapping(skb); + if (index >= vif->num_queues) + index = 0; /* Fall back to queue 0 if out of range */Is this actually allowed to happen? Even if yes, not modulo num_queue so spread it around a bit? This probably isn't allowed to happen. I figured it didn't hurt to be a little defensive with the code here, and falling back to queue 0 is a fairly safe thing to do.
It should be the same as dev->real_num_tx_queues, which may be less than dev->num_tx_queues.
Why not? You can't have a negative number of queues. Zero indicates "I don't have any set up yet". I'm not expecting people to have 4 billion or so queues, but equally I can't see a valid use for negative values here.
Err... yes. I was sure that code existed at some point, but I can't find it now. Oops! -Andrew
_______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |