From: Jens Axboe <axboe@kernel.dk>
To: Richard Weinberger <richard@nod.at>
Cc: Christoph Hellwig <hch@lst.de>,
linux-block@vger.kernel.org, linux-um@lists.infradead.org,
anton.ivanov@cambridgegreys.com, dwalter@google.com
Subject: Re: [PATCH, RFC] ubd: remove use of blk_rq_map_sg
Date: Tue, 16 Oct 2018 08:26:31 -0600 [thread overview]
Message-ID: <da877cdc-7873-30fd-fa33-72cd48419d46@kernel.dk> (raw)
In-Reply-To: <5155064.LnyfiXsD0j@blindfold>
On 10/16/18 2:38 AM, Richard Weinberger wrote:
> Am Dienstag, 16. Oktober 2018, 04:19:51 CEST schrieb Jens Axboe:
>> On 10/15/18 4:44 PM, Richard Weinberger wrote:
>>> Am Dienstag, 16. Oktober 2018, 00:04:20 CEST schrieb Jens Axboe:
>>>> On 10/15/18 3:46 PM, Richard Weinberger wrote:
>>>>> Am Montag, 15. Oktober 2018, 22:55:29 CEST schrieb Christoph Hellwig:
>>>>>> On Mon, Oct 15, 2018 at 10:42:47PM +0200, Richard Weinberger wrote:
>>>>>>>> Sadly not. I'm checking now what exactly is broken.
>>>>>>>
>>>>>>> I take this back. Christoph's fixup makes reading work.
>>>>>>> The previous version corrupted my test block device in interesting ways
>>>>>>> and confused all tests.
>>>>>>> But the removal of blk_rq_map_sg() still has issues.
>>>>>>> Now the device blocks endless upon flush.
>>>>>>
>>>>>> I suspect we still need to special case flush. Updated patch below
>>>>>> including your other suggestion:
>>>>>
>>>>> While playing further with the patch I managed to hit
>>>>> BUG_ON(blk_queued_rq(rq)) in blk_mq_requeue_request().
>>>>>
>>>>> UML requeues the request in ubd_queue_one_vec() if it was not able
>>>>> to submit the request to the host io-thread.
>>>>> The fd can return -EAGAIN, then UML has to try later.
>>>>>
>>>>> Isn't this allowed in that context?
>>>>
>>>> It is, the problem is that queue_one_vec() doesn't always return an
>>>> error. The caller is doing a loop per bio, so we can encounter an
>>>> error, requeue, and then the caller will call us again. We're in
>>>> an illegal state at that point, and the next requeue will make that
>>>> obvious since it's already pending. Actually, both the caller and
>>>> ubd_queue_one_vec() also requeue. So it's a bit of a mess, the below
>>>> might help.
>>>
>>> I agree, the driver *is* a mess.
>>> Unless someone else volunteers to clean it up, I'll push that task on
>>> my never ending TODO list.
>>
>> I doubt you'll have to fight anyone for that task ;-)
>>
>>> Thanks for your hint with the illegal state.
>>> Now with correct requeuing the driver seems to work fine!
>>> Write/Flush support also suffered from that but didn't trigger the BUG_ON()...
>>
>> OK good, at least we're making progress!
>
> Yes. Shall I send a patch with your suggestion or will you?
Christoph should just fold it in, the bug only exists after his
change to it.
> I have one more question, in your first conversion you set queue_depth to 2.
> How does one know this value?
> My conversion has 64, which is more or less an educated guess... ;)
64 is most likely just fine. Some drivers rely on having 1 in flight and
it's easier to manage to just let blk-mq take care of that. Outside of that,
there aren't any magic values. We should probably just use BLKDEV_MAX_RQ
for ones that don't have a specific hw limit or need.
--
Jens Axboe
WARNING: multiple messages have this Message-ID (diff)
From: Jens Axboe <axboe@kernel.dk>
To: Richard Weinberger <richard@nod.at>
Cc: linux-block@vger.kernel.org, dwalter@google.com,
linux-um@lists.infradead.org, Christoph Hellwig <hch@lst.de>,
anton.ivanov@cambridgegreys.com
Subject: Re: [PATCH, RFC] ubd: remove use of blk_rq_map_sg
Date: Tue, 16 Oct 2018 08:26:31 -0600 [thread overview]
Message-ID: <da877cdc-7873-30fd-fa33-72cd48419d46@kernel.dk> (raw)
In-Reply-To: <5155064.LnyfiXsD0j@blindfold>
On 10/16/18 2:38 AM, Richard Weinberger wrote:
> Am Dienstag, 16. Oktober 2018, 04:19:51 CEST schrieb Jens Axboe:
>> On 10/15/18 4:44 PM, Richard Weinberger wrote:
>>> Am Dienstag, 16. Oktober 2018, 00:04:20 CEST schrieb Jens Axboe:
>>>> On 10/15/18 3:46 PM, Richard Weinberger wrote:
>>>>> Am Montag, 15. Oktober 2018, 22:55:29 CEST schrieb Christoph Hellwig:
>>>>>> On Mon, Oct 15, 2018 at 10:42:47PM +0200, Richard Weinberger wrote:
>>>>>>>> Sadly not. I'm checking now what exactly is broken.
>>>>>>>
>>>>>>> I take this back. Christoph's fixup makes reading work.
>>>>>>> The previous version corrupted my test block device in interesting ways
>>>>>>> and confused all tests.
>>>>>>> But the removal of blk_rq_map_sg() still has issues.
>>>>>>> Now the device blocks endless upon flush.
>>>>>>
>>>>>> I suspect we still need to special case flush. Updated patch below
>>>>>> including your other suggestion:
>>>>>
>>>>> While playing further with the patch I managed to hit
>>>>> BUG_ON(blk_queued_rq(rq)) in blk_mq_requeue_request().
>>>>>
>>>>> UML requeues the request in ubd_queue_one_vec() if it was not able
>>>>> to submit the request to the host io-thread.
>>>>> The fd can return -EAGAIN, then UML has to try later.
>>>>>
>>>>> Isn't this allowed in that context?
>>>>
>>>> It is, the problem is that queue_one_vec() doesn't always return an
>>>> error. The caller is doing a loop per bio, so we can encounter an
>>>> error, requeue, and then the caller will call us again. We're in
>>>> an illegal state at that point, and the next requeue will make that
>>>> obvious since it's already pending. Actually, both the caller and
>>>> ubd_queue_one_vec() also requeue. So it's a bit of a mess, the below
>>>> might help.
>>>
>>> I agree, the driver *is* a mess.
>>> Unless someone else volunteers to clean it up, I'll push that task on
>>> my never ending TODO list.
>>
>> I doubt you'll have to fight anyone for that task ;-)
>>
>>> Thanks for your hint with the illegal state.
>>> Now with correct requeuing the driver seems to work fine!
>>> Write/Flush support also suffered from that but didn't trigger the BUG_ON()...
>>
>> OK good, at least we're making progress!
>
> Yes. Shall I send a patch with your suggestion or will you?
Christoph should just fold it in, the bug only exists after his
change to it.
> I have one more question, in your first conversion you set queue_depth to 2.
> How does one know this value?
> My conversion has 64, which is more or less an educated guess... ;)
64 is most likely just fine. Some drivers rely on having 1 in flight and
it's easier to manage to just let blk-mq take care of that. Outside of that,
there aren't any magic values. We should probably just use BLKDEV_MAX_RQ
for ones that don't have a specific hw limit or need.
--
Jens Axboe
_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um
next prev parent reply other threads:[~2018-10-16 14:26 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-15 6:56 [PATCH, RFC] ubd: remove use of blk_rq_map_sg Christoph Hellwig
2018-10-15 6:56 ` Christoph Hellwig
2018-10-15 8:40 ` Richard Weinberger
2018-10-15 8:40 ` Richard Weinberger
2018-10-15 8:45 ` Christoph Hellwig
2018-10-15 8:45 ` Christoph Hellwig
2018-10-15 19:17 ` Richard Weinberger
2018-10-15 19:17 ` Richard Weinberger
2018-10-15 20:42 ` Richard Weinberger
2018-10-15 20:42 ` Richard Weinberger
2018-10-15 20:55 ` Christoph Hellwig
2018-10-15 20:55 ` Christoph Hellwig
2018-10-15 21:46 ` Richard Weinberger
2018-10-15 21:46 ` Richard Weinberger
2018-10-15 22:04 ` Jens Axboe
2018-10-15 22:04 ` Jens Axboe
2018-10-15 22:44 ` Richard Weinberger
2018-10-15 22:44 ` Richard Weinberger
2018-10-16 2:19 ` Jens Axboe
2018-10-16 2:19 ` Jens Axboe
2018-10-16 8:38 ` Richard Weinberger
2018-10-16 8:38 ` Richard Weinberger
2018-10-16 14:26 ` Jens Axboe [this message]
2018-10-16 14:26 ` Jens Axboe
2018-10-17 6:21 ` Christoph Hellwig
2018-10-17 6:21 ` Christoph Hellwig
2018-10-18 21:04 ` Richard Weinberger
2018-10-18 21:04 ` Richard Weinberger
2018-10-15 8:46 ` Anton Ivanov
2018-10-16 22:43 ` Richard Weinberger
2018-10-16 22:43 ` Richard Weinberger
2018-10-17 6:14 ` Christoph Hellwig
2018-10-17 6:14 ` Christoph Hellwig
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=da877cdc-7873-30fd-fa33-72cd48419d46@kernel.dk \
--to=axboe@kernel.dk \
--cc=anton.ivanov@cambridgegreys.com \
--cc=dwalter@google.com \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=linux-um@lists.infradead.org \
--cc=richard@nod.at \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.