[PATCH] block: nbd: fix double free

2017-04-27 Thread Ming Lei
Looks it is a typo, just fix it, otherwise the following warning can be trigerred: [ming@VM]$sudo rmmod nbd [sudo] password for ming: == BUG: KASAN: use-after-free in nbd_cleanup+0x115/0x18e [nbd] at addr 88024ca539b0 Read of

Re: [PATCH 4/6] blk-mq: don't bypass scheduler for reserved requests

2017-04-27 Thread Jens Axboe
On 04/27/2017 10:04 PM, Ming Lei wrote: > On Thu, Apr 27, 2017 at 04:51:32PM -0600, Jens Axboe wrote: >> Instead of bypassing the scheduler for insertion of reserved requests, >> we ensure that the request is marked as RQF_RESERVED so they driver >> knows where it came from. >> >> Usually we just

Re: [PATCH 6/6] Revert "mtip32xx: pass BLK_MQ_F_NO_SCHED"

2017-04-27 Thread Ming Lei
On Thu, Apr 27, 2017 at 04:51:34PM -0600, Jens Axboe wrote: > This reverts commit 4981d04dd8f1ab19e2cce008da556d7f099b6e68. > > The driver has been converted to using the proper infrastructure > for issuing internal commands. This means it's now safe to use with > the scheduling infrastruture, so

Re: [PATCH 4/6] blk-mq: don't bypass scheduler for reserved requests

2017-04-27 Thread Ming Lei
On Thu, Apr 27, 2017 at 04:51:32PM -0600, Jens Axboe wrote: > Instead of bypassing the scheduler for insertion of reserved requests, > we ensure that the request is marked as RQF_RESERVED so they driver > knows where it came from. > > Usually we just use the tag to know if it's reserved or not, >

Re: [PATCH 1/6] blk-mq: Make blk_mq_quiesce_queue() wait for all .queue_rq() calls

2017-04-27 Thread Ming Lei
Hi, On Fri, Apr 28, 2017 at 10:00:44AM +0800, Ming Lei wrote: > Hi Bart, > > On Thu, Apr 27, 2017 at 08:54:32AM -0700, Bart Van Assche wrote: > > blk_mq_quiesce_queue() callers, e.g. elevator_switch_mq(), assume > > that no .queue_rq() calls occur while switching to another I/O > > I think we

Re: [PATCH 2/6] blk-mq: Fix the comment above blk_mq_quiesce_queue()

2017-04-27 Thread Ming Lei
On Thu, Apr 27, 2017 at 08:54:33AM -0700, Bart Van Assche wrote: > The first version of blk_mq_quiesce_queue() that was posted on > the linux-block mailing list waited for ongoing .queue_rq() > calls but did not stop the request queue. The current version > however stops the request queue. Hence

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

2017-04-27 Thread Ming Lei
On Mon, Apr 10, 2017 at 09:54:54AM -0600, Jens Axboe wrote: > They serve the exact same purpose. Get rid of the non-delayed > work variant, and just run it without delay for the normal case. > > Signed-off-by: Jens Axboe > --- > block/blk-core.c | 2 +- > block/blk-mq.c

Re: [PATCH 1/6] blk-mq: Make blk_mq_quiesce_queue() wait for all .queue_rq() calls

2017-04-27 Thread Ming Lei
Hi Bart, On Thu, Apr 27, 2017 at 08:54:32AM -0700, Bart Van Assche wrote: > blk_mq_quiesce_queue() callers, e.g. elevator_switch_mq(), assume > that no .queue_rq() calls occur while switching to another I/O I think we should call blk_mq_freeze_queue_wait() instead of blk_quiesce_queue() in

Re: [PATCH 5/6] mtip32xx: convert internal command issue to block IO path

2017-04-27 Thread Jens Axboe
On 04/27/2017 05:29 PM, Bart Van Assche wrote: > On Thu, 2017-04-27 at 16:51 -0600, Jens Axboe wrote: >> @@ -1114,10 +1121,16 @@ static int mtip_exec_internal_command(struct >> mtip_port *port, >> u32 opts, >> unsigned long

Re: [PATCH 5/6] mtip32xx: convert internal command issue to block IO path

2017-04-27 Thread Bart Van Assche
On Thu, 2017-04-27 at 16:51 -0600, Jens Axboe wrote: > @@ -1114,10 +1121,16 @@ static int mtip_exec_internal_command(struct > mtip_port *port, > u32 opts, > unsigned long timeout) > { > - struct mtip_cmd_sg

Re: [PATCH 3/6] mtip32xx: abstract out "are any commands active" helper

2017-04-27 Thread Bart Van Assche
On Thu, 2017-04-27 at 16:51 -0600, Jens Axboe wrote: > This is a prep patch for backoff in ->queue_rq() for non-ncq commands. > > Signed-off-by: Jens Axboe > --- > drivers/block/mtip32xx/mtip32xx.c | 28 ++-- > 1 file changed, 18 insertions(+), 10

Re: [PATCH 2/6] mtip32xx: kill atomic argument to mtip_quiesce_io()

2017-04-27 Thread Bart Van Assche
On Thu, 2017-04-27 at 16:51 -0600, Jens Axboe wrote: > All callers now pass in GFP_KERNEL, get rid of the argument. Reviewed-by: Bart Van Assche

Re: [PATCH 1/6] mtip32xx: get rid of 'atomic' argument to mtip_exec_internal_command()

2017-04-27 Thread Bart Van Assche
On Thu, 2017-04-27 at 16:51 -0600, Jens Axboe wrote: > All callers can safely block. Kill the atomic/block argument, and > remove the argument from all callers. Reviewed-by: Bart Van Assche

Re: [PATCH] block: hide badblocks attribute by default

2017-04-27 Thread Verma, Vishal L
On Thu, 2017-04-27 at 14:46 -0700, Dan Williams wrote: > Commit 99e6608c9e74 "block: Add badblock management for gendisks" > allowed for drivers like pmem and software-raid to advertise a list of > bad media areas. However, it inadvertently added a 'badblocks' to all > block devices. Lets clean

Re: [PATCH 0/6] Fixup mtip32xx for scheduling

2017-04-27 Thread Jens Axboe
On 04/27/2017 04:51 PM, Jens Axboe wrote: > This attempts a cleaner solution, where we simply mark a request > as having come from the reserved pool. mtip32xx can then be > converted to using that info, and moving it's internal command > issue over to the regular block infrastructure. > > First

[PATCH 6/6] Revert "mtip32xx: pass BLK_MQ_F_NO_SCHED"

2017-04-27 Thread Jens Axboe
This reverts commit 4981d04dd8f1ab19e2cce008da556d7f099b6e68. The driver has been converted to using the proper infrastructure for issuing internal commands. This means it's now safe to use with the scheduling infrastruture, so we can now revert the change that turned off scheduling for mtip32xx.

[PATCH 2/6] mtip32xx: kill atomic argument to mtip_quiesce_io()

2017-04-27 Thread Jens Axboe
All callers now pass in GFP_KERNEL, get rid of the argument. Signed-off-by: Jens Axboe --- drivers/block/mtip32xx/mtip32xx.c | 20 +--- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/drivers/block/mtip32xx/mtip32xx.c

[PATCH 0/6] Fixup mtip32xx for scheduling

2017-04-27 Thread Jens Axboe
This attempts a cleaner solution, where we simply mark a request as having come from the reserved pool. mtip32xx can then be converted to using that info, and moving it's internal command issue over to the regular block infrastructure. First three are prep/cleanup patches for mtip32xx, which an

[PATCH 5/6] mtip32xx: convert internal command issue to block IO path

2017-04-27 Thread Jens Axboe
The driver special cases certain things for command issue, depending on whether it's an internal command or not. Make the internal commands use the regular infrastructure for issuing IO. Since this is an 8-group souped up AHCI variant, we have to deal with NCQ vs non-queueable commands. Do this

[PATCH 1/6] mtip32xx: get rid of 'atomic' argument to mtip_exec_internal_command()

2017-04-27 Thread Jens Axboe
All callers can safely block. Kill the atomic/block argument, and remove the argument from all callers. Signed-off-by: Jens Axboe --- drivers/block/mtip32xx/mtip32xx.c | 148 +++--- 1 file changed, 43 insertions(+), 105 deletions(-) diff --git

Re: [PATCH 3/6] blk-mq-debugfs: Show atomic request flags

2017-04-27 Thread Omar Sandoval
On Thu, Apr 27, 2017 at 08:54:34AM -0700, Bart Van Assche wrote: > When analyzing e.g. queue lockups it is important to know whether > or not a request has already been started. Hence also show the > atomic request flags. Reviewed-by: Omar Sandoval > Signed-off-by: Bart Van

Re: [PATCH 2/6] blk-mq: Fix the comment above blk_mq_quiesce_queue()

2017-04-27 Thread Omar Sandoval
On Thu, Apr 27, 2017 at 08:54:33AM -0700, Bart Van Assche wrote: > The first version of blk_mq_quiesce_queue() that was posted on > the linux-block mailing list waited for ongoing .queue_rq() > calls but did not stop the request queue. The current version > however stops the request queue. Hence

[PATCH] block: hide badblocks attribute by default

2017-04-27 Thread Dan Williams
Commit 99e6608c9e74 "block: Add badblock management for gendisks" allowed for drivers like pmem and software-raid to advertise a list of bad media areas. However, it inadvertently added a 'badblocks' to all block devices. Lets clean this up by having the 'badblocks' attribute not be visible when

[PATCH 4/5] nvme-fc: merge init_request methods

2017-04-27 Thread Christoph Hellwig
Now that we get the tagset passed we can have a single implementation for the I/O and admin queues. Signed-off-by: Christoph Hellwig --- drivers/nvme/host/fc.c | 16 +++- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/drivers/nvme/host/fc.c

[PATCH 2/5] nvme-pci: merge init_request methods

2017-04-27 Thread Christoph Hellwig
Now that we get the tagset passed we can have a single implementation for the I/O and admin queues. Signed-off-by: Christoph Hellwig --- drivers/nvme/host/pci.c | 18 +++--- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/drivers/nvme/host/pci.c

[PATCH 3/5] nvme-rdma: merge init_request and exit_request methods

2017-04-27 Thread Christoph Hellwig
Now that we get the tagset passed we can have a single implementation for the I/O and admin queues. Signed-off-by: Christoph Hellwig --- drivers/nvme/host/rdma.c | 43 +++ 1 file changed, 11 insertions(+), 32 deletions(-) diff --git

update ->init_request and ->exit_request prototypes

2017-04-27 Thread Christoph Hellwig
Hi Jens, this series (against for-4.12/post-merge) updates the blk-mq ->init_request and ->exit request methods to drop a now harmful parameter, and update one to pass a little more information. It then cleans up the nvme drivers based on that.

[PATCH 1/5] blk-mq: update ->init_request and ->exit_request prototypes

2017-04-27 Thread Christoph Hellwig
Remove the request_idx parameter, which can't be used safely now that we support I/O schedulers with blk-mq. Except for a superflous check in mtip32xx it was unused anyway. Also pass the tag_set instead of just the driver data - this allows drivers to avoid some code duplication in a follow on

[PATCH 0/6] Six more patches for Linux kernel v4.12

2017-04-27 Thread Bart Van Assche
Hello Jens, Since the merge window will open soon, do you still accept patches for Linux kernel v4.12? If so, please consider the six patches in this series. This series contains one bug fix, one comment fix and four patches that extend the blk-mq-debugfs functionality further. Thanks, Bart.

[PATCH 2/6] blk-mq: Fix the comment above blk_mq_quiesce_queue()

2017-04-27 Thread Bart Van Assche
The first version of blk_mq_quiesce_queue() that was posted on the linux-block mailing list waited for ongoing .queue_rq() calls but did not stop the request queue. The current version however stops the request queue. Hence reflect this behavior in the comment above that function. Signed-off-by:

[PATCH 6/6] blk-mq-debugfs: Add 'kick' operation

2017-04-27 Thread Bart Van Assche
Running a queue causes the block layer to examine the per-CPU and hw queues but not the requeue list. Hence add a 'kick' operation that also examines the requeue list. Signed-off-by: Bart Van Assche Cc: Omar Sandoval Cc: Hannes Reinecke

[PATCH 3/6] blk-mq-debugfs: Show atomic request flags

2017-04-27 Thread Bart Van Assche
When analyzing e.g. queue lockups it is important to know whether or not a request has already been started. Hence also show the atomic request flags. Signed-off-by: Bart Van Assche Cc: Omar Sandoval Cc: Hannes Reinecke ---

[PATCH 5/6] blk-mq-debugfs: Show busy requests

2017-04-27 Thread Bart Van Assche
Requests that got stuck in a block driver are neither on blk_mq_ctx.rq_list nor on any hw dispatch queue. Make these visible in debugfs through the "busy" attribute. Signed-off-by: Bart Van Assche Cc: Omar Sandoval Cc: Hannes Reinecke

[PATCH 4/6] blk-mq-debugfs: Show requeue list

2017-04-27 Thread Bart Van Assche
When verifying whether or not a blk-mq driver forgot to kick the requeue list after having requeued a request it is important to be able to verify the contents of the requeue list. Hence export that list through debugfs. Signed-off-by: Bart Van Assche Cc: Omar

[PATCH 1/6] blk-mq: Make blk_mq_quiesce_queue() wait for all .queue_rq() calls

2017-04-27 Thread Bart Van Assche
blk_mq_quiesce_queue() callers, e.g. elevator_switch_mq(), assume that no .queue_rq() calls occur while switching to another I/O scheduler. This patch fixes the following kernel crash if another I/O scheduler than "none" is the default scheduler: general protection fault: [#1] SMP RIP:

Re: [PATCH 0/4] blk-mq-sched: allow to use hw tag for sched

2017-04-27 Thread Jens Axboe
On 04/27/2017 09:20 AM, Christoph Hellwig wrote: > On Thu, Apr 27, 2017 at 06:49:43AM -0700, Jens Axboe wrote: >> Thanks Ming, I've added that patch and your patch to initialize the cmd >> at runtime. > > I really think this is the wrong fix, and doing these sort of band-aids > just will lead to

Re: [PATCH 0/4] blk-mq-sched: allow to use hw tag for sched

2017-04-27 Thread Christoph Hellwig
On Thu, Apr 27, 2017 at 06:49:43AM -0700, Jens Axboe wrote: > Thanks Ming, I've added that patch and your patch to initialize the cmd > at runtime. I really think this is the wrong fix, and doing these sort of band-aids just will lead to further problems done the road.

Re: [PATCH 0/4] blk-mq-sched: allow to use hw tag for sched

2017-04-27 Thread Jens Axboe
On 04/26/2017 08:14 PM, Ming Lei wrote: > On Wed, Apr 26, 2017 at 11:22:43AM -0700, Jens Axboe wrote: >> On 04/26/2017 11:15 AM, Jens Axboe wrote: >>> On 04/26/2017 03:48 AM, Ming Lei wrote: Hi Christoph, On Thu, Apr 20, 2017 at 04:30:42PM +0800, Ming Lei wrote: > Hi Christoph,

block: mempool allocation hangs under OOM. (Re: A pitfall of mempool?)

2017-04-27 Thread Tetsuo Handa
g memory for more than 12 minutes, and thus unable to unblock mempool_alloc(), and thus silent hang up). Complete log is at http://I-love.SAKURA.ne.jp/tmp/serial-20170427.txt.xz . -- [0.00] Linux version 4.11.0-rc8-next-20170426+ (root@localhost.localdomain) (gcc version 6.2.1 20160916

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

2017-04-27 Thread Hannes Reinecke
On 04/26/2017 10:47 PM, Bart Van Assche wrote: > Show the SCSI CDB for pending SCSI commands in > /sys/kernel/debug/block/*/mq/*/dispatch and */rq_list. An example > of how SCSI commands are displayed by this code: > > 8801703245c0 {.op=READ, .cmd_flags=META PRIO, .rq_flags=DONTPREP IO_STAT

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

2017-04-27 Thread Hannes Reinecke
On 04/26/2017 10:47 PM, Bart Van Assche wrote: > 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

Re: small dm mpath cleanups

2017-04-27 Thread h...@lst.de
On Wed, Apr 26, 2017 at 06:41:27PM +, Bart Van Assche wrote: > On Wed, 2017-04-26 at 09:40 +0200, Christoph Hellwig wrote: > > this series has some prep patches for my work to have proper, type > > checked block errors codes. One fallout of that is that we need to > > get rid of how dm

Re: [PATCH 0/4] blk-mq-sched: allow to use hw tag for sched

2017-04-27 Thread Christoph Hellwig
On Wed, Apr 26, 2017 at 06:48:43PM +0800, Ming Lei wrote: > Looks there are some choices for this issue: > > 1) if internal ops uses independent tag space > - we need to clean up the mtip32xx driver > > 2) if internal ops shares tag space with normal request > - export blk_mq_get_driver_tag()

Re: [RFC PATCH] x86, uaccess, pmem: introduce copy_from_iter_writethru for dax + pmem

2017-04-27 Thread Ingo Molnar
* Dan Williams wrote: > +#ifdef CONFIG_ARCH_HAS_UACCESS_WRITETHRU > +#define __HAVE_ARCH_MEMCPY_WRITETHRU 1 > +void memcpy_writethru(void *dst, const void *src, size_t cnt); > +#endif This should be named memcpy_wt(), which is the well-known postfix for