[PATCH 6/6] scsi: Implement blk_mq_ops.show_rq()

2017-04-11 Thread Bart Van Assche
Show the SCSI CDB, .eh_eflags and .result for pending SCSI commands in /sys/kernel/debug/block/*/mq/*/dispatch and */rq_list. Signed-off-by: Bart Van Assche Cc: Martin K. Petersen Cc: James Bottomley Cc: Omar Sandoval Cc: Hannes Reinecke Cc: --- drivers/scsi/scsi_lib.c | 27

[PATCH 4/6] blk-mq: Show operation, cmd_flags and rq_flags names

2017-04-11 Thread Bart Van Assche
Show the operation name, .cmd_flags and .rq_flags as names instead of numbers. Signed-off-by: Bart Van Assche Cc: Omar Sandoval Cc: Hannes Reinecke --- block/blk-mq-debugfs.c | 72 +++--- 1 file changed, 69 insertions(+), 3 deletions(-) diff --git

[PATCH 1/6] blk-mq: Do not invoke queue operations on a dead queue

2017-04-11 Thread Bart Van Assche
The blk-mq debugfs attributes are removed after blk_cleanup_queue() has finished. Since running a queue after a queue has entered the "dead" state is not allowed, disallow this. This patch avoids that an attempt to run a dead queue triggers a kernel crash. Signed-off-by: Bart Van Assche

Re: [PATCH v5] lightnvn: pblk

2017-04-11 Thread Bart Van Assche
On Wed, 2017-04-12 at 00:13 +0200, Javier González wrote: > please point out to any other tools/concerns you may have. Hello Javier, Do you already have an account at https://scan.coverity.com/? Any Linux kernel developer can get an account for free. A full Coverity scan of Linus' tree is availab

[PATCH] blk-mq: Fix blk_execute_rq_nowait() handling of dying queues

2017-04-11 Thread Bart Van Assche
st onto a dying queue by changing the blk_freeze_queue_start() call in blk_set_queue_dying() into a blk_freeze_queue() call. Signed-off-by: Bart Van Assche Cc: Mike Snitzer Cc: Ming Lei Cc: --- block/blk-core.c | 9 + block/blk-exec.c | 7 +-- 2 files changed, 10 insertions(+), 6 de

Re: [PATCH V3 00/16] Introduce the BFQ I/O scheduler

2017-04-12 Thread Bart Van Assche
On Wed, 2017-04-12 at 08:01 +0200, Paolo Valente wrote: > Where is my mistake? I think in the Makefile. How about the patch below? Please note that I'm no Kbuild expert. diff --git a/block/Makefile b/block/Makefile index 546066ee7fa6..b3711af6b637 100644 --- a/block/Makefile +++ b/block/Makefile

Re: [PATCH v4 0/6] Avoid that scsi-mq and dm-mq queue processing stalls sporadically

2017-04-12 Thread Bart Van Assche
On Wed, 2017-04-12 at 12:55 +0200, Benjamin Block wrote: > On Fri, Apr 07, 2017 at 11:16:48AM -0700, Bart Van Assche wrote: > > The six patches in this patch series fix the queue lockup I reported > > recently on the linux-block mailing list. Please consider these patches > >

Re: [PATCH] blk-mq: Fix blk_execute_rq_nowait() handling of dying queues

2017-04-12 Thread Bart Van Assche
On Wed, 2017-04-12 at 13:01 +0800, Ming Lei wrote: > On Wed, Apr 12, 2017 at 7:58 AM, Bart Van Assche > wrote: > > > > diff --git a/block/blk-exec.c b/block/blk-exec.c > > index 8cd0e9bc8dc8..f7d9bed2cb15 100644 > > --- a/block/blk-exec.c > > +++ b/block/blk

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

2017-04-12 Thread Bart Van Assche
On Wed, 2017-04-12 at 11:42 +0800, Ming Lei wrote: > On Tue, Apr 11, 2017 at 06:18:36PM +0000, Bart Van Assche wrote: > > On Tue, 2017-04-11 at 14:03 -0400, Mike Snitzer wrote: > > > Rather than working so hard to use DM code against me, your argument > > > should be:

Re: [PATCH] block: fix bio_will_gap()

2017-04-13 Thread Bart Van Assche
On Fri, 2017-04-14 at 00:06 +0800, Ming Lei wrote: > But if one rq starts with non-aligned buffer(the 1st bvec's > bv_offset isn't zero) and if we allow to merge, it is quite > difficult to respect sg gap limit, especially the segment > can't be at maximum segment size, otherwise the segment > ends

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

2017-04-13 Thread Bart Van Assche
On 04/12/17 19:20, Ming Lei wrote: > On Wed, Apr 12, 2017 at 06:38:07PM +0000, Bart Van Assche wrote: >> If the blk-mq core would always rerun a hardware queue if a block driver >> returns BLK_MQ_RQ_QUEUE_BUSY then that would cause 100% of a single CPU core > > It won't

Re: [PATCH 01/25] remove the mg_disk driver

2017-04-13 Thread Bart Van Assche
On Thu, 2017-04-06 at 17:39 +0200, Christoph Hellwig wrote: > This drivers was added in 2008, but as far as a I can tell we never had a > single platform that actually registered resources for the platform driver. > > It's also been unmaintained for a long time and apparently has a ATA mode > that

Re: [PATCH 02/25] block: remove the blk_execute_rq return value

2017-04-13 Thread Bart Van Assche
On Thu, 2017-04-06 at 17:39 +0200, Christoph Hellwig wrote: > diff --git a/fs/nfsd/blocklayout.c b/fs/nfsd/blocklayout.c > index 92b4b41d19d2..4b72fdf67548 100644 > --- a/fs/nfsd/blocklayout.c > +++ b/fs/nfsd/blocklayout.c > @@ -242,8 +242,8 @@ static int nfsd4_scsi_identify_device(struct block_dev

Re: [PATCH 06/25] virtio: fix spelling of virtblk_scsi_request_done

2017-04-13 Thread Bart Van Assche
On Thu, 2017-04-06 at 17:39 +0200, Christoph Hellwig wrote: > [ ... ] Reviewed-by: Bart Van Assche

Re: [PATCH 08/25] scsi: fix fast-fail for non-passthrough requests

2017-04-13 Thread Bart Van Assche
On Thu, 2017-04-06 at 17:39 +0200, Christoph Hellwig wrote: > Currently error is always 0 for non-passthrough requests when reaching the > scsi_noretry_cmd check in scsi_io_completion, which effectively disables > all fastfail logic. Fix this by having a single call to > __scsi_error_from_host_byt

Re: [PATCH 1/6] blk-mq: Do not invoke queue operations on a dead queue

2017-04-13 Thread Bart Van Assche
On Thu, 2017-04-13 at 16:01 -0700, Omar Sandoval wrote: > On Tue, Apr 11, 2017 at 01:58:37PM -0700, Bart Van Assche wrote: > > The blk-mq debugfs attributes are removed after blk_cleanup_queue() > > has finished. Since running a queue after a queue has entered the > > "

Re: [PATCH] block: Make writeback throttling defaults consistent for SQ devices

2017-04-14 Thread Bart Van Assche
On Wed, 2017-04-12 at 10:23 +0200, Jan Kara wrote: > +#ifndef CONFIG_BLK_WBT_MQ > + if (q->mq_ops) > + return; > +#endif > +#ifndef CONFIG_BLK_WBT_SQ > + if (q->request_fn) > + return; > +#endif > + > + /* > + * If this fails, we don't get throttling > +

Re: [PATCH 5/6] blk-mq: Add blk_mq_ops.show_rq()

2017-04-14 Thread Bart Van Assche
On Thu, 2017-04-13 at 16:21 -0700, Omar Sandoval wrote: > How about passing the seq_file to the callback instead of this > arbitrarily-sized on-stack buffer? Hello Omar, That sounds like a good idea to me. I will make that change. Bart.

Re: [PATCH 1/6] blk-mq: Do not invoke queue operations on a dead queue

2017-04-14 Thread Bart Van Assche
On Fri, 2017-04-14 at 00:40 -0700, Omar Sandoval wrote: > On Thu, Apr 13, 2017 at 11:05:32PM +0000, Bart Van Assche wrote: > > On Thu, 2017-04-13 at 16:01 -0700, Omar Sandoval wrote: > > > Looking at this, I think we have similar issues with most of the other > > > de

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

2017-04-14 Thread Bart Van Assche
On Fri, 2017-04-14 at 09:13 +0800, Ming Lei wrote: > On Thu, Apr 13, 2017 at 09:59:57AM -0700, Bart Van Assche wrote: > > On 04/12/17 19:20, Ming Lei wrote: > > > On Wed, Apr 12, 2017 at 06:38:07PM +0000, Bart Van Assche wrote: > > > > If the blk-mq core would alwa

Re: [PATCH 1/6] blk-mq: Do not invoke queue operations on a dead queue

2017-04-14 Thread Bart Van Assche
On Fri, 2017-04-14 at 10:13 -0700, Omar Sandoval wrote: > Thanks, Bart. In this case, the absence of the "mq" directory should > tell you that the queue is dead. Will you move the cleanup in v2 or > should I submit a separate patch? Hello Omar, I will include a patch in v2 of this patch series th

Re: [PATCH 1/3] blk-mq: unify hctx delayed_run_work and run_work

2017-04-14 Thread Bart Van Assche
On Fri, 2017-04-14 at 14:02 -0600, Jens Axboe wrote: > I was waiting for further comments on patch 3/3. Hello Jens, Patch 3/3 is probably fine but I hope that you understand that the introduction of a new race condition does not make me enthusiast. Should your explanation of why that race is harm

[PATCH v2 2/8] blk-mq: Let blk_mq_debugfs_register() look up the queue name

2017-04-17 Thread Bart Van Assche
A later patch will move the call of blk_mq_debugfs_register() to a function to which the queue name is not passed as an argument. To avoid having to add a 'name' argument to multiple callers, let blk_mq_debugfs_register() look up the queue name. Signed-off-by: Bart Van Assche Cc: Oma

[PATCH v2 4/8] blk-mq: Move the "state" debugfs attribute one level down

2017-04-17 Thread Bart Van Assche
Move the "state" attribute from the top level to the "mq" directory as requested by Omar. Signed-off-by: Bart Van Assche Reviewed-by: Omar Sandoval Cc: Hannes Reinecke --- block/blk-mq-debugfs.c | 9 + 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/bl

[PATCH v2 3/8] blk-mq: Unregister debugfs attributes earlier

2017-04-17 Thread Bart Van Assche
One of the debugfs attributes allows to run a queue. Since running a queue after a queue has entered the "dead" state is not allowed and even can cause a kernel crash, unregister the debugfs attributes before a queue reaches the "dead" state. Signed-off-by: Bart Van Assche C

[PATCH v2 7/8] blk-mq: Add blk_mq_ops.show_rq()

2017-04-17 Thread Bart Van Assche
This new callback function will be used in the next patch to show more information about SCSI requests. Signed-off-by: Bart Van Assche Cc: Omar Sandoval Cc: Hannes Reinecke --- block/blk-mq-debugfs.c | 6 +- include/linux/blk-mq.h | 6 ++ 2 files changed, 11 insertions(+), 1 deletion

[PATCH v2 0/8] blk-mq debugfs patches for kernel v4.12

2017-04-17 Thread Bart Van Assche
starts instead of checking the "dead" queue flag. - Changed "rq->cmd_flags ^ op" into "rq->cmd_flags & ~REQ_OP_MASK" as proposed by Omar. - A seq_file pointer is now passed to the new queue_rq callback function instead of a fixed-size char buffer. Bart V

[PATCH v2 5/8] blk-mq: Make blk_flags_show() callers append a newline character

2017-04-17 Thread Bart Van Assche
This patch does not change any functionality but makes it possible to produce a single line of output with multiple flag-to-name translations. Signed-off-by: Bart Van Assche Reviewed-by: Omar Sandoval Cc: Hannes Reinecke --- block/blk-mq-debugfs.c | 4 +++- 1 file changed, 3 insertions(+), 1

[PATCH v2 1/8] blk-mq: Register /queue/mq after having registered /queue

2017-04-17 Thread Bart Van Assche
ion with the queue sysfs_lock instead of the global mutex all_q_mutex. Signed-off-by: Bart Van Assche Cc: Omar Sandoval Cc: Hannes Reinecke --- block/blk-mq-sysfs.c | 37 ++--- block/blk-mq.h | 1 + block/blk-sysfs.c| 6 +++--- 3 files changed,

[PATCH v2 8/8] scsi: Implement blk_mq_ops.show_rq()

2017-04-17 Thread Bart Van Assche
Show the SCSI CDB, .eh_eflags and .result for pending SCSI commands in /sys/kernel/debug/block/*/mq/*/dispatch and */rq_list. Signed-off-by: Bart Van Assche Cc: Martin K. Petersen Cc: James Bottomley Cc: Omar Sandoval Cc: Hannes Reinecke Cc: --- drivers/scsi/scsi_lib.c | 26

[PATCH v2 6/8] blk-mq: Show operation, cmd_flags and rq_flags names

2017-04-17 Thread Bart Van Assche
Show the operation name, .cmd_flags and .rq_flags as names instead of numbers. Signed-off-by: Bart Van Assche Reviewed-by: Omar Sandoval Cc: Hannes Reinecke --- block/blk-mq-debugfs.c | 72 +++--- 1 file changed, 69 insertions(+), 3 deletions

[PATCH] ARM: Fix rd_size declaration

2017-04-17 Thread Bart Van Assche
The global variable 'rd_size' is declared as 'int' in source file arch/arm/kernel/atags_parse.c and as 'unsigned long' in drivers/block/brd.c. Fix this inconsistency. Signed-off-by: Bart Van Assche Cc: Russell King Cc: Jens Axboe Cc: Jan Kara Cc

Re: [PATCH] ARM: Fix rd_size declaration

2017-04-18 Thread Bart Van Assche
On Tue, 2017-04-18 at 09:35 +0200, Johannes Thumshirn wrote: > On Mon, Apr 17, 2017 at 04:10:03PM -0700, Bart Van Assche wrote: > > The global variable 'rd_size' is declared as 'int' in source file > > arch/arm/kernel/atags_parse.c and as 'unsigned lo

Re: RDMA performance comparison: IBNBD, SCST, NVMEoF

2017-04-18 Thread Bart Van Assche
On Tue, 2017-04-18 at 19:33 +0200, Roman Penyaev wrote: > By current email I would like to share some fresh RDMA performance > results of IBNBD, SCST and NVMEof, based on 4.10 kernel and variety > of configurations. Hello Roman, Thank you for having shared these results. But please do not expect

Re: block: remove the blk_execute_rq return value

2017-04-18 Thread Bart Van Assche
equest(rq); > return err; Hello Christoph, Sorry that I hadn't noticed this before but shouldn't "req" be changed into "rq"? Otherwise this patch looks fine to me. If this comment gets addressed you can add: Reviewed-by: Bart Van Assche

Re: scsi: introduce a new result field in struct scsi_request

2017-04-18 Thread Bart Van Assche
On Tue, 2017-04-18 at 08:52 -0700, Christoph Hellwig wrote: > --- a/block/bsg.c > +++ b/block/bsg.c > @@ -391,13 +391,13 @@ static int blk_complete_sgv4_hdr_rq(struct request *rq, > struct sg_io_v4 *hdr, > struct scsi_request *req = scsi_req(rq); > int ret = 0; > > - dprintk("rq

Re: blk-mq: remove the error argument to blk_mq_complete_request

2017-04-18 Thread Bart Van Assche
On Tue, 2017-04-18 at 08:52 -0700, Christoph Hellwig wrote: > Now that we always have a ->complete callback we can remove the direct > call to blk_mq_end_request, as well as the error argument to > blk_mq_complete_request. Hello Christoph, Please add a runtime check that issues a warning early if

Re: block: add a error_count field to struct request

2017-04-18 Thread Bart Van Assche
On Tue, 2017-04-18 at 08:52 -0700, Christoph Hellwig wrote: > From: Christoph Hellwig > > This is for the legacy floppy and ataflop drivers that currently abuse > ->errors for this purpose. It's stashed away in a union to not grow > the struct size, the other fields are either used by modern dri

Re: pd: remove bogus check for req->errors

2017-04-18 Thread Bart Van Assche
On Tue, 2017-04-18 at 08:52 -0700, Christoph Hellwig wrote: > The driver never sets req->errors Reviewed-by: Bart Van Assche

[PATCH 3/5] lightnvm: Use blk_init_request_from_bio() instead of open-coding it

2017-04-18 Thread Bart Van Assche
tor offset is copied into req->__sector instead of retaining the value -1 set by blk_mq_alloc_request(). * req->errors is initialized to zero. Signed-off-by: Bart Van Assche Cc: Christoph Hellwig Cc: Matias Bjørling Cc: Adam Manzanares --- drivers/nvme/host/lightnvm.c | 6 +- 1 file c

[PATCH 0/5] Reduce code duplication

2017-04-18 Thread Bart Van Assche
Hello Jens, This series contains three patches intended to reduce code duplication and two patches that simplify / optimize I/O priority handling. Please consider these patches for kernel v4.12. Thanks, Bart. Bart Van Assche (5): block: Export blk_init_request_from_bio() null_blk: Use

[PATCH 1/5] block: Export blk_init_request_from_bio()

2017-04-18 Thread Bart Van Assche
Export this function such that it becomes available to block drivers. Signed-off-by: Bart Van Assche Cc: Christoph Hellwig Cc: Matias Bjørling Cc: Adam Manzanares --- block/blk-core.c | 5 +++-- block/blk-mq.c | 2 +- block/blk.h| 1 - include/linux/blkdev.h | 1

[PATCH 4/5] block: Inline blk_rq_set_prio()

2017-04-18 Thread Bart Van Assche
Since only a single caller remains, inline blk_rq_set_prio(). Initialize req->ioprio even if no I/O priority has been set in the bio nor in the I/O context. Signed-off-by: Bart Van Assche Reviewed-by: Adam Manzanares Tested-by: Adam Manzanares Cc: Christoph Hellwig Cc: Matias Bjørl

[PATCH 5/5] block: Optimize ioprio_best()

2017-04-18 Thread Bart Van Assche
Since ioprio_best() translates IOPRIO_CLASS_NONE into IOPRIO_CLASS_BE and since lower numerical priority values represent a higher priority a simple numerical comparison is sufficient. Signed-off-by: Bart Van Assche Reviewed-by: Adam Manzanares Tested-by: Adam Manzanares Cc: Christoph Hellwig

[PATCH 2/5] null_blk: Use blk_init_request_from_bio() instead of open-coding it

2017-04-18 Thread Bart Van Assche
ULL. * req->errors is initialized to zero. Signed-off-by: Bart Van Assche Cc: Christoph Hellwig Cc: Matias Bjørling Cc: Adam Manzanares --- drivers/block/null_blk.c | 9 + 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c

[PATCH v3 0/8] blk-mq debugfs patches for kernel v4.12

2017-04-18 Thread Bart Van Assche
checking the "dead" queue flag. - Changed "rq->cmd_flags ^ op" into "rq->cmd_flags & ~REQ_OP_MASK" as proposed by Omar. - A seq_file pointer is now passed to the new queue_rq callback function instead of a fixed-size char buffer. Bart Van Assche (8):

[PATCH v3 2/8] blk-mq: Let blk_mq_debugfs_register() look up the queue name

2017-04-18 Thread Bart Van Assche
A later patch will move the call of blk_mq_debugfs_register() to a function to which the queue name is not passed as an argument. To avoid having to add a 'name' argument to multiple callers, let blk_mq_debugfs_register() look up the queue name. Signed-off-by: Bart Van Assche Cc: Oma

[PATCH v3 3/8] blk-mq: Unregister debugfs attributes earlier

2017-04-18 Thread Bart Van Assche
One of the debugfs attributes allows to run a queue. Since running a queue after a queue has entered the "dead" state is not allowed and even can cause a kernel crash, unregister the debugfs attributes before a queue reaches the "dead" state. Signed-off-by: Bart Van Assche C

[PATCH v3 7/8] blk-mq: Add blk_mq_ops.show_rq()

2017-04-18 Thread Bart Van Assche
This new callback function will be used in the next patch to show more information about SCSI requests. Signed-off-by: Bart Van Assche Cc: Omar Sandoval Cc: Hannes Reinecke --- block/blk-mq-debugfs.c | 6 +- include/linux/blk-mq.h | 6 ++ 2 files changed, 11 insertions(+), 1 deletion

[PATCH v3 6/8] blk-mq: Show operation, cmd_flags and rq_flags names

2017-04-18 Thread Bart Van Assche
Show the operation name, .cmd_flags and .rq_flags as names instead of numbers. Signed-off-by: Bart Van Assche Reviewed-by: Omar Sandoval Cc: Hannes Reinecke --- block/blk-mq-debugfs.c | 72 +++--- 1 file changed, 69 insertions(+), 3 deletions

[PATCH v3 5/8] blk-mq: Make blk_flags_show() callers append a newline character

2017-04-18 Thread Bart Van Assche
This patch does not change any functionality but makes it possible to produce a single line of output with multiple flag-to-name translations. Signed-off-by: Bart Van Assche Reviewed-by: Omar Sandoval Cc: Hannes Reinecke --- block/blk-mq-debugfs.c | 4 +++- 1 file changed, 3 insertions(+), 1

[PATCH v3 4/8] blk-mq: Move the "state" debugfs attribute one level down

2017-04-18 Thread Bart Van Assche
Move the "state" attribute from the top level to the "mq" directory as requested by Omar. Signed-off-by: Bart Van Assche Reviewed-by: Omar Sandoval Cc: Hannes Reinecke --- block/blk-mq-debugfs.c | 9 + 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/bl

[PATCH v3 1/8] blk-mq: Register /queue/mq after having registered /queue

2017-04-18 Thread Bart Van Assche
ion with the queue sysfs_lock instead of the global mutex all_q_mutex. Signed-off-by: Bart Van Assche Cc: Omar Sandoval Cc: Hannes Reinecke --- block/blk-mq-sysfs.c | 43 +++ block/blk-mq.h | 1 + block/blk-sysfs.c| 6 +++--- 3 files changed,

[PATCH v3 8/8] scsi: Implement blk_mq_ops.show_rq()

2017-04-18 Thread Bart Van Assche
Show the SCSI CDB, .eh_eflags and .result for pending SCSI commands in /sys/kernel/debug/block/*/mq/*/dispatch and */rq_list. Signed-off-by: Bart Van Assche Cc: Martin K. Petersen Cc: James Bottomley Cc: Omar Sandoval Cc: Hannes Reinecke Cc: --- drivers/scsi/scsi_lib.c | 26

Re: bfq-mq performance comparison to cfq

2017-04-18 Thread Bart Van Assche
On 04/11/17 00:29, Paolo Valente wrote: > >> Il giorno 10 apr 2017, alle ore 17:15, Bart Van Assche >> ha scritto: >> >> On Mon, 2017-04-10 at 11:55 +0200, Paolo Valente wrote: >>> That said, if you do always want maximum throughput, even at the >>>

Re: bfq-mq performance comparison to cfq

2017-04-19 Thread Bart Van Assche
On Wed, 2017-04-19 at 09:02 +0200, Paolo Valente wrote: > > Il giorno 19 apr 2017, alle ore 07:01, Bart Van Assche > > ha scritto: > > What API was used by the Android application to tell the I/O scheduler > > to optimize for latency? Do you think that it wo

Re: [PATCH 4/5] block: Inline blk_rq_set_prio()

2017-04-19 Thread Bart Van Assche
On Wed, 2017-04-19 at 08:38 -0600, Jens Axboe wrote: > On 04/19/2017 12:20 AM, Christoph Hellwig wrote: > > > + req->ioprio = ioprio_valid(bio_prio(bio)) ? bio_prio(bio) : ioc ? > > > + ioc->ioprio : IOPRIO_PRIO_VALUE(IOPRIO_CLASS_NONE, 0); > > > > I think this would be a tad cleaner with

[PATCH v2 1/5] block: Export blk_init_request_from_bio()

2017-04-19 Thread Bart Van Assche
Export this function such that it becomes available to block drivers. Signed-off-by: Bart Van Assche Reviewed-by: Christoph Hellwig Cc: Matias Bjørling Cc: Adam Manzanares --- block/blk-core.c | 5 +++-- block/blk-mq.c | 2 +- block/blk.h| 1 - include/linux

[PATCH v2 3/5] lightnvm: Use blk_init_request_from_bio() instead of open-coding it

2017-04-19 Thread Bart Van Assche
tor offset is copied into req->__sector instead of retaining the value -1 set by blk_mq_alloc_request(). * req->errors is initialized to zero. Signed-off-by: Bart Van Assche Reviewed-by: Christoph Hellwig Cc: Matias Bjørling Cc: Adam Manzanares --- drivers/nvme/host/lightnvm.c | 6 +

[PATCH v2 2/5] null_blk: Use blk_init_request_from_bio() instead of open-coding it

2017-04-19 Thread Bart Van Assche
ULL. * req->errors is initialized to zero. Signed-off-by: Bart Van Assche Reviewed-by: Christoph Hellwig Cc: Matias Bjørling Cc: Adam Manzanares --- drivers/block/null_blk.c | 9 + 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/block/null_blk.c b/drivers

[PATCH v2 0/5] Reduce code duplication

2017-04-19 Thread Bart Van Assche
. - Used EXPORT_SYMBOL_GPL() to export block layer internals. Bart Van Assche (5): block: Export blk_init_request_from_bio() null_blk: Use blk_init_request_from_bio() instead of open-coding it lightnvm: Use blk_init_request_from_bio() instead of open-coding it block: Inline blk_rq_set_prio

[PATCH v2 5/5] block: Optimize ioprio_best()

2017-04-19 Thread Bart Van Assche
Since ioprio_best() translates IOPRIO_CLASS_NONE into IOPRIO_CLASS_BE and since lower numerical priority values represent a higher priority a simple numerical comparison is sufficient. Signed-off-by: Bart Van Assche Reviewed-by: Adam Manzanares Tested-by: Adam Manzanares Reviewed-by: Christoph

[PATCH v2 4/5] block: Inline blk_rq_set_prio()

2017-04-19 Thread Bart Van Assche
Since only a single caller remains, inline blk_rq_set_prio(). Initialize req->ioprio even if no I/O priority has been set in the bio nor in the I/O context. Signed-off-by: Bart Van Assche Reviewed-by: Adam Manzanares Tested-by: Adam Manzanares Reviewed-by: Christoph Hellwig Cc: Mat

Re: [PATCH 01/23] pd: don't check blk_execute_rq return value.

2017-04-19 Thread Bart Van Assche
On Wed, 2017-04-19 at 21:26 +0200, Christoph Hellwig wrote: > The driver never sets req->errors, so blk_execute_rq will always return 0. Reviewed-by: Bart Van Assche

Re: [PATCH 02/23] block: remove the blk_execute_rq return value

2017-04-19 Thread Bart Van Assche
On Wed, 2017-04-19 at 21:26 +0200, Christoph Hellwig wrote: > --- a/drivers/scsi/osd/osd_initiator.c > +++ b/drivers/scsi/osd/osd_initiator.c > @@ -489,7 +489,10 @@ static void _set_error_resid(struct osd_request *or, > struct request *req, > > int osd_execute_request(struct osd_request *or) >

Re: [PATCH 23/23] block: remove the errors field from struct request

2017-04-19 Thread Bart Van Assche
On Wed, 2017-04-19 at 21:27 +0200, Christoph Hellwig wrote: > Signed-off-by: Christoph Hellwig > Acked-by: Roger Pau Monné > Reviewed-by: Konrad Rzeszutek Wilk Reviewed-by: Bart Van Assche

Re: [PATCH v3 8/8] scsi: Implement blk_mq_ops.show_rq()

2017-04-19 Thread Bart Van Assche
On Wed, 2017-04-19 at 19:25 -0400, Martin K. Petersen wrote: > Bart Van Assche writes: > > Show the SCSI CDB, .eh_eflags and .result for pending SCSI commands > > in /sys/kernel/debug/block/*/mq/*/dispatch and */rq_list. > > SCSI_EH_CANCEL_CMD is no more (as of a06586325f3

[PATCH] blk-throttle: Suppress a compiler warning

2017-04-19 Thread Bart Van Assche
: Bart Van Assche Cc: Shaohua Li --- block/blk-throttle.c | 4 1 file changed, 4 insertions(+) diff --git a/block/blk-throttle.c b/block/blk-throttle.c index c82bf9b1fe72..9081ed9a5345 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c @@ -2059,6 +2059,10 @@ bool blk_throtl_bio

Re: [PATCH 02/23] block: remove the blk_execute_rq return value

2017-04-20 Thread Bart Van Assche
On Thu, 2017-04-20 at 16:02 +0200, Christoph Hellwig wrote: > The function only returns -EIO if rq->errors is non-zero, which is not > very useful and lets a large number of callers ignore the return value. > > Just let the callers figure out their error themselves. Reviewed-by: Bart Van Assche

Re: [PATCH 08/23] scsi: introduce a result field in struct scsi_request

2017-04-20 Thread Bart Van Assche
s the errors field in very creative > ways and stores all kinds of different values in it. I didn't dare > to touch this magic, so the abuses are brought forward 1:1. Reviewed-by: Bart Van Assche

Re: [PATCH 11/23] dm rq: don't pass irrelevant error code to blk_mq_complete_request

2017-04-20 Thread Bart Van Assche
On Thu, 2017-04-20 at 16:03 +0200, Christoph Hellwig wrote: > dm never uses rq->errors, so there is no need to pass an error argument > to blk_mq_complete_request. Reviewed-by: Bart Van Assche

Re: [PATCH 12/23] dm mpath: don't check for req->errors

2017-04-20 Thread Bart Van Assche
On Thu, 2017-04-20 at 16:03 +0200, Christoph Hellwig wrote: > We'll get all proper errors reported through ->end_io and ->errors will > go away soon. Reviewed-by: Bart Van Assche

Re: [PATCH 16/23] blk-mq: remove the error argument to blk_mq_complete_request

2017-04-20 Thread Bart Van Assche
On Thu, 2017-04-20 at 16:03 +0200, Christoph Hellwig wrote: > Now that all drivers that call blk_mq_complete_requests have a > ->complete callback we can remove the direct call to blk_mq_end_request, > as well as the error argument to blk_mq_complete_request. Reviewed-by: Bart Van Assche

Re: [PATCH] blk-throttle: Suppress a compiler warning

2017-04-20 Thread Bart Van Assche
On Wed, 2017-04-19 at 18:09 -0600, Jens Axboe wrote: > On 04/19/2017 05:55 PM, Bart Van Assche wrote: > > Avoid that the following warning is reported when building with > > W=1 and with CONFIG_BLK_DEV_THROTTLING_LOW=n: > > > > block/blk-throttle.c: In function ‘blk

Re: [PATCH] blk-mq-sched: add might_sleep() check for flush/fua insert

2017-04-20 Thread Bart Van Assche
On Thu, 2017-04-20 at 16:45 -0600, Jens Axboe wrote: > If we're doing a flush/fua insert, insertion might block on getting > a driver tag, if can_block == true. Add a might_sleep check for that, > since we just had a bug like that. This will help us catch a similar > issue quicker in the future. >

Re: [PATCH] blk-mq-sched: add might_sleep() check for flush/fua insert

2017-04-20 Thread Bart Van Assche
/block/blk-mq.c > @@ -866,6 +866,8 @@ bool blk_mq_get_driver_tag(struct request *rq, struct > blk_mq_hw_ctx **hctx, > .flags = wait ? 0 : BLK_MQ_REQ_NOWAIT, > }; > > + might_sleep_if(wait); > + > if (rq->tag != -1) > goto done; > > Thanks! Reviewed-by: Bart Van Assche

[PATCH] blk-mq: Remove blk_mq_sched_move_to_dispatch()

2017-04-20 Thread Bart Van Assche
commit c13660a08c8b ("blk-mq-sched: change ->dispatch_requests() to ->dispatch_request()") removed the last user of this function. Hence also remove the function itself. Signed-off-by: Bart Van Assche Cc: Omar Sandoval Cc: Hannes Reinecke --- block/blk-mq-sched.c | 16 ---

for-4.12/block branch

2017-04-21 Thread Bart Van Assche
Hello Jens, Since yesterday the following complaint is reported frequently after having installed the for-4.12/block branch on my test setup. Unless someone has a better proposal, I will run a bisect. BUG: sleeping function called from invalid context at ./include/linux/buffer_head.h:349 in_atom

Re: for-4.12/block branch

2017-04-21 Thread Bart Van Assche
On Fri, 2017-04-21 at 10:33 -0600, Jens Axboe wrote: > On 04/21/2017 10:31 AM, Bart Van Assche wrote: > > On Fri, 2017-04-21 at 10:25 -0600, Jens Axboe wrote: > > > On 04/21/2017 09:32 AM, Bart Van Assche wrote: > > > > Hello Jens, > > > > > >

Re: for-4.12/block branch

2017-04-21 Thread Bart Van Assche
On Fri, 2017-04-21 at 10:25 -0600, Jens Axboe wrote: > On 04/21/2017 09:32 AM, Bart Van Assche wrote: > > Hello Jens, > > > > Since yesterday the following complaint is reported frequently after having > > installed the for-4.12/block branch on my test setup. Unle

Re: for-4.12/block branch

2017-04-21 Thread Bart Van Assche
On Fri, 2017-04-21 at 10:56 -0600, Jens Axboe wrote: > On 04/21/2017 10:48 AM, Jens Axboe wrote: > > I wonder if it's an imbalance in the preempt count. Looking at it, it > > looks like we're not clearing the alloc data. But I would think that > > would potentially cause much worse problems, but ma

[PATCH] blk-mq: Fix preempt count imbalance

2017-04-21 Thread Bart Van Assche
+0x36/0x40 vfs_statx+0x67/0xc0 SYSC_newfstatat+0x20/0x40 SyS_newfstatat+0xe/0x10 entry_SYSCALL_64_fastpath+0x18/0xad Fixes: b00c53e8f411 ("blk-mq: fix schedule-while-atomic with scheduler attached") Signed-off-by: Bart Van Assche Cc: Omar Sandoval --- block/blk-mq.c | 2 ++ 1 file

Re: BUG: KASAN: use-after-free in scsi_exit_rq

2017-04-21 Thread Bart Van Assche
On Thu, 2017-04-20 at 15:18 -0600, Scott Bauer wrote: > [ 642.638860] BUG: KASAN: use-after-free in scsi_exit_rq+0xf3/0x120 at addr > 8802b7fedf00 > [ 642.639362] Read of size 1 by task rcuos/5/53 > [ 642.639713] CPU: 7 PID: 53 Comm: rcuos/6 Not tainted 4.11.0-rc5+ #13 > [ 642.640170] Hard

Re: [PATCH v3 1/8] blk-mq: Register /queue/mq after having registered /queue

2017-04-21 Thread Bart Van Assche
On Fri, 2017-04-21 at 15:05 -0700, Omar Sandoval wrote: > On Tue, Apr 18, 2017 at 04:29:42PM -0700, Bart Van Assche wrote: > > +int blk_mq_register_dev(struct device *dev, struct request_queue *q) > > +{ > > + int ret; > > + > > + ret = mutex_lock_interrupti

[PATCH v4 07/10] blk-mq: Make blk_flags_show() callers append a newline character

2017-04-21 Thread Bart Van Assche
This patch does not change any functionality but makes it possible to produce a single line of output with multiple flag-to-name translations. Signed-off-by: Bart Van Assche Reviewed-by: Omar Sandoval Cc: Hannes Reinecke --- block/blk-mq-debugfs.c | 4 +++- 1 file changed, 3 insertions(+), 1

[PATCH v4 06/10] blk-mq: Move the "state" debugfs attribute one level down

2017-04-21 Thread Bart Van Assche
Move the "state" attribute from the top level to the "mq" directory as requested by Omar. Signed-off-by: Bart Van Assche Reviewed-by: Omar Sandoval Cc: Hannes Reinecke --- block/blk-mq-debugfs.c | 9 + 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/bl

[PATCH v4 04/10] blk-mq: Check blk_mq_debugfs_register() return value

2017-04-21 Thread Bart Van Assche
Make __blk_mq_register_dev() check the blk_mq_debugfs_register() return value. In the error path, only unregister hctxs for which registration succeeded. Signed-off-by: Bart Van Assche Cc: Omar Sandoval Cc: Hannes Reinecke --- block/blk-mq-sysfs.c | 23 +-- 1 file changed

[PATCH v4 00/10] blk-mq debugfs patches for kernel v4.12

2017-04-21 Thread Bart Van Assche
gt;cmd_flags ^ op" into "rq->cmd_flags & ~REQ_OP_MASK" as proposed by Omar. - A seq_file pointer is now passed to the new queue_rq callback function instead of a fixed-size char buffer. Bart Van Assche (10): blk-mq: Register /queue/mq after having registered /queue blk-mq: L

[PATCH v4 09/10] blk-mq: Add blk_mq_ops.show_rq()

2017-04-21 Thread Bart Van Assche
This new callback function will be used in the next patch to show more information about SCSI requests. Signed-off-by: Bart Van Assche Reviewed-by: Omar Sandoval Cc: Hannes Reinecke --- block/blk-mq-debugfs.c | 6 +- include/linux/blk-mq.h | 6 ++ 2 files changed, 11 insertions(+), 1

[PATCH v4 01/10] blk-mq: Register /queue/mq after having registered /queue

2017-04-21 Thread Bart Van Assche
ion with the queue sysfs_lock instead of the global mutex all_q_mutex. Signed-off-by: Bart Van Assche Cc: Omar Sandoval Cc: Hannes Reinecke --- block/blk-mq-sysfs.c | 35 --- block/blk-mq.h | 1 + block/blk-sysfs.c| 6 +++--- 3 files changed, 32 inserti

[PATCH v4 05/10] blk-mq: Unregister debugfs attributes earlier

2017-04-21 Thread Bart Van Assche
One of the debugfs attributes allows to run a queue. Since running a queue after a queue has entered the "dead" state is not allowed and even can cause a kernel crash, unregister the debugfs attributes before a queue reaches the "dead" state. Signed-off-by: Bart Van Assche C

[PATCH v4 10/10] scsi: Implement blk_mq_ops.show_rq()

2017-04-21 Thread Bart Van Assche
Show the SCSI CDB, .eh_eflags and .result for pending SCSI commands in /sys/kernel/debug/block/*/mq/*/dispatch and */rq_list. Signed-off-by: Bart Van Assche Cc: Martin K. Petersen Cc: James Bottomley Cc: Omar Sandoval Cc: Hannes Reinecke Cc: --- drivers/scsi/scsi_lib.c | 11 +++ 1

[PATCH v4 02/10] blk-mq: Let blk_mq_debugfs_register() look up the queue name

2017-04-21 Thread Bart Van Assche
A later patch will move the call of blk_mq_debugfs_register() to a function to which the queue name is not passed as an argument. To avoid having to add a 'name' argument to multiple callers, let blk_mq_debugfs_register() look up the queue name. Signed-off-by: Bart Van Assche Cc: Oma

[PATCH v4 03/10] blk-mq-debugfs: Rename functions for registering and unregistering the mq directory

2017-04-21 Thread Bart Van Assche
Since the blk_mq_debugfs_*register_hctxs() functions register and unregister all attributes under the "mq" directory, rename these into blk_mq_debugfs_*register_mq(). Signed-off-by: Bart Van Assche Cc: Omar Sandoval Cc: Hannes Reinecke --- block/blk-mq-debugfs.c | 8 bl

[PATCH v4 08/10] blk-mq: Show operation, cmd_flags and rq_flags names

2017-04-21 Thread Bart Van Assche
Show the operation name, .cmd_flags and .rq_flags as names instead of numbers. Signed-off-by: Bart Van Assche Reviewed-by: Omar Sandoval Cc: Hannes Reinecke --- block/blk-mq-debugfs.c | 72 +++--- 1 file changed, 69 insertions(+), 3 deletions

Re: [PATCH v4 04/10] blk-mq: Check blk_mq_debugfs_register() return value

2017-04-24 Thread Bart Van Assche
On Mon, 2017-04-24 at 09:49 -0700, Omar Sandoval wrote: > On Fri, Apr 21, 2017 at 04:40:20PM -0700, Bart Van Assche wrote: > > Make __blk_mq_register_dev() check the blk_mq_debugfs_register() > > return value. > > I intentionally didn't check this. In my opinion, a

Re: [PATCH v4 05/10] blk-mq: Unregister debugfs attributes earlier

2017-04-24 Thread Bart Van Assche
On Mon, 2017-04-24 at 09:55 -0700, Omar Sandoval wrote: > On Fri, Apr 21, 2017 at 04:40:21PM -0700, Bart Van Assche wrote: > > One of the debugfs attributes allows to run a queue. Since running > > a queue after a queue has entered the "dead" state is not allowed > &

Re: [PATCH v4 05/10] blk-mq: Unregister debugfs attributes earlier

2017-04-24 Thread Bart Van Assche
On Mon, 2017-04-24 at 10:17 -0700, Omar Sandoval wrote: > On Mon, Apr 24, 2017 at 05:12:05PM +0000, Bart Van Assche wrote: > > On Mon, 2017-04-24 at 09:55 -0700, Omar Sandoval wrote: > > > On Fri, Apr 21, 2017 at 04:40:21PM -0700, Bart Van Assche wrote: > > >

Re: [PATCH v4 05/10] blk-mq: Unregister debugfs attributes earlier

2017-04-24 Thread Bart Van Assche
On Mon, 2017-04-24 at 10:29 -0700, Omar Sandoval wrote: > On Mon, Apr 24, 2017 at 10:26:15AM -0700, Omar Sandoval wrote: > > On Mon, Apr 24, 2017 at 05:24:13PM +0000, Bart Van Assche wrote: > > > On Mon, 2017-04-24 at 10:17 -0700, Omar Sandoval wrote: > > > > On M

Re: [PATCH v4 10/10] scsi: Implement blk_mq_ops.show_rq()

2017-04-24 Thread Bart Van Assche
On Mon, 2017-04-24 at 17:35 -0400, Martin K. Petersen wrote: > > Show the SCSI CDB, .eh_eflags and .result for pending SCSI commands > > in /sys/kernel/debug/block/*/mq/*/dispatch and */rq_list. > > Why not use SCSI tracing if you are interested in these? Hello Martin, SCSI tracing has to be ena

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