All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Bennieston <andrew.bennieston@citrix.com>
To: Paul Durrant <Paul.Durrant@citrix.com>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: Wei Liu <wei.liu2@citrix.com>, Ian Campbell <Ian.Campbell@citrix.com>
Subject: Re: [PATCH RFC 1/4] xen-netback: Factor queue-specific data into queue struct.
Date: Thu, 16 Jan 2014 11:06:41 +0000	[thread overview]
Message-ID: <52D7BD41.70408@citrix.com> (raw)
In-Reply-To: <9AAE0902D5BC7E449B7C8E4E778ABCD0208FAE@AMSPEX01CL01.citrite.net>

Subject:   Re: [PATCH RFC 1/4] xen-netback: Factor queue-specific data
into queue struct.  To:        Paul Durrant
<Paul.Durrant@citrix.com>,"xen-devel@lists.xenproject.org"
<xen-devel@lists.xenproject.org> Cc:        Ian Campbell
<Ian.Campbell@citrix.com>,Wei Liu <wei.liu2@citrix.com> Bcc:
-=-=-=-=-=-=-=-=-=# Don't remove this line #=-=-=-=-=-=-=-=-=- On
16/01/14 11:03, Paul Durrant wrote:
>> -----Original Message----- From: Andrew Bennieston
>> [mailto:andrew.bennieston@citrix.com] Sent: 16 January 2014 10:39 To:
>> Paul Durrant; xen-devel@lists.xenproject.org Cc: Ian Campbell; Wei
>> Liu Subject: Re: [PATCH RFC 1/4] xen-netback: Factor queue-specific
>> data into queue struct.
>>
>> On 16/01/14 10:23, Paul Durrant wrote:
>>>> -----Original Message----- From: Andrew J. Bennieston
>>>> [mailto:andrew.bennieston@citrix.com] Sent: 15 January 2014 16:23
>>>> To: xen-devel@lists.xenproject.org Cc: Ian Campbell; Wei Liu; Paul
>>>> Durrant; Andrew Bennieston Subject: [PATCH RFC 1/4] xen-netback:
>>>> Factor queue-specific data into queue struct.
>>>>
>>>> From: "Andrew J. Bennieston" <andrew.bennieston@citrix.com>
>>>>
>>>> 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 adds loops over queues where appropriate, even though only one
>>>> is configured at this point, and uses alloc_netdev_mq() and the
>>>> corresponding multi-queue netif wake/start/stop functions in
>>>> preparation for multiple active queues.
>>>>
>>>> Finally, implements a trivial queue selection function suitable for
>>>> ndo_select_queue, which simply returns 0 for a single queue and
>>>> uses skb_get_rxhash() to compute the queue index otherwise.
>>>>
>>>> Signed-off-by: Andrew J. Bennieston <andrew.bennieston@citrix.com>
>>>> --- drivers/net/xen-netback/common.h    |   66 +++--
>>>> drivers/net/xen-netback/interface.c |  308 +++++++++++++--------
>>>> drivers/net/xen-netback/netback.c   |  516
>>>> +++++++++++++++++---------
>> ----
>>>> ----- drivers/net/xen-netback/xenbus.c    |   89 ++++-- 4 files
>>>> changed, 556 insertions(+), 423 deletions(-)
>>>>
>>>> diff --git a/drivers/net/xen-netback/common.h b/drivers/net/xen-
>>>> netback/common.h index c47794b..54d2eeb 100644 ---
>>>> a/drivers/net/xen-netback/common.h +++
>>>> b/drivers/net/xen-netback/common.h @@ -108,17 +108,19 @@ struct
>>>> xenvif_rx_meta { */ #define MAX_GRANT_COPY_OPS (MAX_SKB_FRAGS *
>>>> XEN_NETIF_RX_RING_SIZE)
>>>>
>>>> -struct xenvif { -	/* Unique identifier for this interface. */ -
>>>> domid_t          domid; -	unsigned int     handle; +struct xenvif;
>>>> + +struct xenvif_queue { /* Per-queue data for xenvif */ +	unsigned
>>>> int number; /* Queue number, 0-based */ +	char name[IFNAMSIZ+4];
>>>> /* DEVNAME-qN */
>>>
>>> I wonder whether it would be neater to #define the name size here...
>>>
>>
>> Absolutely. I'll do this in V2.
>>
>>>> +	struct xenvif *vif; /* Parent VIF */
>>>>
>>>>    	/* Use NAPI for guest TX */ struct napi_struct napi; /* When
>>>>    	feature-split-event-channels = 0, tx_irq = rx_irq. */
>>>>    	unsigned int tx_irq; /* Only used when
>>>>    	feature-split-event-channels = 1 */ -	char
>>>>    	tx_irq_name[IFNAMSIZ+4]; /* DEVNAME-tx */ +	char
>>>>    	tx_irq_name[IFNAMSIZ+7]; /* DEVNAME-qN-tx */
>>>
>>> ...and the IRQ name size here. It's kind of ugly to have +
>>> some_magic_value
>> in array definitions.
>>>
>>
>> As above.
>>
>>>>    	struct xen_netif_tx_back_ring tx; struct sk_buff_head
>>>>    	tx_queue; struct page *mmap_pages[MAX_PENDING_REQS]; @@
>>>>    	-140,7 +142,7 @@ struct xenvif { /* When
>>>>    	feature-split-event-channels = 0, tx_irq = rx_irq. */
>>>>    	unsigned int rx_irq; /* Only used when
>>>>    	feature-split-event-channels = 1 */ -	char
>>>>    	rx_irq_name[IFNAMSIZ+4]; /* DEVNAME-rx */ +	char
>>>>    	rx_irq_name[IFNAMSIZ+7]; /* DEVNAME-qN-rx */ struct
>>>>    	xen_netif_rx_back_ring rx; struct sk_buff_head rx_queue;
>>>>
>>>> @@ -150,14 +152,27 @@ struct xenvif { */ RING_IDX rx_req_cons_peek;
>>>>
>>>> -	/* 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];
>>>
>>> I see you brought this back in line, which is reasonable as the
>>> queue is now
>> a separately allocated struct.
>>>
>>
>> Indeed; trying to keep the number of separate allocs/frees to a
>> minimum, for everybody's sanity!
>>
>>>>
>>>>    	/* We create one meta structure per ring request we consume,
>>>>    	so * the maximum number is the same as the ring size.  */
>>>>    	struct xenvif_rx_meta meta[XEN_NETIF_RX_RING_SIZE];
>>>>
>>>> +	/* Transmit shaping: allow 'credit_bytes' every 'credit_usec'.
>>>> */ +	unsigned long   credit_bytes; +	unsigned long   credit_usec;
>>>> +	unsigned long   remaining_credit; +	struct timer_list
>>>> credit_timeout; +	u64 credit_window_start; + +}; + +struct xenvif
>>>> { +	/* Unique identifier for this interface. */ +	domid_t
>>>> domid; +	unsigned int     handle; + u8
>>>> fe_dev_addr[6];
>>>>
>>>>    	/* Frontend feature information. */ @@ -171,12 +186,9 @@
>>>>    	struct xenvif { /* Internal feature information. */ u8
>>>>    	can_queue:1;	    /* can queue packets for receiver? */
>>>>
>>>> -	/* Transmit shaping: allow 'credit_bytes' every 'credit_usec'.
>>>> */ -	unsigned long   credit_bytes; -	unsigned long   credit_usec;
>>>> -	unsigned long   remaining_credit; -	struct timer_list
>>>> credit_timeout; -	u64 credit_window_start; +	/* Queues */ +
>>>> unsigned int num_queues; +	struct xenvif_queue *queues;
>>>>
>>>>    	/* Statistics */
>>>
>>> Do stats need to be per-queue (and then possibly aggregated at query
>> time)?
>>>
>>
>> Aside from the potential to see the stats for each queue, which may
>> be useful in some limited circumstances for performance testing or
>> debugging, I don't see what this buys us...
>>
>
> Well, if you have multiple queues running simultaneously, do you make
> sure global stats are atomically adjusted? I didn't see any code to
> that effect, and since atomic ops are expensive it's usually better to
> keep per queue stats and aggregate at the point of query.
Good point. I'll do per-queue stats in V2.

Andrew

  reply	other threads:[~2014-01-16 11:06 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-15 16:23 [PATCH RFC 0/4]: xen-net{back, front}: Multiple transmit and receive queues Andrew J. Bennieston
2014-01-15 16:23 ` [PATCH RFC 1/4] xen-netback: Factor queue-specific data into queue struct Andrew J. Bennieston
2014-01-16  0:17   ` Wei Liu
2014-01-16  9:54     ` Andrew Bennieston
2014-01-16 11:33       ` Wei Liu
2014-01-16 11:55         ` Andrew Bennieston
2014-01-16 10:23   ` Paul Durrant
2014-01-16 10:38     ` Andrew Bennieston
2014-01-16 11:03       ` Paul Durrant
2014-01-16 11:06         ` Andrew Bennieston [this message]
2014-01-15 16:23 ` [PATCH RFC 2/4] xen-netback: Add support for multiple queues Andrew J. Bennieston
2014-01-16  0:18   ` Wei Liu
2014-01-16 10:04     ` Andrew Bennieston
2014-01-16 10:28   ` Paul Durrant
2014-01-16 10:40     ` Andrew Bennieston
2014-01-15 16:23 ` [PATCH RFC 3/4] xen-netfront: Factor queue-specific data into queue struct Andrew J. Bennieston
2014-01-16  0:25   ` Wei Liu
2014-01-16 10:08     ` Andrew Bennieston
2014-01-15 16:23 ` [PATCH RFC 4/4] xen-netfront: Add support for multiple queues Andrew J. Bennieston
2014-01-16  0:27   ` Wei Liu
2014-01-16 10:24     ` Andrew Bennieston
2014-01-16 10:39       ` David Vrabel
2014-01-16 10:41         ` Andrew Bennieston
2014-01-16 11:04           ` David Vrabel
2014-01-16 11:44         ` Wei Liu
2014-01-24 18:05   ` Konrad Rzeszutek Wilk
2014-01-27 10:26     ` Andrew Bennieston
2014-01-16  0:13 ` [PATCH RFC 0/4]: xen-net{back, front}: Multiple transmit and receive queues Wei Liu
2014-01-16  9:36   ` Andrew Bennieston
2014-01-16 10:04 ` Paul Durrant
2014-01-16 10:27   ` Andrew Bennieston

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52D7BD41.70408@citrix.com \
    --to=andrew.bennieston@citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=Paul.Durrant@citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.