[PATCH 2/5] dm-rq: handle dispatch exception in dm_dispatch_clone_request()

2018-01-21 Thread Ming Lei
So we can clean up map_request() a bit, no functional change. Cc: Mike Snitzer <snit...@redhat.com> Cc: Laurence Oberman <lober...@redhat.com> Cc: Bart Van Assche <bart.vanass...@sandisk.com> Signed-off-by: Ming Lei <ming@redhat.com> --- drivers/md/dm-rq.c | 23 ++

[PATCH 3/5] dm-rq: return BLK_STS_* from map_request()

2018-01-21 Thread Ming Lei
queue's RESTART can handle dm-rq's RESTART in this case. Cc: Mike Snitzer <snit...@redhat.com> Cc: Laurence Oberman <lober...@redhat.com> Cc: Bart Van Assche <bart.vanass...@sandisk.com> Signed-off-by: Ming Lei <ming@redhat.com> --- drivers/md/dm-rq.c | 30 ++

[PATCH 1/5] blk-mq: introduce BLK_STS_DEV_RESOURCE

2018-01-21 Thread Ming Lei
j...@linux.vnet.ibm.com> Cc: Martin K. Petersen <martin.peter...@oracle.com> Cc: linux-s...@vger.kernel.org Signed-off-by: Ming Lei <ming@redhat.com> --- block/blk-core.c | 1 + block/blk-mq.c | 19 +++ drivers/block/null_blk.c

[PATCH 0/5] blk-mq & dm: fix IO hang and deal with one performance issue

2018-01-21 Thread Ming Lei
introduces blk_get_request_notify(), still suggested by you. The last patch applies blk_get_request_notify() and avoids one DM specific performance issue which is introduced by the 1st patch. These 5 patches are against both dm(dm-4.16) and block tree(for-4.16/block). Ming Lei (5): blk-mq: introduce

Re: blk-mq: introduce BLK_STS_DEV_RESOURCE

2018-01-21 Thread Ming Lei
On Sat, Jan 20, 2018 at 10:52:01PM -0500, Mike Snitzer wrote: > On Sat, Jan 20 2018 at 7:57pm -0500, > Ming Lei <ming@redhat.com> wrote: > > > On Sat, Jan 20, 2018 at 12:30:02PM -0500, Mike Snitzer wrote: > > > On Sat, Jan 20 2018 at 8:48am -0500, > > &g

Re: blk-mq: introduce BLK_STS_DEV_RESOURCE

2018-01-20 Thread Ming Lei
On Sun, Jan 21, 2018 at 08:57:41AM +0800, Ming Lei wrote: > On Sat, Jan 20, 2018 at 12:30:02PM -0500, Mike Snitzer wrote: > > On Sat, Jan 20 2018 at 8:48am -0500, > > Ming Lei <ming@redhat.com> wrote: > > > > > This status is returned from dri

Re: blk-mq: introduce BLK_STS_DEV_RESOURCE

2018-01-20 Thread Ming Lei
On Sat, Jan 20, 2018 at 12:30:02PM -0500, Mike Snitzer wrote: > On Sat, Jan 20 2018 at 8:48am -0500, > Ming Lei <ming@redhat.com> wrote: > > > This status is returned from driver to block layer if device related > > resource is run out of, but driver can

[PATCH] blk-mq: introduce BLK_STS_DEV_RESOURCE

2018-01-20 Thread Ming Lei
and S_SCHED_RESTART is marked, run queue after 10ms for avoiding IO hang. Suggested-by: Jens Axboe <ax...@kernel.dk> Cc: Mike Snitzer <snit...@redhat.com> Cc: Laurence Oberman <lober...@redhat.com> Cc: Bart Van Assche <bart.vanass...@sandisk.com> Signed-off-by: Ming Lei <ming

Re: [RFC PATCH] blk-mq: fixup RESTART when queue becomes idle

2018-01-19 Thread Ming Lei
On Fri, Jan 19, 2018 at 09:23:35AM -0700, Jens Axboe wrote: > On 1/19/18 9:13 AM, Mike Snitzer wrote: > > On Fri, Jan 19 2018 at 10:48am -0500, > > Jens Axboe <ax...@kernel.dk> wrote: > > > >> On 1/19/18 8:40 AM, Ming Lei wrote: > >>>>>&g

Re: [RFC PATCH] blk-mq: fixup RESTART when queue becomes idle

2018-01-19 Thread Ming Lei
On Fri, Jan 19, 2018 at 10:38:41AM -0700, Jens Axboe wrote: > On 1/19/18 9:37 AM, Ming Lei wrote: > > On Fri, Jan 19, 2018 at 09:27:46AM -0700, Jens Axboe wrote: > >> On 1/19/18 9:26 AM, Ming Lei wrote: > >>> On Fri, Jan 19, 2018 at 09:19:24AM -0700, Jens Axboe wr

Re: [RFC PATCH] blk-mq: fixup RESTART when queue becomes idle

2018-01-19 Thread Ming Lei
On Fri, Jan 19, 2018 at 10:38:41AM -0700, Jens Axboe wrote: > On 1/19/18 9:37 AM, Ming Lei wrote: > > On Fri, Jan 19, 2018 at 09:27:46AM -0700, Jens Axboe wrote: > >> On 1/19/18 9:26 AM, Ming Lei wrote: > >>> On Fri, Jan 19, 2018 at 09:19:24AM -0700, Jens Axboe wr

Re: [RFC PATCH] blk-mq: fixup RESTART when queue becomes idle

2018-01-19 Thread Ming Lei
On Fri, Jan 19, 2018 at 10:09:11AM -0700, Jens Axboe wrote: > On 1/19/18 10:05 AM, Ming Lei wrote: > > On Fri, Jan 19, 2018 at 09:52:32AM -0700, Jens Axboe wrote: > >> On 1/19/18 9:47 AM, Mike Snitzer wrote: > >>> On Fri, Jan 19 2018 at 11:41am -0500, > >&

Re: [RFC PATCH] blk-mq: fixup RESTART when queue becomes idle

2018-01-19 Thread Ming Lei
On Fri, Jan 19, 2018 at 09:52:32AM -0700, Jens Axboe wrote: > On 1/19/18 9:47 AM, Mike Snitzer wrote: > > On Fri, Jan 19 2018 at 11:41am -0500, > > Jens Axboe <ax...@kernel.dk> wrote: > > > >> On 1/19/18 9:37 AM, Ming Lei wrote: > >>> On Fri, Ja

Re: [RFC PATCH] blk-mq: fixup RESTART when queue becomes idle

2018-01-19 Thread Ming Lei
On Fri, Jan 19, 2018 at 09:27:46AM -0700, Jens Axboe wrote: > On 1/19/18 9:26 AM, Ming Lei wrote: > > On Fri, Jan 19, 2018 at 09:19:24AM -0700, Jens Axboe wrote: > >> On 1/19/18 9:05 AM, Ming Lei wrote: > >>> On Fri, Jan 19, 2018 at 08:48:55AM -0700, Jens Axboe wr

Re: [RFC PATCH] blk-mq: fixup RESTART when queue becomes idle

2018-01-19 Thread Ming Lei
On Fri, Jan 19, 2018 at 09:19:24AM -0700, Jens Axboe wrote: > On 1/19/18 9:05 AM, Ming Lei wrote: > > On Fri, Jan 19, 2018 at 08:48:55AM -0700, Jens Axboe wrote: > >> On 1/19/18 8:40 AM, Ming Lei wrote: > >>>>>> Where does the dm STS_RESOURCE

Re: [RFC PATCH] blk-mq: fixup RESTART when queue becomes idle

2018-01-19 Thread Ming Lei
On Fri, Jan 19, 2018 at 08:48:55AM -0700, Jens Axboe wrote: > On 1/19/18 8:40 AM, Ming Lei wrote: > >>>> Where does the dm STS_RESOURCE error usually come from - what's exact > >>>> resource are we running out of? > >>> > >&

Re: [RFC PATCH] blk-mq: fixup RESTART when queue becomes idle

2018-01-19 Thread Ming Lei
On Fri, Jan 19, 2018 at 08:24:06AM -0700, Jens Axboe wrote: > On 1/19/18 12:26 AM, Ming Lei wrote: > > On Thu, Jan 18, 2018 at 09:02:45PM -0700, Jens Axboe wrote: > >> On 1/18/18 7:32 PM, Ming Lei wrote: > >>> On Thu, Jan 18, 2018 at 01:11:01PM -0700, Jens Axboe wro

Re: [RFC PATCH] blk-mq: fixup RESTART when queue becomes idle

2018-01-19 Thread Ming Lei
On Fri, Jan 19, 2018 at 03:20:13PM +, Bart Van Assche wrote: > On Fri, 2018-01-19 at 15:26 +0800, Ming Lei wrote: > > Please see queue_delayed_work_on(), hctx->run_work is shared by all > > scheduling, once blk_mq_delay_run_hw_queue(100ms) returns, no new > > sche

Re: [RFC PATCH] blk-mq: fixup RESTART when queue becomes idle

2018-01-18 Thread Ming Lei
On Fri, Jan 19, 2018 at 05:09:46AM +, Bart Van Assche wrote: > On Fri, 2018-01-19 at 10:32 +0800, Ming Lei wrote: > > Now most of times both NVMe and SCSI won't return BLK_STS_RESOURCE, and > > it should be DM-only which returns STS_RESOURCE so often. > > That's wrong a

Re: [RFC PATCH] blk-mq: fixup RESTART when queue becomes idle

2018-01-18 Thread Ming Lei
On Thu, Jan 18, 2018 at 09:02:45PM -0700, Jens Axboe wrote: > On 1/18/18 7:32 PM, Ming Lei wrote: > > On Thu, Jan 18, 2018 at 01:11:01PM -0700, Jens Axboe wrote: > >> On 1/18/18 11:47 AM, Bart Van Assche wrote: > >>>> This is all very tiresome. > >>

Re: [PATCH] dm rq: Avoid that request processing stalls sporadically

2018-01-18 Thread Ming Lei
On Thu, Jan 18, 2018 at 05:49:10PM -0700, Jens Axboe wrote: > On 1/18/18 5:35 PM, Ming Lei wrote: > > On Thu, Jan 18, 2018 at 05:24:29PM -0700, Jens Axboe wrote: > >> On 1/18/18 5:18 PM, Ming Lei wrote: > >>> On Fri, Jan 19, 2018 at 12:14:24AM +, Bart Van Assche

Re: [RFC PATCH] blk-mq: fixup RESTART when queue becomes idle

2018-01-18 Thread Ming Lei
On Thu, Jan 18, 2018 at 01:11:01PM -0700, Jens Axboe wrote: > On 1/18/18 11:47 AM, Bart Van Assche wrote: > >> This is all very tiresome. > > > > Yes, this is tiresome. It is very annoying to me that others keep > > introducing so many regressions in such important parts of the kernel. > > It is

Re: dm rq: Avoid that request processing stalls sporadically

2018-01-18 Thread Ming Lei
On Thu, Jan 18, 2018 at 05:13:53PM +, Bart Van Assche wrote: > On Thu, 2018-01-18 at 11:50 -0500, Mike Snitzer wrote: > > The issue you say it was originally intended to fix _should_ be > > addressed with this change: > >

Re: [PATCH] dm rq: Avoid that request processing stalls sporadically

2018-01-18 Thread Ming Lei
On Fri, Jan 19, 2018 at 12:14:24AM +, Bart Van Assche wrote: > On Fri, 2018-01-19 at 08:11 +0800, Ming Lei wrote: > > On Thu, Jan 18, 2018 at 08:37:07AM -0800, Bart Van Assche wrote: > > > diff --git a/drivers/md/dm-rq.c b/drivers/md/dm-rq.c > > > index f16096

Re: [PATCH] dm rq: Avoid that request processing stalls sporadically

2018-01-18 Thread Ming Lei
queue" > is cleared, the only solution to avoid that dm-mpath request > processing stalls is to call blk_mq_delay_run_hw_queue(). Hence > this patch. > > Fixes: ec3eaf9a6731 ("dm mpath: don't call blk_mq_delay_run_hw_queue() in > case of BLK_STS_RESOURCE") > Signe

[PATCH] blk-mq: don't dispatch request in blk_mq_request_direct_issue if queue is busy

2018-01-17 Thread Ming Lei
merging via blk_insert_cloned_request feedback") Reported-by: Laurence Oberman <lober...@redhat.com> Reviewed-by: Mike Snitzer <snit...@redhat.com> Signed-off-by: Ming Lei <ming@redhat.com> --- block/blk-mq.c | 22 ++ 1 file changed, 10 insertions(

Re: blk mq: don't blk_mq_request_bypass_insert _and_ return BLK_STS_RESOURCE

2018-01-17 Thread Ming Lei
On Wed, Jan 17, 2018 at 10:49:58PM -0500, Mike Snitzer wrote: > On Wed, Jan 17 2018 at 10:39pm -0500, > Ming Lei <ming@redhat.com> wrote: > > > On Wed, Jan 17, 2018 at 10:33:35PM -0500, Mike Snitzer wrote: > > > On Wed, Jan 17 2018 at 7:54P -0500, > >

Re: [for-4.16 PATCH v6 2/3] blk-mq: improve DM's blk-mq IO merging via blk_insert_cloned_request feedback

2018-01-17 Thread Ming Lei
On Wed, Jan 17, 2018 at 10:37:23PM -0500, Mike Snitzer wrote: > On Wed, Jan 17 2018 at 10:25pm -0500, > Ming Lei <ming@redhat.com> wrote: > > > Hi Mike, > > > > On Wed, Jan 17, 2018 at 11:25:57AM -0500, Mike Snitzer wrote: > >

Re: [PATCH] blk mq: don't blk_mq_request_bypass_insert _and_ return BLK_STS_RESOURCE

2018-01-17 Thread Ming Lei
On Wed, Jan 17, 2018 at 10:33:35PM -0500, Mike Snitzer wrote: > On Wed, Jan 17 2018 at 7:54P -0500, > Mike Snitzer wrote: > > > But sure, I suppose there is something I missed when refactoring Ming's > > change to get it acceptable for upstream. I went over the mechanical

Re: [for-4.16 PATCH v6 2/3] blk-mq: improve DM's blk-mq IO merging via blk_insert_cloned_request feedback

2018-01-17 Thread Ming Lei
Hi Mike, On Wed, Jan 17, 2018 at 11:25:57AM -0500, Mike Snitzer wrote: > From: Ming Lei <ming@redhat.com> > > blk_insert_cloned_request() is called in the fast path of a dm-rq driver > (e.g. blk-mq request-based DM mpath). blk_insert_cloned_request() uses > blk_mq_

[RFC PATCH] blk-mq: fixup RESTART when queue becomes idle

2018-01-17 Thread Ming Lei
-by: Ming Lei <ming@redhat.com> --- Another approach is to do the check after BLK_STS_RESOURCE is returned from .queue_rq() and BLK_MQ_S_SCHED_RESTART is set, that way may introduce a bit cost in hot path, and it was V1 of this patch actually, please see that in the following link:

[PATCH V2 1/2] blk-mq: make sure hctx->next_cpu is set correctly

2018-01-17 Thread Ming Lei
s...@linux.vnet.ibm.com> Cc: Christoph Hellwig <h...@lst.de> Cc: Thomas Gleixner <t...@linutronix.de> Reported-by: "jianchao.wang" <jianchao.w.w...@oracle.com> Tested-by: "jianchao.wang" <jianchao.w.w...@oracle.com> Fixes: 20e4d81393 ("blk-mq: simpl

[PATCH V2 0/2] blk-mq: two patches related with CPU hotplug

2018-01-17 Thread Ming Lei
harmless. V2: - fix comment and commit log in patch 1 - use dump_stack() with printk to replace WARN_ON() in patch 2 Thanks, Ming Lei (2): blk-mq: make sure hctx->next_cpu is set correctly blk-mq: avoid one WARN_ON in __blk_mq_run_hw_queue to printk bl

[PATCH V2 2/2] blk-mq: avoid one WARN_ON in __blk_mq_run_hw_queue to printk

2018-01-17 Thread Ming Lei
m.com> Cc: Christoph Hellwig <h...@lst.de> Cc: Thomas Gleixner <t...@linutronix.de> Cc: "jianchao.wang" <jianchao.w.w...@oracle.com> Signed-off-by: Ming Lei <ming@redhat.com> --- block/blk-mq.c | 22 -- 1 file changed, 20 insertions(+), 2 del

Re: [PATCH 2/2] blk-mq: convert WARN_ON in __blk_mq_run_hw_queue to printk

2018-01-17 Thread Ming Lei
On Wed, Jan 17, 2018 at 08:46:40AM -0700, Jens Axboe wrote: > On 1/17/18 5:34 AM, Ming Lei wrote: > > We know this WARN_ON is harmless and the stack trace isn't useful too, > > so convert it to printk(), and avoid to confuse people. > > I disagree, it is useful to know the e

Re: [PATCH 3/3] block: Protect less code with sysfs_lock in blk_{un,}register_queue()

2018-01-17 Thread Ming Lei
On Wed, Jan 17, 2018 at 10:17 AM, Bart Van Assche <bart.vanass...@wdc.com> wrote: > On Wed, 2018-01-17 at 09:23 +0800, Ming Lei wrote: >> On Wed, Jan 17, 2018 at 8:03 AM, Bart Van Assche <bart.vanass...@wdc.com> >> wrote: >> > On Tue, 2018-01-1

[PATCH 2/2] blk-mq: convert WARN_ON in __blk_mq_run_hw_queue to printk

2018-01-17 Thread Ming Lei
toph Hellwig <h...@lst.de> Cc: Thomas Gleixner <t...@linutronix.de> Cc: "jianchao.wang" <jianchao.w.w...@oracle.com> Signed-off-by: Ming Lei <ming@redhat.com> --- block/blk-mq.c | 20 ++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff

[PATCH 1/2] blk-mq: make sure hctx->next_cpu is set correctly

2018-01-17 Thread Ming Lei
.w...@oracle.com> Fixes: 20e4d81393 ("blk-mq: simplify queue mapping & schedule with each possisble CPU") Signed-off-by: Ming Lei <ming@redhat.com> --- block/blk-mq.c | 31 +-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/block/b

[PATCH 0/2] blk-mq: two patches related with CPU hotplug

2018-01-17 Thread Ming Lei
Hi Jens, The 1st one fixes one regression caused by 20e4d81393 ("blk-mq: simplify queue mapping & schedule with each possisble CPU"). The 2nd one add commens about current race, and convert the WARN_ON into printk(KERN_WARN) since this warning is harmless. Thanks, Ming Lei (2):

Re: [PATCH 2/2] blk-mq: simplify queue mapping & schedule with each possisble CPU

2018-01-17 Thread Ming Lei
On Wed, Jan 17, 2018 at 11:07:48AM +0100, Christian Borntraeger wrote: > > > On 01/17/2018 10:57 AM, Ming Lei wrote: > > Hi Jianchao, > > > > On Wed, Jan 17, 2018 at 04:09:11PM +0800, jianchao.wang wrote: > >> Hi ming > >> > >> Thanks for

Re: [PATCH 2/2] blk-mq: simplify queue mapping & schedule with each possisble CPU

2018-01-17 Thread Ming Lei
Hi Jianchao, On Wed, Jan 17, 2018 at 04:09:11PM +0800, jianchao.wang wrote: > Hi ming > > Thanks for your kindly response. > > On 01/17/2018 02:22 PM, Ming Lei wrote: > > This warning can't be removed completely, for example, the CPU figured > > in blk_mq_hct

Re: [PATCH 2/2] blk-mq: simplify queue mapping & schedule with each possisble CPU

2018-01-16 Thread Ming Lei
Hi Jianchao, On Wed, Jan 17, 2018 at 01:24:23PM +0800, jianchao.wang wrote: > Hi ming > > Thanks for your kindly response. > > On 01/17/2018 11:52 AM, Ming Lei wrote: > >> It is here. > >> __blk_mq_run_hw_queue() > >> > >> WARN_ON(!cpu

Re: [PATCH 2/2] blk-mq: simplify queue mapping & schedule with each possisble CPU

2018-01-16 Thread Ming Lei
Hi Jianchao, On Wed, Jan 17, 2018 at 10:56:13AM +0800, jianchao.wang wrote: > Hi ming > > Thanks for your patch and kindly response. You are welcome! > > On 01/16/2018 11:32 PM, Ming Lei wrote: > > OK, I got it, and it should have been the only corner case in whic

Re: [LSF/MM TOPIC] A high-performance userspace block driver

2018-01-16 Thread Ming Lei
kernel side continue to complete the IO, such as copying page from storage range to req(bio) pages. Seems READ should be fine since it is very similar with the use case of QEMU postcopy live migration, WRITE can be a bit different, and maybe need some change on userfaultfd. -- Ming Lei

Re: [PATCH 3/3] block: Protect less code with sysfs_lock in blk_{un,}register_queue()

2018-01-16 Thread Ming Lei
ter_queue(q); > mutex_unlock(>sysfs_lock); > + > + kobject_put(_to_dev(disk)->kobj); > } > diff --git a/block/elevator.c b/block/elevator.c > index e87e9b43aba0..4b7957b28a99 100644 > --- a/block/elevator.c > +++ b/block/elevator.c > @@ -1080,10 +1080,6 @@ static int __elevator_change(struct request_queue *q, > const char *name) > char elevator_name[ELV_NAME_MAX]; > struct elevator_type *e; > > - /* Make sure queue is not in the middle of being removed */ > - if (!test_bit(QUEUE_FLAG_REGISTERED, >queue_flags)) > - return -ENOENT; > - The above check shouldn't be removed, as I explained above. -- Ming Lei

Re: [PATCH 0/2] genirq/affinity: try to make sure online CPU is assgined to irq vector

2018-01-16 Thread Ming Lei
On Tue, Jan 16, 2018 at 03:22:18PM +, Don Brace wrote: > > -Original Message- > > From: Laurence Oberman [mailto:lober...@redhat.com] > > Sent: Tuesday, January 16, 2018 7:29 AM > > To: Thomas Gleixner <t...@linutronix.de>; Ming Lei <ming@redhat.

Re: [PATCH 2/2] blk-mq: simplify queue mapping & schedule with each possisble CPU

2018-01-16 Thread Ming Lei
On Tue, Jan 16, 2018 at 10:31:42PM +0800, jianchao.wang wrote: > Hi minglei > > On 01/16/2018 08:10 PM, Ming Lei wrote: > >>> - next_cpu = cpumask_next(hctx->next_cpu, hctx->cpumask); > >>> + next_cpu = cpumask

Re: [PATCH 0/2] genirq/affinity: try to make sure online CPU is assgined to irq vector

2018-01-16 Thread Ming Lei
On Tue, Jan 16, 2018 at 12:25:19PM +0100, Thomas Gleixner wrote: > On Tue, 16 Jan 2018, Ming Lei wrote: > > > On Mon, Jan 15, 2018 at 09:40:36AM -0800, Christoph Hellwig wrote: > > > On Tue, Jan 16, 2018 at 12:03:43AM +0800, Ming Lei wrote: > > > > Hi, > >

Re: [PATCH 2/2] blk-mq: simplify queue mapping & schedule with each possisble CPU

2018-01-16 Thread Ming Lei
Hi Jianchao, On Tue, Jan 16, 2018 at 06:12:09PM +0800, jianchao.wang wrote: > Hi Ming > > On 01/12/2018 10:53 AM, Ming Lei wrote: > > From: Christoph Hellwig <h...@lst.de> > > > > The previous patch assigns interrupt vectors to all possible CPUs, so > >

Re: [PATCH V4 1/3] blk-mq: move actual issue into one helper

2018-01-15 Thread Ming Lei
On Tue, Jan 16, 2018 at 9:40 AM, Ming Lei <ming@redhat.com> wrote: > On Mon, Jan 15, 2018 at 10:29:46AM -0700, Jens Axboe wrote: >> On 1/15/18 9:58 AM, Ming Lei wrote: >> > No functional change, just to clean up code a bit, so that the following >>

Re: [for-4.16 PATCH v5 0/4] block/dm: allow DM to defer blk_register_queue() until ready

2018-01-15 Thread Ming Lei
gt; Any chance you apply this and re-run your srp_test that triggered the > lockdep splat? > > diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c > index 4a6a40ffd78e..c50e08e9bf17 100644 > --- a/block/blk-sysfs.c > +++ b/block/blk-sysfs.c > @@ -952,10 +952,10 @@ void blk_unregister_queue(struct gendisk *disk) > if (q->request_fn || (q->mq_ops && q->elevator)) > elv_unregister_queue(q); > > + mutex_unlock(>sysfs_lock); > + > kobject_uevent(>kobj, KOBJ_REMOVE); > kobject_del(>kobj); > blk_trace_remove_sysfs(disk_to_dev(disk)); > kobject_put(_to_dev(disk)->kobj); > - > - mutex_unlock(>sysfs_lock); > } If this patch is required, similar change should be needed in failure path of blk_register_queue() too. -- Ming Lei

Re: [PATCH 0/2] genirq/affinity: try to make sure online CPU is assgined to irq vector

2018-01-15 Thread Ming Lei
On Mon, Jan 15, 2018 at 09:40:36AM -0800, Christoph Hellwig wrote: > On Tue, Jan 16, 2018 at 12:03:43AM +0800, Ming Lei wrote: > > Hi, > > > > These two patches fixes IO hang issue reported by Laurence. > > > > 84676c1f21 ("genirq/affinity: assign vectors to

Re: [PATCH V4 0/3] blk-mq: issue request directly for blk_insert_cloned_request

2018-01-15 Thread Ming Lei
On Mon, Jan 15, 2018 at 12:43:44PM -0500, Mike Snitzer wrote: > On Mon, Jan 15 2018 at 11:58am -0500, > Ming Lei <ming@redhat.com> wrote: > > > Hi Guys, > > > > The 3 paches changes the blk-mq part of blk_insert_cloned_request(), > > in which we sw

Re: [PATCH V4 1/3] blk-mq: move actual issue into one helper

2018-01-15 Thread Ming Lei
On Mon, Jan 15, 2018 at 10:29:46AM -0700, Jens Axboe wrote: > On 1/15/18 9:58 AM, Ming Lei wrote: > > No functional change, just to clean up code a bit, so that the following > > change of using direct issue for blk_mq_request_bypass_insert() which is > > needed by D

Re: [PATCH V4 1/3] blk-mq: move actual issue into one helper

2018-01-15 Thread Ming Lei
On Mon, Jan 15, 2018 at 12:15:47PM -0500, Mike Snitzer wrote: > On Mon, Jan 15 2018 at 11:58am -0500, > Ming Lei <ming@redhat.com> wrote: > > > No functional change, just to clean up code a bit, so that the following > > change of using direct issue for blk_mq_re

Re: [PATCH 0/2] genirq/affinity: try to make sure online CPU is assgined to irq vector

2018-01-15 Thread Ming Lei
On Mon, Jan 15, 2018 at 06:43:47PM +0100, Thomas Gleixner wrote: > On Tue, 16 Jan 2018, Ming Lei wrote: > > These two patches fixes IO hang issue reported by Laurence. > > > > 84676c1f21 ("genirq/affinity: assign vectors to all possible CPUs") > > may cause o

Re: [PATCH 0/2] genirq/affinity: try to make sure online CPU is assgined to irq vector

2018-01-15 Thread Ming Lei
On Mon, Jan 15, 2018 at 09:40:36AM -0800, Christoph Hellwig wrote: > On Tue, Jan 16, 2018 at 12:03:43AM +0800, Ming Lei wrote: > > Hi, > > > > These two patches fixes IO hang issue reported by Laurence. > > > > 84676c1f21 ("genirq/affinity: assign vectors to

Re: [GIT PULL] block changes to improve device mapper for 4.16

2018-01-15 Thread Ming Lei
used exclusively by request-based DM's blk-mq mode, that enable > > substantial dm-mpath sequential IO performance improvements. > > > > -------- > > Mike Snitzer (4): > > block: only bdi_unregister() i

[PATCH V4 3/3] blk-mq: issue request directly for blk_insert_cloned_request

2018-01-15 Thread Ming Lei
off-by: Ming Lei <ming@redhat.com> --- block/blk-mq.c | 29 ++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 1654c9c284d8..ce3965f271e3 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -1730,6 +1730,11

[PATCH V4 1/3] blk-mq: move actual issue into one helper

2018-01-15 Thread Ming Lei
No functional change, just to clean up code a bit, so that the following change of using direct issue for blk_mq_request_bypass_insert() which is needed by DM can be easier to do. Signed-off-by: Ming Lei <ming@redhat.com> --- block/blk-mq.c | 39 +++-

[PATCH V4 2/3] blk-mq: return dispatch result to caller in blk_mq_try_issue_directly

2018-01-15 Thread Ming Lei
In the following patch, we will use blk_mq_try_issue_directly() for DM to return the dispatch result, and DM need this informatin to improve IO merge. Signed-off-by: Ming Lei <ming@redhat.com> --- block/blk-mq.c | 23 ++- 1 file changed, 14 insertions(+), 9 del

[PATCH V4 0/3] blk-mq: issue request directly for blk_insert_cloned_request

2018-01-15 Thread Ming Lei
of block tree - add missed pg_init_all_paths() in patch 1, according to Bart's review V2: - drop 'dm-mpath: cache ti->clone during requeue', which is a bit too complicated, and not see obvious performance improvement. - make change on blk-mq part cleaner Ming Lei

[PATCH 2/2] genirq/affinity: try best to make sure online CPU is assigned to vector

2018-01-15 Thread Ming Lei
wig <h...@lst.de> Reported-by: Laurence Oberman <lober...@redhat.com> Signed-off-by: Ming Lei <ming@redhat.com> --- kernel/irq/affinity.c | 21 ++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/kernel/irq/affinity.c b/kernel/irq/affinity.c index 99eb38

[PATCH 1/2] genirq/affinity: move irq vectors spread into one function

2018-01-15 Thread Ming Lei
: Thomas Gleixner <t...@linutronix.de> Cc: Christoph Hellwig <h...@lst.de> Signed-off-by: Ming Lei <ming@redhat.com> --- kernel/irq/affinity.c | 56 +++ 1 file changed, 34 insertions(+), 22 deletions(-) diff --git a/kernel/irq/a

[PATCH 0/2] genirq/affinity: try to make sure online CPU is assgined to irq vector

2018-01-15 Thread Ming Lei
e function, and prepares for the fix done in 2nd patch. The 2nd patch fixes the issue by trying to make sure online CPUs assigned to irq vector. Ming Lei (2): genirq/affinity: move irq vectors spread into one function genirq/affinity: try best to make sure online CPU is assigned to vector

Re: 4.16 genirq change prevents HP servers from booting [was: Re: linux-next: Signed-off-by missing for commit in the device-mapper tree]

2018-01-15 Thread Ming Lei
On Mon, Jan 15, 2018 at 10:25:01AM -0500, Mike Snitzer wrote: > On Mon, Jan 15 2018 at 8:27am -0500, > Stephen Rothwell wrote: > > > Hi all, > > > > Commit > > > > 34e1467da673 ("Revert "genirq/affinity: assign vectors to all possible > > CPUs"") > > > > is missing

Re: BUG: unable to handle kernel NULL pointer dereference at 0000000000000436

2018-01-14 Thread Ming Lei
On Fri, Jan 12, 2018 at 04:21:33PM +0100, Paolo Valente wrote: > > > > Il giorno 12 gen 2018, alle ore 09:29, Paolo Valente > > <paolo.vale...@linaro.org> ha scritto: > > > > > > > >> Il giorno 12 gen 2018, alle ore 05:18, Ming Lei <mi

Re: [PATCHSET v5] blk-mq: reimplement timeout handling

2018-01-14 Thread Ming Lei
d until a name is assigned). This is a dm-mpath queue. > > There seems to be something wrong in hctx->nr_active. Then looks it is same with the issue I saw during starting multipathd, and the following patch should fix that, if there isn't other issue. https://marc.info/?l=linux-block=151586577400558=2 -- Ming Lei

Re: [PATCHSET v5] blk-mq: reimplement timeout handling

2018-01-13 Thread Ming Lei
On Sat, Jan 13, 2018 at 10:45:14PM +0800, Ming Lei wrote: > On Fri, Jan 12, 2018 at 04:55:34PM -0500, Laurence Oberman wrote: > > On Fri, 2018-01-12 at 20:57 +, Bart Van Assche wrote: > > > On Tue, 2018-01-09 at 08:29 -0800, Tejun Heo wrote: > > > > Currently, bl

[PATCH] blk-mq: don't clear RQF_MQ_INFLIGHT in blk_mq_rq_ctx_init()

2018-01-13 Thread Ming Lei
equest fields for better cache layout") Signed-off-by: Ming Lei <ming@redhat.com> --- block/blk-mq.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index ef9beca2d117..c1c74d891ce7 100644 --- a/block/blk-mq.c +++ b/block/blk

Re: [PATCH v2 3/4] scsi: Avoid that .queuecommand() gets called for a quiesced SCSI device

2018-01-13 Thread Ming Lei
On Fri, Jan 12, 2018 at 10:45:57PM +, Bart Van Assche wrote: > On Thu, 2018-01-11 at 10:23 +0800, Ming Lei wrote: > > > not sufficient to prevent .queuecommand() calls from scsi_send_eh_cmnd(). > > > > Given it is error handling, do we need to prevent

Re: [PATCH v2 4/4] IB/srp: Fix a sleep-in-invalid-context bug

2018-01-13 Thread Ming Lei
On Wed, Jan 10, 2018 at 10:18:17AM -0800, Bart Van Assche wrote: > The previous two patches guarantee that srp_queuecommand() does not get > invoked while reconnecting occurs. Hence remove the code from > srp_queuecommand() that prevents command queueing while reconnecting. > This patch avoids

Re: [PATCH V3 0/5] dm-rq: improve sequential I/O performance

2018-01-13 Thread Ming Lei
On Fri, Jan 12, 2018 at 05:31:17PM -0500, Mike Snitzer wrote: > On Fri, Jan 12 2018 at 1:54pm -0500, > Bart Van Assche wrote: > > > On Fri, 2018-01-12 at 13:06 -0500, Mike Snitzer wrote: > > > OK, you have the stage: please give me a pointer to your best > > >

Re: [PATCHSET v5] blk-mq: reimplement timeout handling

2018-01-13 Thread Ming Lei
On Fri, Jan 12, 2018 at 04:55:34PM -0500, Laurence Oberman wrote: > On Fri, 2018-01-12 at 20:57 +, Bart Van Assche wrote: > > On Tue, 2018-01-09 at 08:29 -0800, Tejun Heo wrote: > > > Currently, blk-mq timeout path synchronizes against the usual > > > issue/completion path using a complex

Re: [PATCH V3 0/5] dm-rq: improve sequential I/O performance

2018-01-13 Thread Ming Lei
On Fri, Jan 12, 2018 at 06:54:49PM +, Bart Van Assche wrote: > On Fri, 2018-01-12 at 13:06 -0500, Mike Snitzer wrote: > > OK, you have the stage: please give me a pointer to your best > > explaination of the several. > > Since the previous discussion about this topic occurred more than a

Re: [for-4.16 PATCH v6 2/4] block: properly protect the 'queue' kobj in blk_unregister_queue

2018-01-13 Thread Ming Lei
(q->queue_lock); > + queue_flag_clear(QUEUE_FLAG_REGISTERED, q); > + spin_unlock_irq(q->queue_lock); > > + wbt_exit(q); > > if (q->mq_ops) > blk_mq_unregister_dev(disk_to_dev(disk), q); > @@ -946,4 +951,6 @@ void blk_unregister_queue(struct gendisk *disk) > kobject_del(>kobj); > blk_trace_remove_sysfs(disk_to_dev(disk)); > kobject_put(_to_dev(disk)->kobj); > + > + mutex_unlock(>sysfs_lock); > } Reviewed-by: Ming Lei <ming@redhat.com> -- Ming

Re: [PATCHSET v5] blk-mq: reimplement timeout handling

2018-01-13 Thread Ming Lei
On Fri, Jan 12, 2018 at 04:55:34PM -0500, Laurence Oberman wrote: > On Fri, 2018-01-12 at 20:57 +, Bart Van Assche wrote: > > On Tue, 2018-01-09 at 08:29 -0800, Tejun Heo wrote: > > > Currently, blk-mq timeout path synchronizes against the usual > > > issue/completion path using a complex

Re: [PATCH V3 2/5] dm-mpath: return DM_MAPIO_REQUEUE in case of rq allocation failure

2018-01-12 Thread Ming Lei
On Fri, Jan 12, 2018 at 07:04:28PM +, Bart Van Assche wrote: > On Thu, 2018-01-11 at 14:01 +0800, Ming Lei wrote: > > diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c > > index 86bf502a8e51..fcddf5a62581 100644 > > --- a/drivers/md/dm-mpath.c > >

Re: [for-4.16 PATCH v5 2/4] block: properly protect the 'queue' kobj in blk_unregister_queue

2018-01-12 Thread Ming Lei
On Fri, Jan 12, 2018 at 10:06:04AM -0500, Mike Snitzer wrote: > The original commit e9a823fb34a8b (block: fix warning when I/O elevator > is changed as request_queue is being removed) is pretty conflated. > "conflated" because the resource being protected by q->sysfs_lock isn't > the queue_flags

Re: [for-4.16 PATCH v4 2/4] block: use queue_lock when clearing QUEUE_FLAG_REGISTERED in blk_unregister_queue

2018-01-12 Thread Ming Lei
On Fri, Jan 12, 2018 at 07:53:40AM -0500, Mike Snitzer wrote: > On Fri, Jan 12 2018 at 2:09am -0500, > Ming Lei <ming@redhat.com> wrote: > > > On Thu, Jan 11, 2018 at 03:14:15PM -0500, Mike Snitzer wrote: > > > blk_unregister_queue() must protect agains

Re: [for-4.16 PATCH v4 3/4] block: allow gendisk's request_queue registration to be deferred

2018-01-11 Thread Ming Lei
index 5144ebe046c9..5e3531027b51 100644 > --- a/include/linux/genhd.h > +++ b/include/linux/genhd.h > @@ -395,6 +395,11 @@ static inline void add_disk(struct gendisk *disk) > { > device_add_disk(NULL, disk); > } > +extern void device_add_disk_no_queue_reg(struct device *parent, struct > gendisk *disk); > +static inline void add_disk_no_queue_reg(struct gendisk *disk) > +{ > + device_add_disk_no_queue_reg(NULL, disk); > +} > > extern void del_gendisk(struct gendisk *gp); > extern struct gendisk *get_gendisk(dev_t dev, int *partno); > -- > 2.15.0 > Looks fine: Reviewed-by: Ming Lei <ming@redhat.com> -- Ming

Re: [for-4.16 PATCH v4 2/4] block: use queue_lock when clearing QUEUE_FLAG_REGISTERED in blk_unregister_queue

2018-01-11 Thread Ming Lei
On Thu, Jan 11, 2018 at 03:14:15PM -0500, Mike Snitzer wrote: > blk_unregister_queue() must protect against any modifications of > q->queue_flags (not just those performed in blk-sysfs.c). Therefore > q->queue_lock needs to be used rather than q->sysfs_lock. > > Fixes: e9a823fb34a8b ("block: fix

Re: BUG: unable to handle kernel NULL pointer dereference at 0000000000000436

2018-01-11 Thread Ming Lei
On Thu, Jan 11, 2018 at 08:40:54AM -0700, Jens Axboe wrote: > On 1/11/18 2:41 AM, Paolo Valente wrote: > > > > > >> Il giorno 11 gen 2018, alle ore 10:30, Paolo Valente > >> <paolo.vale...@linaro.org> ha scritto: > >> > >> > &g

Re: [PATCH V3 0/5] dm-rq: improve sequential I/O performance

2018-01-11 Thread Ming Lei
On Thu, Jan 11, 2018 at 08:57:21PM -0500, Mike Snitzer wrote: > On Thu, Jan 11 2018 at 8:42pm -0500, > Ming Lei <ming@redhat.com> wrote: > > > On Thu, Jan 11, 2018 at 10:37:37PM +, Bart Van Assche wrote: > > > On Thu, 2018-01-11 at 17:07 -0500, Mi

[PATCH 1/2] genirq/affinity: assign vectors to all possible CPUs

2018-01-11 Thread Ming Lei
From: Christoph Hellwig Currently we assign managed interrupt vectors to all present CPUs. This works fine for systems were we only online/offline CPUs. But in case of systems that support physical CPU hotplug (or the virtualized version of it) this means the additional CPUs

[PATCH 2/2] blk-mq: simplify queue mapping & schedule with each possisble CPU

2018-01-11 Thread Ming Lei
lwig <h...@lst.de> (merged the three into one because any single one may not work, and fix selecting online CPUs for scheduler) Signed-off-by: Ming Lei <ming@redhat.com> --- block/blk-mq.c | 19 --- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/block/b

[PATCH 0/2] blk-mq: support physical CPU hotplug

2018-01-11 Thread Ming Lei
Hi, This two patches support physical CPU hotplug, so that we can make blk-mq scale well when new physical CPU is added or removed, and this use case is normal for VM world. Also this patchset fixes the following warning reported by Christian Borntraeger:

Re: [PATCH V3 0/5] dm-rq: improve sequential I/O performance

2018-01-11 Thread Ming Lei
On Thu, Jan 11, 2018 at 10:37:37PM +, Bart Van Assche wrote: > On Thu, 2018-01-11 at 17:07 -0500, Mike Snitzer wrote: > > Bart, if for some reason we regress for some workload you're able to > > more readily test we can deal with it. But I'm too encouraged by Ming's > > performance

Re: 4.14: WARNING: CPU: 4 PID: 2895 at block/blk-mq.c:1144 with virtio-blk (also 4.12 stable)

2018-01-11 Thread Ming Lei
On Thu, Jan 11, 2018 at 06:46:54PM +0100, Christoph Hellwig wrote: > Thanks for looking into this Ming, I had missed it in the my current > work overload. Can you send the updated series to Jens? OK, I will post it out soon. Thanks, Ming

Re: 4.14: WARNING: CPU: 4 PID: 2895 at block/blk-mq.c:1144 with virtio-blk (also 4.12 stable)

2018-01-11 Thread Ming Lei
On Wed, Dec 20, 2017 at 04:47:21PM +0100, Christian Borntraeger wrote: > On 12/18/2017 02:56 PM, Stefan Haberland wrote: > > On 07.12.2017 00:29, Christoph Hellwig wrote: > >> On Wed, Dec 06, 2017 at 01:25:11PM +0100, Christian Borntraeger wrote: > >> t > commit

[PATCH V3 4/5] blk-mq: return dispatch result to caller in blk_mq_try_issue_directly

2018-01-10 Thread Ming Lei
In the following patch, we will use blk_mq_try_issue_directly() for DM to return the dispatch result, and DM need this informatin to improve IO merge. Signed-off-by: Ming Lei <ming@redhat.com> --- block/blk-mq.c | 23 ++- 1 file changed, 14 insertions(+), 9 del

[PATCH V3 5/5] blk-mq: issue request directly for blk_insert_cloned_request

2018-01-10 Thread Ming Lei
off-by: Ming Lei <ming@redhat.com> --- block/blk-core.c | 3 +-- block/blk-mq.c | 34 ++ block/blk-mq.h | 3 +++ drivers/md/dm-rq.c | 19 --- 4 files changed, 50 insertions(+), 9 deletions(-) diff --git a/block/blk-core.c b/block/b

[PATCH V3 3/5] blk-mq: move actual issue into one helper

2018-01-10 Thread Ming Lei
No functional change, just to clean up code a bit, so that the following change of using direct issue for blk_mq_request_bypass_insert() which is needed by DM can be easier to do. Signed-off-by: Ming Lei <ming@redhat.com> --- block/blk-mq.c | 39 +++-

[PATCH V3 2/5] dm-mpath: return DM_MAPIO_REQUEUE in case of rq allocation failure

2018-01-10 Thread Ming Lei
gets improved. Signed-off-by: Ming Lei <ming@redhat.com> --- drivers/md/dm-mpath.c | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index 86bf502a8e51..fcddf5a62581 100644 --- a/drivers/md/dm-mpath.c +++ b/d

[PATCH V3 1/5] dm-mpath: don't call blk_mq_delay_run_hw_queue() in case of BLK_STS_RESOURCE

2018-01-10 Thread Ming Lei
makes sure that dm-rq returns BLK_STS_RESOURCE to blk-mq only when underlying queue is out of resource, so we switch to return DM_MAPIO_DELAY_REQUEU if either MPATHF_QUEUE_IO or MPATHF_PG_INIT_REQUIRED is set in multipath_clone_and_map(). Signed-off-by: Ming Lei <ming@redhat.com> --- driv

[PATCH V3 0/5] dm-rq: improve sequential I/O performance

2018-01-10 Thread Ming Lei
- add missed pg_init_all_paths() in patch 1, according to Bart's review V2: - drop 'dm-mpath: cache ti->clone during requeue', which is a bit too complicated, and not see obvious performance improvement. - make change on blk-mq part cleaner Ming Lei (5): dm-mp

Re: [for-4.16 PATCH v3 3/3] dm: fix awkward and incomplete request_queue initialization

2018-01-10 Thread Ming Lei
0; > } > > @@ -2121,7 +2130,6 @@ EXPORT_SYMBOL_GPL(dm_device_name); > > static void __dm_destroy(struct mapped_device *md, bool wait) > { > - struct request_queue *q = dm_get_md_queue(md); > struct dm_table *map; > int srcu_idx; > > @@ -2132,7 +2140,7 @@ static void __dm_destroy(struct mapped_device *md, bool > wait) > set_bit(DMF_FREEING, >flags); > spin_unlock(&_minor_lock); > > - blk_set_queue_dying(q); > + blk_set_queue_dying(md->queue); > > if (dm_request_based(md) && md->kworker_task) > kthread_flush_worker(>kworker); > -- > 2.15.0 > Pass some of my block/DM sanity test, and blk-mq debugfs can be used with this patch on DM-MPATH. Tested-by: Ming Lei <ming@redhat.com> -- Ming

Re: [for-4.16 PATCH v3 2/3] block: allow gendisk's request_queue registration to be deferred

2018-01-10 Thread Ming Lei
T ((1 << QUEUE_FLAG_IO_STAT) |\ >(1 << QUEUE_FLAG_SAME_COMP)| \ > -- > 2.15.0 This way is safe for all other devices, even for DM it is safe too since block does deal with NULL .make_request_fn well for legacy path. Maybe QUEUE_FLAG_DEFER_REG can be renamed as QUEUE_FLAG_REG_BY_DRIVER, but not a big deal, so Reviewed-by: Ming Lei <ming@redhat.com> -- Ming

Re: [for-4.16 PATCH v3 1/3] block: only bdi_unregister() in del_gendisk() if !GENHD_FL_HIDDEN

2018-01-10 Thread Ming Lei
di_unregister(disk->queue->backing_dev_info); > blk_unregister_queue(disk); > } else { > WARN_ON(1); > -- > 2.15.0 > Reviewed-by: Ming Lei <ming@redhat.com> -- Ming

Re: [PATCH v2 3/4] scsi: Avoid that .queuecommand() gets called for a quiesced SCSI device

2018-01-10 Thread Ming Lei
On Wed, Jan 10, 2018 at 10:18:16AM -0800, Bart Van Assche wrote: > Several SCSI transport and LLD drivers surround code that does not > tolerate concurrent calls of .queuecommand() with scsi_target_block() / > scsi_target_unblock(). These last two functions use > blk_mq_quiesce_queue() /

<    3   4   5   6   7   8   9   10   11   12   >