From: Jens Axboe <axboe@kernel.dk>
To: Ming Lei <ming.lei@redhat.com>
Cc: linux-block@vger.kernel.org,
Vitaly Kuznetsov <vkuznets@redhat.com>,
Dave Chinner <dchinner@redhat.com>,
Linux FS Devel <linux-fsdevel@vger.kernel.org>,
"Darrick J . Wong" <darrick.wong@oracle.com>,
xfs@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
Bart Van Assche <bvanassche@acm.org>,
Matthew Wilcox <willy@infradead.org>
Subject: Re: [PATCH 1/5] block: warn on un-aligned DMA IO buffer
Date: Thu, 18 Oct 2018 20:10:35 -0600 [thread overview]
Message-ID: <af3562c1-8a12-cc8f-9294-da49c4fc41b0@kernel.dk> (raw)
In-Reply-To: <20181019020639.GA14531@ming.t460p>
On 10/18/18 8:06 PM, Ming Lei wrote:
> On Thu, Oct 18, 2018 at 07:52:59PM -0600, Jens Axboe wrote:
>> On 10/18/18 7:39 PM, Ming Lei wrote:
>>> On Thu, Oct 18, 2018 at 07:33:50PM -0600, Jens Axboe wrote:
>>>> On 10/18/18 7:28 PM, Ming Lei wrote:
>>>>> On Thu, Oct 18, 2018 at 08:27:28AM -0600, Jens Axboe wrote:
>>>>>> On 10/18/18 7:18 AM, Ming Lei wrote:
>>>>>>> Now we only check if DMA IO buffer is aligned to queue_dma_alignment()
>>>>>>> for pass-through request, and it isn't done for normal IO request.
>>>>>>>
>>>>>>> Given the check has to be done on each bvec, it isn't efficient to add the
>>>>>>> check in generic_make_request_checks().
>>>>>>>
>>>>>>> This patch addes one WARN in blk_queue_split() for capturing this issue.
>>>>>>
>>>>>> I don't want to do this, because then we are forever doomed to
>>>>>> have something that fully loops a bio at submission time. I
>>>>>> absolutely hate the splitting we have and the need for it,
>>>>>> hopefully it can go away for a subset of IOs at some point.
>>>>>>
>>>>>> In many ways, this seems to be somewhat of a made-up problem, I don't
>>>>>> recall a single bug report for something like this over decades of
>>>>>> working with the IO stack. 512b alignment restrictions for DMA seems
>>>>>> absolutely insane. I know people claim they exist, but clearly that
>>>>>> isn't a hard requirement or we would have been boned years ago.
>>>>>
>>>>> There are still some drivers with this requirement:
>>>>>
>>>>> drivers/ata/libata-scsi.c:1308: blk_queue_update_dma_alignment(q, sdev->sector_size - 1);
>>>>> drivers/ata/pata_macio.c:812: blk_queue_update_dma_alignment(sdev->request_queue, 31);
>>>>> drivers/ata/pata_macio.c:827: blk_queue_update_dma_alignment(sdev->request_queue, 15);
>>>>> drivers/block/ps3disk.c:470: blk_queue_dma_alignment(queue, dev->blk_size-1);
>>>>> drivers/block/rsxx/dev.c:282: blk_queue_dma_alignment(card->queue, blk_size - 1);
>>>>> drivers/block/xen-blkfront.c:957: blk_queue_dma_alignment(rq, 511);
>>>>> drivers/ide/ide-cd.c:1512: blk_queue_dma_alignment(q, 31);
>>>>> drivers/message/fusion/mptscsih.c:2388: blk_queue_dma_alignment (sdev->request_queue, 512 - 1);
>>>>> drivers/staging/rts5208/rtsx.c:94: blk_queue_dma_alignment(sdev->request_queue, (512 - 1));
>>>>> drivers/usb/image/microtek.c:329: blk_queue_dma_alignment(s->request_queue, (512 - 1));
>>>>> drivers/usb/storage/scsiglue.c:92: blk_queue_update_dma_alignment(sdev->request_queue, (512 - 1));
>>>>> drivers/usb/storage/uas.c:818: blk_queue_update_dma_alignment(sdev->request_queue, (512 - 1));
>>>>
>>>> Of course, I too can grep :-)
>>>>
>>>> My point is that these settings might not match reality. And the
>>>> WARN_ON(), as implemented, is going to trigger on any device that
>>>> DOESN'T set the alignment, as Bart pointed out.
>>>
>>> It is just a WARN_ON_ONCE() which exactly shows something which need
>>> further attention, then related people may take a look and we can move
>>> on.
>>>
>>> So I think it is correct thing to do.
>>
>> It most certainly is NOT the right thing to do, when we know that:
>>
>> 1) We currently have drivers setting an alignment that we don't meet
>> 2) We have drivers not setting an alignment, and getting 512 by default
>
> The 512 default should have been removed given it isn't respected at
> all in normal io path, but it is included from the beginning of 2.6.12
>
>> 3) We have drivers setting an alignment that seems incorrect
>
> Then WARN_ON() is helpful for both 1) and 2) after the default 512
> limit is removed.
I'm not saying it's not useful (though even that is doubtful), I'm
saying it's exactly the wrong order. You cut the very paragraph where
I stated that. Drop this patch, focus on the other bits. Once that is
done, then we can debate whether it's useful or not. Right now it
definitely isn't.
--
Jens Axboe
next prev parent reply other threads:[~2018-10-19 10:14 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-18 13:18 [PATCH 0/5] block: introduce helpers for allocating io buffer from slab Ming Lei
2018-10-18 13:18 ` [PATCH 1/5] block: warn on un-aligned DMA IO buffer Ming Lei
2018-10-18 14:27 ` Jens Axboe
2018-10-18 14:43 ` Christoph Hellwig
2018-10-18 14:46 ` Jens Axboe
2018-10-19 1:28 ` Ming Lei
2018-10-19 1:33 ` Jens Axboe
2018-10-19 1:39 ` Ming Lei
2018-10-19 1:52 ` Jens Axboe
2018-10-19 2:06 ` Ming Lei
2018-10-19 2:10 ` Jens Axboe [this message]
2018-10-18 14:28 ` Christoph Hellwig
2018-10-18 13:18 ` [PATCH 2/5] block: move .dma_alignment into q->limits Ming Lei
2018-10-18 14:29 ` Christoph Hellwig
2018-10-18 20:36 ` Bart Van Assche
2018-10-18 13:18 ` [PATCH 3/5] block: make dma_alignment as stacked limit Ming Lei
2018-10-18 14:31 ` Christoph Hellwig
2018-10-18 13:18 ` [PATCH 4/5] block: introduce helpers for allocating IO buffers from slab Ming Lei
2018-10-18 14:42 ` Christoph Hellwig
2018-10-18 15:11 ` Matthew Wilcox
2018-10-18 15:22 ` Christoph Hellwig
2018-10-19 2:53 ` Ming Lei
2018-10-19 4:06 ` Jens Axboe
2018-10-19 5:43 ` Dave Chinner
2018-10-18 13:18 ` [PATCH 5/5] xfs: use block layer helpers to allocate io buffer " Ming Lei
2018-10-18 14:03 ` [PATCH 0/5] block: introduce helpers for allocating " Matthew Wilcox
2018-10-18 14:05 ` Christoph Hellwig
2018-10-18 15:06 ` Matthew Wilcox
2018-10-18 15:21 ` Christoph Hellwig
2018-10-18 15:50 ` Bart Van Assche
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=af3562c1-8a12-cc8f-9294-da49c4fc41b0@kernel.dk \
--to=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=darrick.wong@oracle.com \
--cc=dchinner@redhat.com \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=ming.lei@redhat.com \
--cc=vkuznets@redhat.com \
--cc=willy@infradead.org \
--cc=xfs@vger.kernel.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).