From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Junxiao Bi <junxiao.bi@oracle.com>,
xen-devel@lists.xenproject.org, jgross@suse.com
Cc: "Roger Pau Monné" <roger.pau@citrix.com>
Subject: Re: [PATCH] xen-blkfront: fix mq start/stop race
Date: Fri, 23 Jun 2017 08:22:09 -0400 [thread overview]
Message-ID: <f0cb684c-3703-a045-0250-9ae9609c27f6@oracle.com> (raw)
In-Reply-To: <e62f57e3-268b-cd94-4ae4-f7fbf2c4cc84@oracle.com>
On 06/23/2017 12:58 AM, Junxiao Bi wrote:
> Hi Boris & Juergen,
>
> Could you help review this patch? This is a race and will cause the io hung.
>
> Thanks,
> Junxiao.
>
> On 06/22/2017 09:36 AM, Junxiao Bi wrote:
>> When ring buf full, hw queue will be stopped. While blkif interrupt consume
>> request and make free space in ring buf, hw queue will be started again.
>> But since start queue is protected by spin lock while stop not, that will
>> cause a race.
>>
>> interrupt: process:
>> blkif_interrupt() blkif_queue_rq()
>> kick_pending_request_queues_locked()
>> blk_mq_start_stopped_hw_queues()
>> clear_bit(BLK_MQ_S_STOPPED, &hctx->state)
>> blk_mq_stop_hw_queue(hctx)
>> blk_mq_run_hw_queue(hctx, async)
>>
>> If ring buf is made empty in this case, interrupt will never come, then the
>> hw queue will be stopped forever, all processes waiting for the pending io
>> in the queue will hung.
>>
>> Signed-off-by: Junxiao Bi <junxiao.bi@oracle.com>
>> Reviewed-by: Ankur Arora <ankur.a.arora@oracle.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
but I think Roger (copied) needs to Ack it.
-boris
>> ---
>> drivers/block/xen-blkfront.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
>> index 8bb160cd00e1..4767b82b2cf6 100644
>> --- a/drivers/block/xen-blkfront.c
>> +++ b/drivers/block/xen-blkfront.c
>> @@ -912,8 +912,8 @@ out_err:
>> return BLK_MQ_RQ_QUEUE_ERROR;
>>
>> out_busy:
>> - spin_unlock_irqrestore(&rinfo->ring_lock, flags);
>> blk_mq_stop_hw_queue(hctx);
>> + spin_unlock_irqrestore(&rinfo->ring_lock, flags);
>> return BLK_MQ_RQ_QUEUE_BUSY;
>> }
>>
>>
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-06-23 12:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-22 1:36 [PATCH] xen-blkfront: fix mq start/stop race Junxiao Bi
2017-06-23 4:58 ` Junxiao Bi
2017-06-23 12:22 ` Boris Ostrovsky [this message]
2017-06-23 12:57 ` Roger Pau Monné
2017-07-19 1:19 ` Junxiao Bi
2017-07-19 7:37 ` Roger Pau Monné
2017-07-19 7:51 ` Junxiao Bi
2017-07-19 14:08 ` Konrad Rzeszutek Wilk
2017-07-20 1:29 ` Junxiao Bi
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=f0cb684c-3703-a045-0250-9ae9609c27f6@oracle.com \
--to=boris.ostrovsky@oracle.com \
--cc=jgross@suse.com \
--cc=junxiao.bi@oracle.com \
--cc=roger.pau@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).