Linux-Block Archive on lore.kernel.org
 help / color / Atom feed
From: Dongli Zhang <dongli.zhang@oracle.com>
To: Ming Lei <ming.lei@redhat.com>
Cc: Christoph Hellwig <hch@infradead.org>,
	Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, "Ewan D. Milne" <emilne@redhat.com>
Subject: Re: [PATCH] blk-mq: insert passthrough request into hctx->dispatch directly
Date: Wed, 19 Feb 2020 19:11:25 -0800
Message-ID: <91a78b4a-97cb-ee34-a240-3d3748dcf969@oracle.com> (raw)
In-Reply-To: <20200220014526.GA1469@ming.t460p>



On 2/19/20 5:45 PM, Ming Lei wrote:
> On Wed, Feb 19, 2020 at 03:47:50PM -0800, dongli.zhang@oracle.com wrote:
>>
>>
>> On 2/19/20 2:10 PM, Ming Lei wrote:
>>> On Wed, Feb 19, 2020 at 08:36:15AM -0800, Christoph Hellwig wrote:
>>>> On Sat, Feb 15, 2020 at 11:21:40AM +0800, Ming Lei wrote:
>>>>> For some reason, device may be in one situation which can't handle
>>>>> FS request, so STS_RESOURCE is always returned and the FS request
>>>>> will be added to hctx->dispatch. However passthrough request may
>>>>> be required at that time for fixing the problem. If passthrough
>>>>> request is added to scheduler queue, there isn't any chance for
>>>>> blk-mq to dispatch it given we prioritize requests in hctx->dispatch.
>>>>> Then the FS IO request may never be completed, and IO hang is caused.
>>>>>
>>>>> So passthrough request has to be added to hctx->dispatch directly.
>>>>>
>>>>> Fix this issue by inserting passthrough request into hctx->dispatch
>>>>> directly. Then it becomes consistent with original legacy IO request
>>>>> path, in which passthrough request is always added to q->queue_head.
>>>>
>>>> Do you have a description of an actual problem this fixes?  Maybe even
>>>> a reproducer for blktests?
>>>>
>>>
>>> It is reported by one RH customer in the following test case:
>>>
>>> 	1) Start IO on Emulex FC host
>>> 	2) Fail one controller, wait 5 minutes
>>> 	3) Bring controller back online
>>>
>>> When we trace the problem, it is found that FS request started in device_add_disk()
>>> from scsi disk probe context stuck because scsi_queue_rq() always return
>>> STS_BUSY via scsi_setup_fs_cmnd() -> alua_prep_fn().
>>>
>>> The kernel ALUA state is TRANSITIONING at that time, so it is reasonable to see
>>> BLK_TYPE_FS requests won't go anywhere because of the check in alua_prep_fn().
>>>
>>> However, the passthrough request(TEST UNIT READY) is submitted from alua_rtpg_work
>>> when the FS request can't be dispatched to LLD. And SCSI stack should
>>> have been allowed to handle this passthrough rquest. But it can't reach SCSI stack
>>> via .queue_rq() because blk-mq won't dispatch it until hctx->dispatch is
>>> empty.
>>>
>>> The legacy IO request code always added passthrough request into head of q->queue_head
>>> directly instead of scheduler queue or sw queue, so no such issue.
>>>
>>> So far not figured out one blktests test case, but the problem is real.
>>>
>>> BTW, I just found we need the extra following change:
>>>
>>> @@ -1301,7 +1301,7 @@ bool blk_mq_dispatch_rq_list(struct request_queue *q, struct list_head *list,
>>>                         q->mq_ops->commit_rqs(hctx);
>>>
>>>                 spin_lock(&hctx->lock);
>>> -               list_splice_init(list, &hctx->dispatch);
>>> +               list_splice_tail_init(list, &hctx->dispatch);
>>>                 spin_unlock(&hctx->lock);
>>>
>>
>> Is it fine to add to tail as the requests on dispatch would be reordered?
> 
> Wrt. FS request:
> 
> Firstly we never guarantee that the request is dispatched in order.
> 
> Secondly and more importantly, request can be added into hctx->dispatch
> in any order. One usual case is that request is added to hctx->dispatch
> concurrently when .queue_rq() fails. On the other side, in case of not
> concurrent adding to hctx->dispatch, after one request is added to
> hctx->dispatch, we always dispatch request from hctx->dispatch first,
> instead of dequeuing request from scheduler queue and adding them to
> hctx->dispatch again after .queue_rq() fails.
> 
>>
>> A, B, C and D are on the list. Suppose A is failed and the new list would become
>> B, C D, A?
> 
> Right, I don't see there is any issue in this way, do you see issues?

Thank you very much for the explanation. I do not see issue if order guarantee
in hctx->dispatch is not required.

Dongli Zhang

      reply index

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-15  3:21 Ming Lei
2020-02-19 16:36 ` Christoph Hellwig
2020-02-19 22:10   ` Ming Lei
2020-02-19 23:47     ` dongli.zhang
2020-02-20  1:45       ` Ming Lei
2020-02-20  3:11         ` Dongli Zhang [this message]

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=91a78b4a-97cb-ee34-a240-3d3748dcf969@oracle.com \
    --to=dongli.zhang@oracle.com \
    --cc=axboe@kernel.dk \
    --cc=emilne@redhat.com \
    --cc=hch@infradead.org \
    --cc=linux-block@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    /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

Linux-Block Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-block/0 linux-block/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-block linux-block/ https://lore.kernel.org/linux-block \
		linux-block@vger.kernel.org
	public-inbox-index linux-block

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-block


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git