netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ian Campbell <Ian.Campbell@citrix.com>
To: Andrew Bennieston <andrew.bennieston@citrix.com>
Cc: <xen-devel@lists.xenproject.org>, <wei.liu2@citrix.com>,
	<paul.durrant@citrix.com>, <netdev@vger.kernel.org>,
	<david.vrabel@citrix.com>
Subject: Re: [PATCH V6 net-next 2/5] xen-netback: Add support for multiple queues
Date: Tue, 18 Mar 2014 10:56:40 +0000	[thread overview]
Message-ID: <1395140200.12847.33.camel@kazak.uk.xensource.com> (raw)
In-Reply-To: <5328246C.6060502@citrix.com>

On Tue, 2014-03-18 at 10:48 +0000, Andrew Bennieston wrote:
[snip... queeues...]

All sounds fine, thanks for the explanations.

> >>   	xen_net_read_rate(dev, &credit_bytes, &credit_usec);
> >>   	read_xenbus_vif_flags(be);
> >>
> >> -	be->vif->num_queues = 1;
> >> +	/* Use the number of queues requested by the frontend */
> >> +	be->vif->num_queues = requested_num_queues;
> >>   	be->vif->queues = vzalloc(be->vif->num_queues *
> >>   			sizeof(struct xenvif_queue));
> >> +	rtnl_lock();
> >> +	netif_set_real_num_tx_queues(be->vif->dev, be->vif->num_queues);
> >> +	rtnl_unlock();
> >
> > I'm always a bit suspicious of this construct -- it makes me thing the
> > call is happening from the wrong context and that the right context
> > would naturally hold the lock already.
> 
> netif_set_real_num_tx_queues() must be called either with this lock
> held, or before the netdev is registered. The netdev is registered early
> so that it can be plugged into a bridge or whatever other network
> configuration has to happen. The point at which we know the correct
> number of tx queues happens in response to the frontend changing
> Xenstore entries, so the rtnl lock is not naturally held here.
> xenvif_carrier_on() and xenvif_carrier_off() also take this lock, but
> they are not the appropriate place to set the number of queues.

Great, just wanted to be sure it had been thought about and not just
"slap a lock around it to make it stop complaining" :-)

> >>   	for (queue_index = 0; queue_index < be->vif->num_queues; ++queue_index) {
> >>   		queue = &be->vif->queues[queue_index];
> >> @@ -547,29 +575,52 @@ static int connect_rings(struct backend_info *be, struct xenvif_queue *queue)
> >>   	unsigned long tx_ring_ref, rx_ring_ref;
> >>   	unsigned int tx_evtchn, rx_evtchn;
> >>   	int err;
> >> +	char *xspath;
> >> +	size_t xspathsize;
> >> +	const size_t xenstore_path_ext_size = 11; /* sufficient for "/queue-NNN" */
> >> +
> >> +	/* If the frontend requested 1 queue, or we have fallen back
> >> +	 * to single queue due to lack of frontend support for multi-
> >> +	 * queue, expect the remaining XenStore keys in the toplevel
> >> +	 * directory. Otherwise, expect them in a subdirectory called
> >> +	 * queue-N.
> >> +	 */
> >> +	if (queue->vif->num_queues == 1) {
> >> +		xspath = (char *)dev->otherend;
> >
> > Casting away a const is naughty. Either make xspath const or if that
> > isn't possible make it dynamic in all cases with a strcpy in this
> > degenerate case.
> >
> 
> Ok, I can change this. I was trying to avoid the strcpy.

Thanks.

Ian.

  reply	other threads:[~2014-03-18 10:56 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-03 11:47 [PATCH V6 net-next 0/5] xen-net{back, front}: Multiple transmit and receive queues Andrew J. Bennieston
2014-03-03 11:47 ` [PATCH V6 net-next 1/5] xen-netback: Factor queue-specific data into queue struct Andrew J. Bennieston
2014-03-14 15:55   ` Ian Campbell
2014-03-17 11:53     ` Andrew Bennieston
2014-03-17 12:19       ` Ian Campbell
2014-03-03 11:47 ` [PATCH V6 net-next 2/5] xen-netback: Add support for multiple queues Andrew J. Bennieston
2014-03-14 16:03   ` Ian Campbell
2014-03-18 10:48     ` Andrew Bennieston
2014-03-18 10:56       ` Ian Campbell [this message]
2014-03-03 11:47 ` [PATCH V6 net-next 3/5] xen-netfront: Factor queue-specific data into queue struct Andrew J. Bennieston
2014-03-03 11:47 ` [PATCH V6 net-next 4/5] xen-netfront: Add support for multiple queues Andrew J. Bennieston
2014-03-03 11:47 ` [PATCH V6 net-next 5/5] xen-net{back, front}: Document multi-queue feature in netif.h Andrew J. Bennieston
2014-03-03 12:53   ` [PATCH V6 net-next 5/5] xen-net{back,front}: " Paul Durrant
2014-03-14 16:04   ` Ian Campbell
2014-03-05 12:38 ` [PATCH V6 net-next 0/5] xen-net{back,front}: Multiple transmit and receive queues Wei Liu
2014-03-05 17:46 ` [Xen-devel] [PATCH V6 net-next 0/5] xen-net{back, front}: " Konrad Rzeszutek Wilk
2014-03-06 16:52 ` Sander Eikelenboom
2014-03-14 16:06   ` Ian Campbell
2014-03-14 16:21     ` Sander Eikelenboom
2014-03-14 16:10 ` [PATCH V6 net-next 0/5] xen-net{back,front}: " Ian Campbell
2014-03-14 16:16   ` [Xen-devel] [PATCH V6 net-next 0/5] xen-net{back, front}: " Ian Campbell

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=1395140200.12847.33.camel@kazak.uk.xensource.com \
    --to=ian.campbell@citrix.com \
    --cc=andrew.bennieston@citrix.com \
    --cc=david.vrabel@citrix.com \
    --cc=netdev@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).