mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Arianna Avanzini <avanzini.arianna@gmail.com>
Cc: boris.ostrovsky@oracle.com, david.vrabel@citrix.com,
	xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org,
	hch@infradead.org, bob.liu@oracle.com,
	felipe.franciosi@citrix.com, axboe@fb.com
Subject: Re: [PATCH RFC v2 5/5] xen, blkback: negotiate of the number of block rings with the frontend
Date: Wed, 1 Oct 2014 16:23:53 -0400	[thread overview]
Message-ID: <20141001202353.GE12581@laptop.dumpdata.com> (raw)
In-Reply-To: <1410479844-2864-6-git-send-email-avanzini.arianna@gmail.com>

On Fri, Sep 12, 2014 at 01:57:24AM +0200, Arianna Avanzini wrote:
> This commit lets the backend driver advertise the number of available
> hardware queues; it also implements gathering from the frontend driver
> the number of rings actually available for mapping.
> 
> Signed-off-by: Arianna Avanzini <avanzini.arianna@gmail.com>
> ---
>  drivers/block/xen-blkback/xenbus.c | 44 +++++++++++++++++++++++++++++++++++++-
>  1 file changed, 43 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
> index a4f13cc..9ff6ced 100644
> --- a/drivers/block/xen-blkback/xenbus.c
> +++ b/drivers/block/xen-blkback/xenbus.c
> @@ -477,6 +477,34 @@ static void xen_vbd_free(struct xen_vbd *vbd)
>  	vbd->bdev = NULL;
>  }
>  
> +static int xen_advertise_hw_queues(struct xen_blkif *blkif,
> +				   struct request_queue *q)
> +{
> +	struct xen_vbd *vbd = &blkif->vbd;
> +	struct xenbus_transaction xbt;
> +	int err;
> +
> +	if (q && q->mq_ops)
> +		vbd->nr_supported_hw_queues = q->nr_hw_queues;
> +
> +	err = xenbus_transaction_start(&xbt);
> +	if (err) {
> +		BUG_ON(!blkif->be);
> +		xenbus_dev_fatal(blkif->be->dev, err, "starting transaction (hw queues)");
> +		return err;
> +	}
> +
> +	err = xenbus_printf(xbt, blkif->be->dev->nodename, "nr_supported_hw_queues", "%u",
> +			    blkif->vbd.nr_supported_hw_queues);

I would (as David had mentioned) use the same keys that netfront is using for negotiating
this.

Plus that means you can copy-n-paste the text from netif.h to blkif.h instead of having
to write it :-)

> +	if (err)
> +		xenbus_dev_error(blkif->be->dev, err, "writing %s/nr_supported_hw_queues",
> +				 blkif->be->dev->nodename);
> +
> +	xenbus_transaction_end(xbt, 0);
> +
> +	return err;
> +}
> +
>  static int xen_vbd_create(struct xen_blkif *blkif, blkif_vdev_t handle,
>  			  unsigned major, unsigned minor, int readonly,
>  			  int cdrom)
> @@ -484,6 +512,7 @@ static int xen_vbd_create(struct xen_blkif *blkif, blkif_vdev_t handle,
>  	struct xen_vbd *vbd;
>  	struct block_device *bdev;
>  	struct request_queue *q;
> +	int err;
>  
>  	vbd = &blkif->vbd;
>  	vbd->handle   = handle;
> @@ -522,6 +551,10 @@ static int xen_vbd_create(struct xen_blkif *blkif, blkif_vdev_t handle,
>  	if (q && blk_queue_secdiscard(q))
>  		vbd->discard_secure = true;
>  
> +	err = xen_advertise_hw_queues(blkif, q);
> +	if (err)
> +		return -ENOENT;
> +
>  	DPRINTK("Successful creation of handle=%04x (dom=%u)\n",
>  		handle, blkif->domid);
>  	return 0;
> @@ -935,7 +968,16 @@ static int connect_ring(struct backend_info *be)
>  
>  	DPRINTK("%s", dev->otherend);
>  
> -	blkif->nr_rings = 1;
> +	err = xenbus_gather(XBT_NIL, dev->otherend, "nr_blk_rings",
> +			    "%u", &blkif->nr_rings, NULL);
> +	if (err) {
> +		/*
> +		 * Frontend does not support multiqueue; force compatibility
> +		 * mode of the driver.
> +		 */
> +		blkif->vbd.nr_supported_hw_queues = 0;
> +		blkif->nr_rings = 1;
I would add also:

	pr_debug("Advertised %u queues, fronted deaf - using one ring.\n");

To make it easier during debugging/testing to figure out why the frontend
does not seem to use it (and having an easy way to figure out why).

> +	}
>  
>  	ring_ref = kzalloc(sizeof(unsigned long) * blkif->nr_rings, GFP_KERNEL);
>  	if (!ring_ref)
> -- 
> 2.1.0
> 

  parent reply	other threads:[~2014-10-01 20:24 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-11 23:57 [PATCH RFC v2 0/5] Multi-queue support for xen-blkfront and xen-blkback Arianna Avanzini
2014-09-11 23:57 ` [PATCH RFC v2 1/5] xen, blkfront: port to the the multi-queue block layer API Arianna Avanzini
2014-09-13 19:29   ` Christoph Hellwig
2014-10-01 20:18   ` Konrad Rzeszutek Wilk
2014-09-11 23:57 ` [PATCH RFC v2 2/5] xen, blkfront: introduce support for multiple block rings Arianna Avanzini
2014-10-01 20:18   ` Konrad Rzeszutek Wilk
2014-09-11 23:57 ` [PATCH RFC v2 3/5] xen, blkfront: negotiate the number of block rings with the backend Arianna Avanzini
2014-09-12 10:46   ` David Vrabel
2014-10-01 20:18   ` Konrad Rzeszutek Wilk
2014-09-11 23:57 ` [PATCH RFC v2 4/5] xen, blkback: introduce support for multiple block rings Arianna Avanzini
2014-10-01 20:18   ` Konrad Rzeszutek Wilk
2014-09-11 23:57 ` [PATCH RFC v2 5/5] xen, blkback: negotiate of the number of block rings with the frontend Arianna Avanzini
2014-09-12 10:58   ` David Vrabel
2014-10-01 20:23   ` Konrad Rzeszutek Wilk [this message]
2014-10-01 20:27 ` [PATCH RFC v2 0/5] Multi-queue support for xen-blkfront and xen-blkback Konrad Rzeszutek Wilk
2015-04-28  7:36   ` Christoph Hellwig
2015-04-28  7:46     ` Arianna Avanzini
2015-05-13 10:29       ` Bob Liu
2015-06-30 14:21         ` [Xen-devel] " Marcus Granado
2015-07-01  0:04           ` Bob Liu
2015-07-01  3:02           ` Jens Axboe
2015-08-10 11:03             ` Rafal Mielniczuk
2015-08-10 11:14               ` Bob Liu
2015-08-10 15:52               ` Jens Axboe
2015-08-11  6:07                 ` Bob Liu
2015-08-11  9:45                   ` Rafal Mielniczuk
2015-08-11 17:32                     ` Jens Axboe
2015-08-12 10:16                       ` Bob Liu
2015-08-12 16:46                         ` Rafal Mielniczuk
2015-08-14  8:29                           ` Bob Liu
2015-08-14 12:30                             ` Rafal Mielniczuk
2015-08-18  9:45                               ` Rafal Mielniczuk

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=20141001202353.GE12581@laptop.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=avanzini.arianna@gmail.com \
    --cc=axboe@fb.com \
    --cc=bob.liu@oracle.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=david.vrabel@citrix.com \
    --cc=felipe.franciosi@citrix.com \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --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

Powered by JetHome