From: Bob Liu <bob.liu@oracle.com>
To: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: xen-devel@lists.xen.org, linux-kernel@vger.kernel.org,
roger.pau@citrix.com, felipe.franciosi@citrix.com, axboe@fb.com,
avanzini.arianna@gmail.com, rafal.mielniczuk@citrix.com,
jonathan.davies@citrix.com, david.vrabel@citrix.com
Subject: Re: [PATCH v4 03/10] xen/blkfront: pseudo support for multi hardware queues/rings
Date: Wed, 04 Nov 2015 09:01:11 +0800 [thread overview]
Message-ID: <563958D7.6050304@oracle.com> (raw)
In-Reply-To: <20151103194436.GE28527@char.us.oracle.com>
On 11/04/2015 03:44 AM, Konrad Rzeszutek Wilk wrote:
> On Mon, Nov 02, 2015 at 12:21:39PM +0800, Bob Liu wrote:
>> Preparatory patch for multiple hardware queues (rings). The number of
>> rings is unconditionally set to 1, larger number will be enabled in next
>> patch so as to make every single patch small and readable.
>
> s/next patch/"xen/blkfront: negotiate number of queues/rings to be used with backend"
>
>>
>> Signed-off-by: Bob Liu <bob.liu@oracle.com>
>> ---
>> drivers/block/xen-blkfront.c | 327 +++++++++++++++++++++++++------------------
>> 1 file changed, 188 insertions(+), 139 deletions(-)
>>
>> diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
>> index 2a557e4..eab78e7 100644
>> --- a/drivers/block/xen-blkfront.c
>> +++ b/drivers/block/xen-blkfront.c
>> @@ -145,6 +145,7 @@ struct blkfront_info
>> int vdevice;
>> blkif_vdev_t handle;
>> enum blkif_state connected;
>> + /* Number of pages per ring buffer */
>
> Missing full stop, aka '.'.
>
>> unsigned int nr_ring_pages;
>> struct request_queue *rq;
>> struct list_head grants;
>> @@ -158,7 +159,8 @@ struct blkfront_info
>> unsigned int max_indirect_segments;
>> int is_ready;
>> struct blk_mq_tag_set tag_set;
>> - struct blkfront_ring_info rinfo;
>> + struct blkfront_ring_info *rinfo;
>> + unsigned int nr_rings;
>> };
>>
>> static unsigned int nr_minors;
>> @@ -190,7 +192,7 @@ static DEFINE_SPINLOCK(minor_lock);
>> ((_segs + SEGS_PER_INDIRECT_FRAME - 1)/SEGS_PER_INDIRECT_FRAME)
>>
>> static int blkfront_setup_indirect(struct blkfront_ring_info *rinfo);
>> -static int blkfront_gather_backend_features(struct blkfront_info *info);
>> +static void blkfront_gather_backend_features(struct blkfront_info *info);
>>
>> static int get_id_from_freelist(struct blkfront_ring_info *rinfo)
>> {
>> @@ -443,12 +445,13 @@ static int blkif_queue_request(struct request *req, struct blkfront_ring_info *r
>> */
>> max_grefs += INDIRECT_GREFS(req->nr_phys_segments);
>>
>> - /* Check if we have enough grants to allocate a requests */
>> - if (info->persistent_gnts_c < max_grefs) {
>> + /* Check if we have enough grants to allocate a requests, we have to
>> + * reserve 'max_grefs' grants because persistent grants are shared by all
>> + * rings */
>
> Missing full stop.
>
>> + if (0 < max_grefs) {
>
> <blinks> ? 0!?
>
> max_grefs will at least be BLKIF_MAX_SEGMENTS_PER_REQUEST
> so this will always be true.
>
No, max_grefs = req->nr_phys_segments;
It's 0 in some cases(flush req?), and gnttable_alloc_grant_references() can not handle 0 as the parameter.
> In which ase why not just ..
>> new_persistent_gnts = 1;
>> if (gnttab_alloc_grant_references(
>> - max_grefs - info->persistent_gnts_c,
>> - &gref_head) < 0) {
>> + max_grefs, &gref_head) < 0) {
>> gnttab_request_free_callback(
>> &rinfo->callback,
>> blkif_restart_queue_callback,
>
> .. move this whole code down? And get rid of 'new_persistent_gnts'
> since it will always be true?
>
Unless we fix gnttable_alloc_grant_references(0).
> But more importantly, why do we not check for 'info->persistent_gnts_c' anymore?
>
Info->persistent_gnts_c is for per-device not per-ring, the persistent grants may be taken by other queues/rings after we checked the value here.
Which would make get_grant() fail, so we have to reserved enough grants in advance.
Those new-allocated grants will be freed if there are enough grants in persistent list.
Will fix all other comments for this patch.
Thanks,
Bob
next prev parent reply other threads:[~2015-11-04 1:01 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-02 4:21 [PATCH v4 00/10] xen-block: multi hardware-queues/rings support Bob Liu
2015-11-02 4:21 ` [PATCH v4 01/10] xen/blkif: document blkif multi-queue/ring extension Bob Liu
2015-11-02 4:21 ` [PATCH v4 02/10] xen/blkfront: separate per ring information out of device info Bob Liu
2015-11-02 4:49 ` kbuild test robot
2015-11-02 5:33 ` Bob Liu
2015-11-02 4:21 ` [PATCH v4 03/10] xen/blkfront: pseudo support for multi hardware queues/rings Bob Liu
[not found] ` <20151103194436.GE28527@char.us.oracle.com>
2015-11-04 1:01 ` Bob Liu [this message]
2015-11-02 4:21 ` [PATCH v4 04/10] xen/blkfront: split per device io_lock Bob Liu
[not found] ` <20151103200902.GF28527@char.us.oracle.com>
2015-11-04 1:07 ` Bob Liu
2015-11-04 1:51 ` Konrad Rzeszutek Wilk
2015-11-02 4:21 ` [PATCH v4 05/10] xen/blkfront: negotiate number of queues/rings to be used with backend Bob Liu
[not found] ` <20151103204029.GH28527@char.us.oracle.com>
2015-11-04 1:11 ` Bob Liu
2015-11-04 1:53 ` Konrad Rzeszutek Wilk
2015-11-02 4:21 ` [PATCH v4 06/10] xen/blkback: separate ring information out of struct xen_blkif Bob Liu
2015-11-02 4:21 ` [PATCH v4 07/10] xen/blkback: pseudo support for multi hardware queues/rings Bob Liu
2015-11-05 2:30 ` Konrad Rzeszutek Wilk
2015-11-05 3:02 ` Bob Liu
2015-11-05 3:24 ` Konrad Rzeszutek Wilk
2015-11-02 4:21 ` [PATCH v4 08/10] xen/blkback: get the number of hardware queues/rings from blkfront Bob Liu
2015-11-05 2:37 ` Konrad Rzeszutek Wilk
2015-11-02 4:21 ` [PATCH v4 09/10] xen/blkfront: make persistent grants per-queue Bob Liu
2015-11-05 2:39 ` Konrad Rzeszutek Wilk
2015-11-02 4:21 ` [PATCH v4 10/10] xen/blkback: make pool of persistent grants and free pages per-queue Bob Liu
2015-11-05 2:43 ` Konrad Rzeszutek Wilk
2015-11-05 2:46 ` Bob Liu
2015-11-05 19:50 ` Konrad Rzeszutek Wilk
2015-11-02 11:19 ` [Xen-devel] [PATCH v4 00/10] xen-block: multi hardware-queues/rings support Julien Grall
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=563958D7.6050304@oracle.com \
--to=bob.liu@oracle.com \
--cc=avanzini.arianna@gmail.com \
--cc=axboe@fb.com \
--cc=david.vrabel@citrix.com \
--cc=felipe.franciosi@citrix.com \
--cc=jonathan.davies@citrix.com \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rafal.mielniczuk@citrix.com \
--cc=roger.pau@citrix.com \
--cc=xen-devel@lists.xen.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).