Re: [PATCH v3] blk-mq: punt failed direct issue to dispatch list

2018-12-07 Thread Ming Lei
sed on a patch from Ming, > but with the list insert case covered as well. > > Fixes: ffe81d45322c ("blk-mq: fix corruption with direct issue") > Cc: sta...@vger.kernel.org > Suggested-by: Ming Lei > Reported-by: Bart Van Assche > Signed-off-by: Jens Axboe

Re: [PATCH] blk-mq: fix corruption with direct issue

2018-12-07 Thread Ming Lei
On Fri, Dec 07, 2018 at 11:44:39AM +0800, Ming Lei wrote: > On Thu, Dec 06, 2018 at 09:46:42PM -0500, Theodore Y. Ts'o wrote: > > On Wed, Dec 05, 2018 at 11:03:01AM +0800, Ming Lei wrote: > > > > > > But at that time, there isn't io scheduler for MQ, so in th

Re: [PATCH v3] blk-mq: punt failed direct issue to dispatch list

2018-12-07 Thread Ming Lei
sed on a patch from Ming, > but with the list insert case covered as well. > > Fixes: ffe81d45322c ("blk-mq: fix corruption with direct issue") > Cc: sta...@vger.kernel.org > Suggested-by: Ming Lei > Reported-by: Bart Van Assche > Signed-off-by: Jens Axboe

Re: [PATCH] blk-mq: fix corruption with direct issue

2018-12-06 Thread Ming Lei
On Thu, Dec 06, 2018 at 09:46:42PM -0500, Theodore Y. Ts'o wrote: > On Wed, Dec 05, 2018 at 11:03:01AM +0800, Ming Lei wrote: > > > > But at that time, there isn't io scheduler for MQ, so in theory the > > issue should be there since v4.11, especially 945ffb60c11d ("m

[PATCH V2] blk-mq: re-build queue map in case of kdump kernel

2018-12-06 Thread Ming Lei
ce buffer empty) [4.490492] CR2: 0098 [4.491052] ---[ end trace 03cd268ad5a86ff7 ]--- Cc: Christoph Hellwig Cc: linux-n...@lists.infradead.org Cc: David Milburn Signed-off-by: Ming Lei --- block/blk-mq.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --gi

Re: [PATCH] blk-mq: re-build queue map in case of kdump kernel

2018-12-06 Thread Ming Lei
On Thu, Dec 06, 2018 at 07:57:34PM -0700, Jens Axboe wrote: > On 12/6/18 7:55 PM, Ming Lei wrote: > > Now almost all .map_queues() implementation based on managed irq > > affinity doesn't update queue mapping and it just retrieves the > > old built mapping, so if nr

[PATCH] blk-mq: re-build queue map in case of kdump kernel

2018-12-06 Thread Ming Lei
ce buffer empty) [4.490492] CR2: 0098 [4.491052] ---[ end trace 03cd268ad5a86ff7 ]--- Cc: Christoph Hellwig Cc: linux-n...@lists.infradead.org Cc: David Milburn Signed-off-by: Ming Lei --- block/blk-mq.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) d

Re: [PATCH] blk-mq: fix corruption with direct issue

2018-12-04 Thread Ming Lei
On Wed, Dec 05, 2018 at 10:58:02AM +0800, Ming Lei wrote: > On Tue, Dec 04, 2018 at 07:30:24PM -0700, Jens Axboe wrote: > > On 12/4/18 7:27 PM, Ming Lei wrote: > > > On Tue, Dec 04, 2018 at 07:16:11PM -0700, Jens Axboe wrote: > > >> On 12/4/18 6:37 PM, Ming Lei wrote

Re: [PATCH] blk-mq: fix corruption with direct issue

2018-12-04 Thread Ming Lei
On Tue, Dec 04, 2018 at 07:30:24PM -0700, Jens Axboe wrote: > On 12/4/18 7:27 PM, Ming Lei wrote: > > On Tue, Dec 04, 2018 at 07:16:11PM -0700, Jens Axboe wrote: > >> On 12/4/18 6:37 PM, Ming Lei wrote: > >>> On Tue, Dec 04, 2018 at 03:47:46PM -0700, Jens Axboe wrote:

Re: [PATCH] blk-mq: fix corruption with direct issue

2018-12-04 Thread Ming Lei
On Tue, Dec 04, 2018 at 07:16:11PM -0700, Jens Axboe wrote: > On 12/4/18 6:37 PM, Ming Lei wrote: > > On Tue, Dec 04, 2018 at 03:47:46PM -0700, Jens Axboe wrote: > >> If we attempt a direct issue to a SCSI device, and it returns BUSY, then > >> we queue the request up

Re: [PATCH] blk-mq: fix corruption with direct issue

2018-12-04 Thread Ming Lei
On Tue, Dec 04, 2018 at 03:47:46PM -0700, Jens Axboe wrote: > If we attempt a direct issue to a SCSI device, and it returns BUSY, then > we queue the request up normally. However, the SCSI layer may have > already setup SG tables etc for this particular command. If we later > merge with this

Re: [PATCH] blk-mq: Set request mapping to NULL in blk_mq_put_driver_tag

2018-12-04 Thread Ming Lei
On Tue, Dec 04, 2018 at 03:30:11PM +0530, Kashyap Desai wrote: > Problem statement : > Whenever try to get outstanding request via scsi_host_find_tag, > block layer will return stale entries instead of actual outstanding > request. Kernel panic if stale entry is inaccessible or memory is reused. >

block: sbitmap related lockdep warning

2018-12-03 Thread Ming Lei
000 R08: 0001 R09: 0207b4e0 [ 106.400976] R10: 000c R11: 0202 R12: 7f8d989f5670 [ 106.401951] R13: R14: 0207b7b0 R15: 0205b7c0 [ 204.246336] null: module loaded [ 294.406501] null: module loaded [ 396.936354] null: module loaded [ 497.202198] end test sanity/001: (NO_HANG, 0) Thanks, Ming Lei

Re: [PATCH 1/2] blk-mq: Export iterating all tagged requests

2018-12-02 Thread Ming Lei
-fc that means we could even unexport the > low-level interface. Agree, and especially SCSI's use should be understood given SCSI is so widely deployed in product system. thanks, Ming Lei

[PATCH] block: fix single range discard merge

2018-11-30 Thread Ming Lei
ge with scheduler attached") Reported-by: Jens Axboe Cc: Guangwu Zhang Cc: Christoph Hellwig Cc: Jianchao Wang Signed-off-by: Ming Lei --- block/blk-merge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/blk-merge.c b/block/blk-merge.c index e7696c47489a..7695

Re: [PATCH 7/7] blk-mq: use plug for devices that implement ->commits_rqs()

2018-11-28 Thread Ming Lei
gt;last in a smart > + * fashion. > + */ > unsigned int request_count = plug->rq_count; > struct request *last = NULL; > > -- > 2.17.1 > Reviewed-by: Ming Lei thanks, Ming

Re: [PATCH 5/7] ataflop: implement mq_ops->commit_rqs() hook

2018-11-28 Thread Ming Lei
_device_operations floppy_fops > = { > > static const struct blk_mq_ops ataflop_mq_ops = { > .queue_rq = ataflop_queue_rq, > + .commit_rqs = ataflop_commit_rqs, > }; > > static struct kobject *floppy_find(dev_t dev, int *part, void *data) > -- > 2.17.1 > Reviewed-by: Ming Lei thanks, Ming

Re: [PATCH 6/7] blk-mq: use bd->last == true for list inserts

2018-11-28 Thread Ming Lei
requests(struct blk_mq_hw_ctx *hctx, > struct blk_mq_ctx *ctx, > struct list_head *list); > > /* Used by blk_insert_cloned_request() to issue request directly */ > -blk_status_t blk_mq_request_issue_directly(struct request *rq); > +blk_status_t blk_mq_request_issue_directly(struct request *rq, bool last); > void blk_mq_try_issue_list_directly(struct blk_mq_hw_ctx *hctx, > struct list_head *list); > > -- > 2.17.1 > Reviewed-by: Ming Lei Thanks, Ming

Re: [PATCH 5/8] virtio_blk: implement mq_ops->commit_rqs() hook

2018-11-28 Thread Ming Lei
On Wed, Nov 28, 2018 at 08:13:43PM -0700, Jens Axboe wrote: > On 11/28/18 7:51 PM, Ming Lei wrote: > > On Wed, Nov 28, 2018 at 07:19:09PM -0700, Jens Axboe wrote: > >> On 11/28/18 6:23 PM, Ming Lei wrote: > >>> On Tue, Nov 27, 2018 at 07:34:51PM -0700, Jens Axboe wro

Re: [PATCH 5/8] virtio_blk: implement mq_ops->commit_rqs() hook

2018-11-28 Thread Ming Lei
On Wed, Nov 28, 2018 at 07:19:09PM -0700, Jens Axboe wrote: > On 11/28/18 6:23 PM, Ming Lei wrote: > > On Tue, Nov 27, 2018 at 07:34:51PM -0700, Jens Axboe wrote: > >> On 11/27/18 7:10 PM, Ming Lei wrote: > >>> On Mon, Nov 26, 2018 at 09:35:53AM -0700, Jens Axboe wrot

Re: [PATCH 5/8] virtio_blk: implement mq_ops->commit_rqs() hook

2018-11-28 Thread Ming Lei
On Tue, Nov 27, 2018 at 07:34:51PM -0700, Jens Axboe wrote: > On 11/27/18 7:10 PM, Ming Lei wrote: > > On Mon, Nov 26, 2018 at 09:35:53AM -0700, Jens Axboe wrote: > >> We need this for blk-mq to kick things into gear, if we told it that > >> we had more IO coming,

Re: [PATCH 5/8] virtio_blk: implement mq_ops->commit_rqs() hook

2018-11-27 Thread Ming Lei
On Mon, Nov 26, 2018 at 09:35:53AM -0700, Jens Axboe wrote: > We need this for blk-mq to kick things into gear, if we told it that > we had more IO coming, but then failed to deliver on that promise. > > Signed-off-by: Jens Axboe > --- > drivers/block/virtio_blk.c | 15 +++ > 1 file

Re: [PATCH 7/8] blk-mq: use bd->last == true for list inserts

2018-11-27 Thread Ming Lei
On Mon, Nov 26, 2018 at 09:35:55AM -0700, Jens Axboe wrote: > If we are issuing a list of requests, we know if we're at the last one. > If we fail issuing, ensure that we call ->commits_rqs() to flush any > potential previous requests. > > Signed-off-by: Jens Axboe > --- > block/blk-core.c | 2

Re: [PATCH 3/8] blk-mq: add mq_ops->commit_rqs()

2018-11-27 Thread Ming Lei
* make us stop issuing further requests, this hook serves the > + * purpose of kicking the hardware (which the last request otherwise > + * would have done). > + */ > + commit_rqs_fn *commit_rqs; > + > /* >* Return a queue map type for the given request/bio flags >*/ > -- > 2.17.1 > Looks fine, Reviewed-by: Ming Lei Thanks, Ming

Re: [PATCH] block/025: test discard sector alignement and sector size overflow

2018-11-26 Thread Ming Lei
On Mon, Nov 26, 2018 at 04:33:10PM -0800, Omar Sandoval wrote: > On Thu, Nov 15, 2018 at 12:00:17PM +0800, Ming Lei wrote: > > This test covers the following two issues: > > > > 1) discard sector need to be aligned with logical block size > > > > 2) make sure 's

Re: [PATCH] block/025: test discard sector alignement and sector size overflow

2018-11-20 Thread Ming Lei
On Thu, Nov 15, 2018 at 12:01 PM Ming Lei wrote: > > This test covers the following two issues: > > 1) discard sector need to be aligned with logical block size > > 2) make sure 'sector_t' instead of 'unsigned int' is used when comparing > with discard sector size > &

Re: [PATCH 2/7] block: Remove bio->bi_ioc

2018-11-20 Thread Ming Lei
On Tue, Nov 20, 2018 at 10:31:19AM -0700, Jens Axboe wrote: > On 11/20/18 10:21 AM, Ming Lei wrote: > > On Mon, Nov 19, 2018 at 12:51:26PM +0900, Damien Le Moal wrote: > >> bio->bi_ioc is never set so always NULL. Remove references to it in > >> bio_disassociate_tas

Re: [PATCH 2/7] block: Remove bio->bi_ioc

2018-11-20 Thread Ming Lei
On Mon, Nov 19, 2018 at 12:51:26PM +0900, Damien Le Moal wrote: > bio->bi_ioc is never set so always NULL. Remove references to it in > bio_disassociate_task() and in rq_ioc() and delete this field from > struct bio. With this change, rq_ioc() always returns > current->io_context without the need

[PATCH 4.21 V3] blk-mq: not embed .mq_kobj and ctx->kobj into queue instance

2018-11-19 Thread Ming Lei
T_RELEASE is enabled. Reported-by: Guenter Roeck Cc: "jianchao.wang" Cc: Guenter Roeck Cc: Greg Kroah-Hartman Cc: sta...@vger.kernel.org Signed-off-by: Ming Lei --- V3: - keep to allocate q->queue_ctx via percpu allocator, so one extra pointer reference can be sa

Re: [PATCH V2 for-4.21 2/2] blk-mq: alloc q->queue_ctx as normal array

2018-11-19 Thread Ming Lei
On Mon, Nov 19, 2018 at 11:17:49AM +0100, Greg Kroah-Hartman wrote: > On Mon, Nov 19, 2018 at 10:04:27AM +0800, Ming Lei wrote: > > On Sat, Nov 17, 2018 at 11:03:42AM +0100, Greg Kroah-Hartman wrote: > > > On Sat, Nov 17, 2018 at 10:34:18AM +0800, Ming Lei wrote: > > > &

Re: [PATCH V2 for-4.21 1/2] blk-mq: not embed .mq_kobj and ctx->kobj into queue instance

2018-11-19 Thread Ming Lei
On Mon, Nov 19, 2018 at 11:06:06AM +0100, Greg Kroah-Hartman wrote: > On Sat, Nov 17, 2018 at 10:26:38AM +0800, Ming Lei wrote: > > On Fri, Nov 16, 2018 at 06:05:21AM -0800, Greg Kroah-Hartman wrote: > > > On Fri, Nov 16, 2018 at 07:23:10PM +0800, Ming Lei wrote: > > > &

Re: [PATCH V10 18/19] block: kill QUEUE_FLAG_NO_SG_MERGE

2018-11-19 Thread Ming Lei
On Fri, Nov 16, 2018 at 02:58:03PM +0100, Christoph Hellwig wrote: > On Thu, Nov 15, 2018 at 04:53:05PM +0800, Ming Lei wrote: > > Since bdced438acd83ad83a6c ("block: setup bi_phys_segments after > > splitting"), > > physical segment number is mainly figured out in

Re: [PATCH V10 18/19] block: kill QUEUE_FLAG_NO_SG_MERGE

2018-11-19 Thread Ming Lei
On Thu, Nov 15, 2018 at 06:18:11PM -0800, Omar Sandoval wrote: > On Thu, Nov 15, 2018 at 04:53:05PM +0800, Ming Lei wrote: > > Since bdced438acd83ad83a6c ("block: setup bi_phys_segments after > > splitting"), > > physical segment number is mainly figured out in blk_

Re: [PATCH V10 17/19] block: don't use bio->bi_vcnt to figure out segment number

2018-11-19 Thread Ming Lei
On Thu, Nov 15, 2018 at 06:11:40PM -0800, Omar Sandoval wrote: > On Thu, Nov 15, 2018 at 04:53:04PM +0800, Ming Lei wrote: > > It is wrong to use bio->bi_vcnt to figure out how many segments > > there are in the bio even though CLONED flag isn't set on this bio, > &

Re: [PATCH V10 15/19] block: always define BIO_MAX_PAGES as 256

2018-11-19 Thread Ming Lei
On Thu, Nov 15, 2018 at 05:59:36PM -0800, Omar Sandoval wrote: > On Thu, Nov 15, 2018 at 04:53:02PM +0800, Ming Lei wrote: > > Now multi-page bvec can cover CONFIG_THP_SWAP, so we don't need to > > increase BIO_MAX_PAGES for it. > > You mentioned to it in the cover letter

Re: [PATCH V10 14/19] block: enable multipage bvecs

2018-11-19 Thread Ming Lei
On Fri, Nov 16, 2018 at 02:53:08PM +0100, Christoph Hellwig wrote: > > - > > - if (page == bv->bv_page && off == bv->bv_offset + bv->bv_len) { > > - bv->bv_len += len; > > - bio->bi_iter.bi_size += len; > > - return true; > > -

Re: [PATCH V10 14/19] block: enable multipage bvecs

2018-11-19 Thread Ming Lei
On Thu, Nov 15, 2018 at 05:56:27PM -0800, Omar Sandoval wrote: > On Thu, Nov 15, 2018 at 04:53:01PM +0800, Ming Lei wrote: > > This patch pulls the trigger for multi-page bvecs. > > > > Now any request queue which supports queue cluster will see multi-page > > bvecs

Re: [PATCH V10 13/19] iomap & xfs: only account for new added page

2018-11-19 Thread Ming Lei
On Fri, Nov 16, 2018 at 02:49:36PM +0100, Christoph Hellwig wrote: > I'd much rather have __bio_try_merge_page only do merges in > the same page, and have a new __bio_try_merge_segment that does > multi-page merges. This will keep the accounting a lot simpler. Looks this way is clever, will do

Re: [PATCH V10 13/19] iomap & xfs: only account for new added page

2018-11-19 Thread Ming Lei
On Thu, Nov 15, 2018 at 05:46:58PM -0800, Omar Sandoval wrote: > On Thu, Nov 15, 2018 at 04:53:00PM +0800, Ming Lei wrote: > > After multi-page is enabled, one new page may be merged to a segment > > even though it is a new added page. > > > > This patch deals wi

Re: [PATCH V10 12/19] block: allow bio_for_each_segment_all() to iterate over multi-page bvec

2018-11-19 Thread Ming Lei
On Thu, Nov 15, 2018 at 05:22:45PM -0800, Omar Sandoval wrote: > On Thu, Nov 15, 2018 at 04:52:59PM +0800, Ming Lei wrote: > > This patch introduces one extra iterator variable to > > bio_for_each_segment_all(), > > then we can allow bio_for_each_segment_all() to iterate over

Re: [PATCH V10 12/19] block: allow bio_for_each_segment_all() to iterate over multi-page bvec

2018-11-19 Thread Ming Lei
On Thu, Nov 15, 2018 at 01:42:52PM +0100, David Sterba wrote: > On Thu, Nov 15, 2018 at 04:52:59PM +0800, Ming Lei wrote: > > diff --git a/block/blk-zoned.c b/block/blk-zoned.c > > index 13ba2011a306..789b09ae402a 100644 > > --- a/block/blk-zoned.c > > +++ b/block/blk-z

Re: [PATCH V10 11/19] bcache: avoid to use bio_for_each_segment_all() in bch_bio_alloc_pages()

2018-11-19 Thread Ming Lei
On Fri, Nov 16, 2018 at 02:46:45PM +0100, Christoph Hellwig wrote: > > - bio_for_each_segment_all(bv, bio, i) { > > + for (i = 0, bv = bio->bi_io_vec; i < bio->bi_vcnt; bv++) { > > This really needs a comment. Otherwise it looks fine to me. OK, will do it in next version. Thanks, Ming

Re: [PATCH V10 11/19] bcache: avoid to use bio_for_each_segment_all() in bch_bio_alloc_pages()

2018-11-19 Thread Ming Lei
On Thu, Nov 15, 2018 at 04:44:02PM -0800, Omar Sandoval wrote: > On Thu, Nov 15, 2018 at 04:52:58PM +0800, Ming Lei wrote: > > bch_bio_alloc_pages() is always called on one new bio, so it is safe > > to access the bvec table directly. Given it is the only kind of this > > cas

Re: [PATCH V10 10/19] block: loop: pass multi-page bvec to iov_iter

2018-11-19 Thread Ming Lei
On Thu, Nov 15, 2018 at 04:40:22PM -0800, Omar Sandoval wrote: > On Thu, Nov 15, 2018 at 04:52:57PM +0800, Ming Lei wrote: > > iov_iter is implemented with bvec itererator, so it is safe to pass > > multipage bvec to it, and this way is much more efficient than > > passing

Re: [PATCH V10 09/19] block: introduce bio_bvecs()

2018-11-19 Thread Ming Lei
On Fri, Nov 16, 2018 at 02:45:41PM +0100, Christoph Hellwig wrote: > On Thu, Nov 15, 2018 at 04:52:56PM +0800, Ming Lei wrote: > > There are still cases in which we need to use bio_bvecs() for get the > > number of multi-page segment, so introduce it. > > The only user in

Re: [PATCH V10 08/19] btrfs: move bio_pages_all() to btrfs

2018-11-19 Thread Ming Lei
On Fri, Nov 16, 2018 at 02:38:45PM +0100, Christoph Hellwig wrote: > On Thu, Nov 15, 2018 at 04:52:55PM +0800, Ming Lei wrote: > > BTRFS is the only user of this helper, so move this helper into > > BTRFS, and implement it via bio_for_each_segment_all(), since > > bio-&

Re: [PATCH V10 08/19] btrfs: move bio_pages_all() to btrfs

2018-11-19 Thread Ming Lei
On Thu, Nov 15, 2018 at 04:23:56PM -0800, Omar Sandoval wrote: > On Thu, Nov 15, 2018 at 04:52:55PM +0800, Ming Lei wrote: > > BTRFS is the only user of this helper, so move this helper into > > BTRFS, and implement it via bio_for_each_segment_all(), since > > bio->bi_vcnt

Re: [PATCH V10 07/19] btrfs: use bvec_last_segment to get bio's last page

2018-11-19 Thread Ming Lei
On Fri, Nov 16, 2018 at 02:37:10PM +0100, Christoph Hellwig wrote: > On Thu, Nov 15, 2018 at 04:52:54PM +0800, Ming Lei wrote: > > index 2955a4ea2fa8..161e14b8b180 100644 > > --- a/fs/btrfs/compression.c > > +++ b/fs/btrfs/compression.c > > @@ -40

Re: [PATCH V10 05/19] block: introduce bvec_last_segment()

2018-11-18 Thread Ming Lei
On Thu, Nov 15, 2018 at 03:23:56PM -0800, Omar Sandoval wrote: > On Thu, Nov 15, 2018 at 04:52:52PM +0800, Ming Lei wrote: > > BTRFS and guard_bio_eod() need to get the last singlepage segment > > from one multipage bvec, so introduce this helper to make them happy. > >

Re: [PATCH V10 04/19] block: use bio_for_each_bvec() to map sg

2018-11-18 Thread Ming Lei
On Fri, Nov 16, 2018 at 02:33:14PM +0100, Christoph Hellwig wrote: > > + if (!*sg) > > + return sglist; > > + else { > > No need for an else after an early return. OK, good catch! Thanks, Ming

Re: [PATCH V10 03/19] block: use bio_for_each_bvec() to compute multi-page bvec count

2018-11-18 Thread Ming Lei
On Thu, Nov 15, 2018 at 12:20:28PM -0800, Omar Sandoval wrote: > On Thu, Nov 15, 2018 at 04:52:50PM +0800, Ming Lei wrote: > > First it is more efficient to use bio_for_each_bvec() in both > > blk_bio_segment_split() and __blk_recalc_rq_segments() to compute how > >

Re: [PATCH V10 01/19] block: introduce multi-page page bvec helpers

2018-11-18 Thread Ming Lei
On Sun, Nov 18, 2018 at 08:10:14PM -0700, Jens Axboe wrote: > On 11/18/18 7:23 PM, Ming Lei wrote: > > On Fri, Nov 16, 2018 at 02:13:05PM +0100, Christoph Hellwig wrote: > >>> -#define bvec_iter_page(bvec, iter) \ > >>> +#de

Re: [PATCH V10 02/19] block: introduce bio_for_each_bvec()

2018-11-18 Thread Ming Lei
On Fri, Nov 16, 2018 at 02:30:28PM +0100, Christoph Hellwig wrote: > > +static inline void __bio_advance_iter(struct bio *bio, struct bvec_iter > > *iter, > > + unsigned bytes, bool mp) > > I think these magic 'bool np' arguments and wrappers over wrapper > don't

Re: [PATCH V2 for-4.21 2/2] blk-mq: alloc q->queue_ctx as normal array

2018-11-18 Thread Ming Lei
On Sat, Nov 17, 2018 at 11:03:42AM +0100, Greg Kroah-Hartman wrote: > On Sat, Nov 17, 2018 at 10:34:18AM +0800, Ming Lei wrote: > > On Fri, Nov 16, 2018 at 06:06:23AM -0800, Greg Kroah-Hartman wrote: > > > On Fri, Nov 16, 2018 at 07:23:11PM +0800, Ming Lei wrote: > > >

Re: [PATCH V2 for-4.21 2/2] blk-mq: alloc q->queue_ctx as normal array

2018-11-16 Thread Ming Lei
On Fri, Nov 16, 2018 at 06:06:23AM -0800, Greg Kroah-Hartman wrote: > On Fri, Nov 16, 2018 at 07:23:11PM +0800, Ming Lei wrote: > > Now q->queue_ctx is just one read-mostly table for query the > > 'blk_mq_ctx' instance from one cpu index, it isn't necessary > > to alloca

Re: [PATCH V2 for-4.21 1/2] blk-mq: not embed .mq_kobj and ctx->kobj into queue instance

2018-11-16 Thread Ming Lei
On Fri, Nov 16, 2018 at 06:05:21AM -0800, Greg Kroah-Hartman wrote: > On Fri, Nov 16, 2018 at 07:23:10PM +0800, Ming Lei wrote: > > @@ -456,7 +456,7 @@ struct request_queue { > > /* > > * mq queue kobject > > */ > > - struct kobject mq_kobj

Re: [PATCH] block: fix 32 bit overflow in __blkdev_issue_discard()

2018-11-16 Thread Ming Lei
On Fri, Nov 16, 2018 at 03:04:57PM +1100, Dave Chinner wrote: > On Thu, Nov 15, 2018 at 02:24:19PM -0800, Darrick J. Wong wrote: > > On Fri, Nov 16, 2018 at 09:13:37AM +1100, Dave Chinner wrote: > > > On Thu, Nov 15, 2018 at 11:10:36AM +0800, Ming Lei wrote: > > > >

[PATCH V2 0/2] blk-mq: fix kobject lifetime issue

2018-11-16 Thread Ming Lei
Hi Jens, The 1st patch fixes the kobject lifetime issue which is triggerd when DEBUG_KOBJECT_RELEASE is enabled. The 2nd patch can be thought as one follow-up cleanup. V2: - allocate 'blk_mq_ctx' inside blk_mq_init_allocated_queue() - allocate q->mq_kobj directly Ming Lei

[PATCH V2 for-4.21 2/2] blk-mq: alloc q->queue_ctx as normal array

2018-11-16 Thread Ming Lei
Now q->queue_ctx is just one read-mostly table for query the 'blk_mq_ctx' instance from one cpu index, it isn't necessary to allocate it as percpu variable. One simple array may be more efficient. Cc: "jianchao.wang" Cc: Guenter Roeck Cc: Greg Kroah-Hartman Signed-off-by: Ming Le

[PATCH V2 for-4.21 1/2] blk-mq: not embed .mq_kobj and ctx->kobj into queue instance

2018-11-16 Thread Ming Lei
ocated dynamically. This patch fixes kernel panic issue during booting when DEBUG_KOBJECT_RELEASE is enabled. Reported-by: Guenter Roeck Cc: "jianchao.wang" Cc: Guenter Roeck Cc: Greg Kroah-Hartman Cc: sta...@vger.kernel.org Signed-off-by: Ming Lei --- block/blk-m

Re: [PATCH 1/2] blk-mq: not embed .mq_kobj and ctx->kobj into queue instance

2018-11-15 Thread Ming Lei
On Fri, Nov 16, 2018 at 02:11:07PM +0800, jianchao.wang wrote: > > > On 11/16/18 11:28 AM, Ming Lei wrote: > ... > > > > +struct blk_mq_kobj { > > + struct kobject kobj; > > +}; > > + > > static void blk_mq_sysfs_release(struct kobject *

Re: [PATCH 1/2] blk-mq: not embed .mq_kobj and ctx->kobj into queue instance

2018-11-15 Thread Ming Lei
On Fri, Nov 16, 2018 at 01:52:05AM -0500, Sasha Levin wrote: > On Fri, Nov 16, 2018 at 11:28:25AM +0800, Ming Lei wrote: > > Even though .mq_kobj, ctx->kobj and q->kobj share same lifetime > > from block layer's view, actually they don't because userspace may > > grab on

[PATCH 0/2] blk-mq: fix kobject lifetime issue

2018-11-15 Thread Ming Lei
Hi Jens, The 1st patch fixes the kobject lifetime issue which is triggerd when DEBUG_KOBJECT_RELEASE is enabled. The 2nd patch can be thought as one follow-up cleanup. Ming Lei (2): blk-mq: not embed .mq_kobj and ctx->kobj into queue instance blk-mq: alloc q->queue_ctx as normal

[PATCH 1/2] blk-mq: not embed .mq_kobj and ctx->kobj into queue instance

2018-11-15 Thread Ming Lei
ocated dynamically. This patch fixes kernel panic issue during booting when DEBUG_KOBJECT_RELEASE is enabled. Reported-by: Guenter Roeck Cc: Guenter Roeck Cc: Greg Kroah-Hartman Cc: sta...@vger.kernel.org Signed-off-by: Ming Lei --- block/blk-mq-sysfs.c

[PATCH 2/2] blk-mq: alloc q->queue_ctx as normal array

2018-11-15 Thread Ming Lei
Now q->queue_ctx is just one read-mostly table for query the 'blk_mq_ctx' instance from one cpu index, it isn't necessary to allocate it as percpu variable. One simple array may be more efficient. Cc: Guenter Roeck Cc: Greg Kroah-Hartman Signed-off-by: Ming Lei --- block/blk-mq-sysfs.c |

[PATCH] block/025: test discard sector alignement and sector size overflow

2018-11-14 Thread Ming Lei
This test covers the following two issues: 1) discard sector need to be aligned with logical block size 2) make sure 'sector_t' instead of 'unsigned int' is used when comparing with discard sector size Signed-off-by: Ming Lei --- tests/block/025 | 37

Re: [PATCH] block: fix 32 bit overflow in __blkdev_issue_discard()

2018-11-14 Thread Ming Lei
On Thu, Nov 15, 2018 at 12:22:01PM +1100, Dave Chinner wrote: > On Thu, Nov 15, 2018 at 09:06:52AM +0800, Ming Lei wrote: > > On Wed, Nov 14, 2018 at 08:18:24AM -0700, Jens Axboe wrote: > > > On 11/13/18 2:43 PM, Dave Chinner wrote: > > > > From: Dave Chinner >

Re: [PATCH] block: fix 32 bit overflow in __blkdev_issue_discard()

2018-11-14 Thread Ming Lei
On Wed, Nov 14, 2018 at 08:18:24AM -0700, Jens Axboe wrote: > On 11/13/18 2:43 PM, Dave Chinner wrote: > > From: Dave Chinner > > > > A discard cleanup merged into 4.20-rc2 causes fstests xfs/259 to > > fall into an endless loop in the discard code. The test is creating > > a device that is

Re: [PATCH] block: fix 32 bit overflow in __blkdev_issue_discard()

2018-11-14 Thread Ming Lei
On Wed, Nov 14, 2018 at 4:09 PM Dave Chinner wrote: > > On Wed, Nov 14, 2018 at 10:53:11AM +0800, Ming Lei wrote: > > On Wed, Nov 14, 2018 at 5:44 AM Dave Chinner wrote: > > > > > > From: Dave Chinner > > > > > > A discard cleanup merged in

Re: [PATCH] block: fix 32 bit overflow in __blkdev_issue_discard()

2018-11-13 Thread Ming Lei
int, nr_sects, + unsigned int req_sects = min_t(sector_t, nr_sects, bio_allowed_max_sectors(q)); > > + WARN_ON_ONCE(req_sects == 0); The above line isn't necessary given 'nr_sects' can't be zero. Thanks, Ming Lei

Re: [PATCH] block: Clear kernel memory before copying to user

2018-11-08 Thread Ming Lei
-scsi/sata/usb-storage emulated via qemu-2.10.2-1.fc27, not observed this problem. Thanks, Ming Lei

Re: [PATCH] block: Clear kernel memory before copying to user

2018-11-07 Thread Ming Lei
On Wed, Nov 7, 2018 at 11:47 PM Keith Busch wrote: > > On Wed, Nov 07, 2018 at 11:44:59PM +0800, Ming Lei wrote: > > blk_update_request() may tell us how much progress made, :-) > > Except when it doesn't, which is 100% of the time for many block > drivers, includi

Re: [PATCH] block: Clear kernel memory before copying to user

2018-11-07 Thread Ming Lei
On Wed, Nov 7, 2018 at 11:19 PM Keith Busch wrote: > > On Wed, Nov 07, 2018 at 11:09:27PM +0800, Ming Lei wrote: > > On Wed, Nov 7, 2018 at 10:42 PM Keith Busch wrote: > > > > > > If the kernel allocates a bounce buffer for user read data, this memory > >

Re: [PATCH] block: Clear kernel memory before copying to user

2018-11-07 Thread Ming Lei
if (ret) > goto cleanup; > } else { > + zero_fill_bio(bio); > iov_iter_advance(iter, bio->bi_iter.bi_size); > } This way looks inefficient because zero fill should only be required for short READ. Thanks, Ming Lei

Re: [PATCH V2 0/3] block: make sure discard/writesame bio is aligned with logical block size

2018-11-06 Thread Ming Lei
On Tue, Nov 06, 2018 at 04:48:13PM +, Rui Salvaterra wrote: > On Mon, 5 Nov 2018 at 03:41, Ming Lei wrote: > > > > V2 addresses Christoph's comment by introducing bio_allowed_max_sectors(). > > > > Ping... > > > > Thanks, > > Ming > > H

Re: [PATCH V2 0/3] block: make sure discard/writesame bio is aligned with logical block size

2018-11-04 Thread Ming Lei
On Mon, Oct 29, 2018 at 08:57:16PM +0800, Ming Lei wrote: > Hi, > > The 1st & 3rd patch fixes bio size alignment issue. > > The 2nd patch cleans up __blkdev_issue_discard() a bit. > > V2: > - introduce helper of bio_allowed_max_sectors() > - add comm

[PATCH 1/4] Revert "irq: add support for allocating (and affinitizing) sets of IRQs"

2018-11-02 Thread Ming Lei
This reverts commit 1d44f6f43e229ca06bf680aa7eb5ad380eaa5d72. --- drivers/pci/msi.c | 14 -- include/linux/interrupt.h | 4 kernel/irq/affinity.c | 40 +--- 3 files changed, 9 insertions(+), 49 deletions(-) diff --git

[PATCH V2] block: brd: associate with queue until adding disk

2018-11-01 Thread Ming Lei
/main.c:1068 ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:350 Reported-by: syzbot+3701447012fe951da...@syzkaller.appspotmail.com Signed-off-by: Ming Lei --- V2: - don't reference queue via disk->queue in brd_alloc() drivers/block/brd.c | 16 +++- 1 file changed,

[PATCH] block: brd: associate with queue until adding disk

2018-10-31 Thread Ming Lei
/main.c:1068 ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:350 Reported-by: syzbot+3701447012fe951da...@syzkaller.appspotmail.com Signed-off-by: Ming Lei --- drivers/block/brd.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/block/brd.c b/drivers

Re: [PATCH] block: call rq_qos_exit() after queue is frozen

2018-10-30 Thread Ming Lei
On Wed, Oct 24, 2018 at 9:18 PM Ming Lei wrote: > > rq_qos_exit() removes the current q->rq_qos, this action has to be > done after queue is frozen, otherwise the IO queue path may never > be waken up, then IO hang is caused. > > So fixes this issue by moving rq_qos_exit()

[PATCH V2 3/3] block: make sure writesame bio is aligned with logical block size

2018-10-29 Thread Ming Lei
ke Snitzer Cc: Christoph Hellwig Cc: Xiao Ni Cc: Mariusz Dabrowski Signed-off-by: Ming Lei --- block/blk-lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/blk-lib.c b/block/blk-lib.c index d58d5d87dd88..e8b3bb9bf375 100644 --- a/block/blk-lib.c +++ b/block

[PATCH V2 2/3] block: cleanup __blkdev_issue_discard()

2018-10-29 Thread Ming Lei
Cleanup __blkdev_issue_discard() a bit: - remove local variable of 'end_sect' - remove code block of 'fail' Cc: Rui Salvaterra Cc: Mike Snitzer Cc: Christoph Hellwig Cc: Xiao Ni Cc: Mariusz Dabrowski Signed-off-by: Ming Lei --- block/blk-lib.c | 23 ++- 1 file changed

[PATCH V2 0/3] block: make sure discard/writesame bio is aligned with logical block size

2018-10-29 Thread Ming Lei
Hi, The 1st & 3rd patch fixes bio size alignment issue. The 2nd patch cleans up __blkdev_issue_discard() a bit. V2: - introduce helper of bio_allowed_max_sectors() - add commit log for patch 2 Ming Lei (3): block: make sure discard bio is aligned with logical block

[PATCH V2 1/3] block: make sure discard bio is aligned with logical block size

2018-10-29 Thread Ming Lei
t;block: re-add discard_granularity and alignment checks") Reported-by: Rui Salvaterra Cc: Rui Salvaterra Cc: sta...@vger.kernel.org Cc: Mike Snitzer Cc: Christoph Hellwig Cc: Xiao Ni Cc: Mariusz Dabrowski Signed-off-by: Ming Lei --- block/blk-lib.c | 3 +-- block/blk-merge.c | 3 ++- bl

Re: [PATCH V2 1/3] blk-mq: refactor the code of issue request directly

2018-10-28 Thread Ming Lei
On Sat, Oct 27, 2018 at 12:01:09AM +0800, Jianchao Wang wrote: > Merge blk_mq_try_issue_directly and __blk_mq_try_issue_directly > into one interface which is able to handle the return value from > .queue_rq callback. Due to we can only issue directly w/o io > scheduler, so remove the

Re: [PATCH 1/3] block: make sure discard bio is aligned with logical block size

2018-10-28 Thread Ming Lei
On Sun, Oct 28, 2018 at 04:49:47PM +0100, Christoph Hellwig wrote: > On Sun, Oct 28, 2018 at 08:51:31AM +0800, Ming Lei wrote: > > On Fri, Oct 26, 2018 at 09:44:15AM +0200, Christoph Hellwig wrote: > > > > if (req_sects > UINT_MAX >> 9) > > &

Re: [PATCH 1/3] block: make sure discard bio is aligned with logical block size

2018-10-27 Thread Ming Lei
On Fri, Oct 26, 2018 at 09:44:15AM +0200, Christoph Hellwig wrote: > > if (req_sects > UINT_MAX >> 9) > > - req_sects = UINT_MAX >> 9; > > + req_sects = (UINT_MAX >> 9) & ~bs_mask; > > Given that we have this same thing duplicated in write zeroes >

[PATCH 0/3] block: make sure discard/writesame bio is aligned with logical block size

2018-10-26 Thread Ming Lei
Hi, The 1st & 3rd patch fixes bio size alignment issue. The 2nd patch cleans up __blkdev_issue_discard() a bit. Thanks, Ming Lei (3): block: make sure discard bio is aligned with logical block size block: cleanup __blkdev_issue_discard() block: make sure writesame bio is ali

[PATCH 3/3] block: make sure writesame bio is aligned with logical block size

2018-10-26 Thread Ming Lei
Dabrowski Signed-off-by: Ming Lei --- block/blk-lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/blk-lib.c b/block/blk-lib.c index 93011785f710..1750f0e480c0 100644 --- a/block/blk-lib.c +++ b/block/blk-lib.c @@ -149,7 +149,7 @@ static int __blkdev_issue_write_s

[PATCH 2/3] block: cleanup __blkdev_issue_discard()

2018-10-26 Thread Ming Lei
Cleanup __blkdev_issue_discard(). Cc: Rui Salvaterra Cc: Mike Snitzer Cc: Christoph Hellwig Cc: Xiao Ni Cc: Mariusz Dabrowski Signed-off-by: Ming Lei --- block/blk-lib.c | 23 +-- 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/block/blk-lib.c b/block/blk

[PATCH 1/3] block: make sure discard bio is aligned with logical block size

2018-10-26 Thread Ming Lei
c: Xiao Ni Cc: Mariusz Dabrowski Signed-off-by: Ming Lei --- block/blk-lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/blk-lib.c b/block/blk-lib.c index bbd44666f2b5..aa3944946b2f 100644 --- a/block/blk-lib.c +++ b/block/blk-lib.c @@ -59,7 +59,7 @@ int __blkdev_iss

[PATCH] block: call rq_qos_exit() after queue is frozen

2018-10-24 Thread Ming Lei
rq_qos_exit() removes the current q->rq_qos, this action has to be done after queue is frozen, otherwise the IO queue path may never be waken up, then IO hang is caused. So fixes this issue by moving rq_qos_exit() after queue is frozen. Cc: Josef Bacik Signed-off-by: Ming Lei --- block/

Re: [PATCH] block: setup bounce bio_sets properly

2018-10-19 Thread Ming Lei
On Thu, Oct 18, 2018 at 03:24:47PM -0600, Jens Axboe wrote: > We're only setting up the bounce bio sets if we happen > to need bouncing for regular HIGHMEM, not if we only need > it for ISA devices. > > Reported-by: Ondrej Zary > Tested-by: Ondrej Zary > Signed-off-by: Jens Axboe > > diff

Re: [PATCH 4/5] block: introduce helpers for allocating IO buffers from slab

2018-10-18 Thread Ming Lei
On Thu, Oct 18, 2018 at 05:22:19PM +0200, Christoph Hellwig wrote: > On Thu, Oct 18, 2018 at 08:11:23AM -0700, Matthew Wilcox wrote: > > On Thu, Oct 18, 2018 at 04:42:07PM +0200, Christoph Hellwig wrote: > > > This all seems quite complicated. > > > > > > I think the interface we'd want is more

Re: [PATCH 1/5] block: warn on un-aligned DMA IO buffer

2018-10-18 Thread Ming Lei
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 wro

Re: [PATCH 1/5] block: warn on un-aligned DMA IO buffer

2018-10-18 Thread Ming Lei
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_

Re: [PATCH 1/5] block: warn on un-aligned DMA IO buffer

2018-10-18 Thread Ming Lei
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

[PATCH 3/5] block: make dma_alignment as stacked limit

2018-10-18 Thread Ming Lei
: Christoph Hellwig Cc: Bart Van Assche Cc: Matthew Wilcox Signed-off-by: Ming Lei --- block/blk-settings.c | 89 +--- 1 file changed, 50 insertions(+), 39 deletions(-) diff --git a/block/blk-settings.c b/block/blk-settings.c index cf9cd241dc16

[PATCH 2/5] block: move .dma_alignment into q->limits

2018-10-18 Thread Ming Lei
epares for making it as one stacked limit. Cc: Vitaly Kuznetsov Cc: Dave Chinner Cc: Linux FS Devel Cc: Darrick J. Wong Cc: x...@vger.kernel.org Cc: Dave Chinner Cc: Christoph Hellwig Cc: Bart Van Assche Cc: Matthew Wilcox Signed-off-by: Ming Lei --- block/blk-settings.c | 6 +++--- include

[PATCH 0/5] block: introduce helpers for allocating io buffer from slab

2018-10-18 Thread Ming Lei
o/?t=15373485754=1=2 Thanks, Ming Ming Lei (5): block: warn on un-aligned DMA IO buffer block: move .dma_alignment into q->limits block: make dma_alignment as stacked limit block: introduce helpers for allocating IO buffers from slab xfs: use block layer helpers to allocate io buffer fr

  1   2   3   4   5   6   7   8   9   10   >