[PATCH V2 2/4] blk-mq: change gfp flags to GFP_NOIO in blk_mq_realloc_hw_ctxs

2018-10-12 Thread Jianchao Wang
blk_mq_realloc_hw_ctxs could be invoked during update hw queues. At the momemt, IO is blocked. Change the gfp flags from GFP_KERNEL to GFP_NOIO to avoid forever hang during memory allocation in blk_mq_realloc_hw_ctxs. Signed-off-by: Jianchao Wang --- block/blk-core.c | 2 +- block/blk-flush.c

[PATCH V2 4/4] blk-mq: fallback to previous nr_hw_queues when updating fails

2018-10-12 Thread Jianchao Wang
irq affinity to map hw and cpu, fallback nr_hw_queues will cause lack of some cpu's map to hw, so use default blk_mq_map_queues to do that. Reported-by: syzbot+83e8cbe702263932d...@syzkaller.appspotmail.com Signed-off-by: Jianchao Wang --- block/blk-mq.c | 27 --- 1 file chan

[PATCH V2 0/2] blk-mq: some fixes about updating hw queues

2018-10-12 Thread Jianchao Wang
leak mapping of some cpus due the fallback nr_hw_queues. - Add Ming's Reviewed-by in 1st patch. Jianchao Wang[4] blk-mq: adjust debugfs and sysfs register when blk-mq: change gfp flags to GFP_NOIO in blk-mq: realloc hctx when hw queue is mapped to blk-mq: fallback to previous nr_hw_queues when

[PATCH] scsi: qla2xxx: reduce time granularity of qla2x00_eh_wait_on_command

2018-09-10 Thread Jianchao Wang
recovery works. Change the granularity to 1ms, even though more context switches would be introduced, but it should be ok as it is not hot path. Signed-off-by: Jianchao Wang --- drivers/scsi/qla2xxx/qla_os.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/qla2xxx

[PATCH V2] nvme-pci: move nvme_kill_queues to nvme_remove_dead_ctrl

2018-06-19 Thread Jianchao Wang
emove do nothing -> blk_cleanup_queue -> blk_freeze_queue Finally, the request_queue is quiesced state when wait freeze, we will get io hang here. To fix it, move the nvme_kill_queues from nvme_remove_dead_ctrl_work to nvme_remove_dead_ctrl. Suggested-by: Keith Busch S

[PATCH] nvme-pci: not invoke nvme_remove_dead_ctrl when change state fails

2018-06-19 Thread Jianchao Wang
state in nvme_reset_work, the only reason is someone has changed state to DELETING. So it is not necessary to invoke nvme_remove_dead_ctrl in that case. Signed-off-by: Jianchao Wang --- drivers/nvme/host/pci.c | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/d

[PATCH 1/2] nvme-pci: set nvmeq->cq_vector after alloc cq/sq

2018-05-24 Thread Jianchao Wang
to fix this. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/pci.c | 25 - 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 17a0190..70b79f2 100644 --- a/drivers/nvm

[PATCH 2/2] nvme-pci: don't send delete cq command when allocate sq return -EINTR

2018-05-24 Thread Jianchao Wang
. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/pci.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 70b79f2..4ce1c89 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host

[PATCH] scsi: qla2xxx: reduce the time granularity of the qla2x00_eh_wait_on_command

2018-05-24 Thread Jianchao Wang
, ocfs2 heartbeat, etc, just before scsi recovery work completes and get back the HBA. Change the granularity to 1ms, even though more context switches would be introduced, but it should be ok as it is not hot path. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/scsi/q

[PATCH V3] nvme-rdma: stop queue first before free it in config admin queue

2018-05-23 Thread Jianchao Wang
x24/0x30 To fix it, call nvme_rdma_stop_queue for all the failed cases after nvme_rdma_start_queue. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> Suggested-by: Sagi Grimberg <s...@grimberg.me> Reviewed-by: Max Gurtovoy <m...@mellanox.com> --- V3: add Suggested-by Sagi

[PATCH V2 1/2] blk-mq: abstract out blk-mq-sched rq list iteration bio merge helper

2018-05-23 Thread Jianchao Wang
From: Jens Axboe No functional changes in this patch, just a prep patch for utilizing this in an IO scheduler. Signed-off-by: Jens Axboe --- block/blk-mq-sched.c | 34 -- include/linux/blk-mq.h | 3 ++- 2 files changed, 26

[PATCH V2 0/2] block: kyber: make kyber more friendly with merging

2018-05-23 Thread Jianchao Wang
. - allocate kcqs per khd Jens Axboe (1) 0001-blk-mq-abstract-out-blk-mq-sched-rq-list-iteration-b.patch Jianchao Wang (1) 0002-block-kyber-make-kyber-more-friendly-with-merging.patch block/blk-mq-sched.c | 34 ++--- block/kyber-iosched.c | 197

[PATCH V2 2/2] block: kyber: make kyber more friendly with merging

2018-05-23 Thread Jianchao Wang
each 1662MB/s and 425k on my platform. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> Tested-by: Holger Hoffstätte <hol...@applied-asynchrony.com> --- block/kyber-iosched.c | 197 +- 1 file changed, 162 insertions(+), 35 deletion

[PATCH] block: kyber: make kyber more friendly with merging

2018-05-22 Thread Jianchao Wang
0/0 | +--+ | w/ | 1083/616 | 277k/154k | 4.93/6.95 | 1830.62/3279.95 | 223k/3k | +--+ When set numjobs to 16, the bw and iops could reach 1662MB/s and 425k on my platform. Signed-off-by: Jianchao Wang <jianchao.w.w...@ora

[PATCH] blk-mq: add plug trace event for multiple hw queues case

2018-05-22 Thread Jianchao Wang
There is no plug trace event for multiple hw queues. This is confusing when check block trace event log and find unplug one there. Add plug trace event when request is added to a empty plug list. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- block/blk-mq.c | 3 +++ 1 file c

[PATCH] md: zero the original position of sb for 0.90 and 1.0

2018-05-16 Thread Jianchao Wang
. applications have to take some workarounds such as sync_min/max to avoid resync. It is easy and convevient for md to zero the older sb position after write sb to new position, so do it here. Cc: robert.but...@oracle.com Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/md/md.

[PATCH V2] nvme-rdma: stop queue first before free it in config admin queue

2018-05-10 Thread Jianchao Wang
x24/0x30 To fix it, call nvme_rdma_stop_queue for all the failed cases after nvme_rdma_start_queue. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- V2: based on Sagi's suggestion, add out_stop_queue lable and invoke nvme_rdma_stop_queue in all the failed ca

[PATCH V2] nvme-rdma: fix double free in nvme_rdma_free_queue

2018-05-10 Thread Jianchao Wang
ctrl_work -> nvme_rdma_shutdown_ctrl ->nvme_rdma_destroy_admin_queue -> nvme_rdma_free_queue Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- V2: handle it in nvme_rdma_free_queue and add some comment to explain it. drivers/nvme/host/rdma.c | 15 --- 1 file changed, 12 in

[PATCH V2] nvme-rdma: stop queue first before free it in config admin queue

2018-05-10 Thread Jianchao Wang
x24/0x30 To fix it, call nvme_rdma_stop_queue for all the failed cases after nvme_rdma_start_queue. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/rdma.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/nvme/host/rdma.c

[PATCH] nvme-rdma: clear NVME_RDMA_Q_LIVE before free the queue

2018-05-04 Thread Jianchao Wang
x30 To fix it, clear the NVME_RDMA_Q_LIVE before free the ctrl->queues[0]. The queue will be freed, so it certainly is not LIVE any more. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/rdma.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/nvme

[PATCH] nvme: fix use-after-free in nvme_free_ns_head

2018-05-04 Thread Jianchao Wang
/0x380 task_work_run+0xaf/0xe0 do_exit+0x501/0x1440 do_group_exit+0x89/0x140 __x64_sys_exit_group+0x28/0x30 do_syscall_64+0x72/0x230 Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/core.c | 5 + 1 file changed, 5 insertions(+) diff --git a/driver

[PATCH] nvme-rdma: fix double free in nvme_rdma_free_queue

2018-05-04 Thread Jianchao Wang
down_ctrl ->nvme_rdma_destroy_admin_queue -> nvme_rdma_free_queue Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/rdma.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c index a0ead1d..fd965d0 100644 --- a/drivers/n

[PATCH] IB/rxe: add RXE_START_MASK for rxe_opcode IB_OPCODE_RC_SEND_ONLY_INV

2018-04-25 Thread Jianchao Wang
with last_psn 0 is still there. This causes large amount of io timeout when nvmeof is over rxe. Add RXE_START_MASK for IB_OPCODE_RC_SEND_ONLY_INV to fix this. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/infiniband/sw/rxe/rxe_opcode.c | 2 +- 1 file changed, 1 ins

[PATCH] nvme: unquiesce the queue before cleaup it

2018-04-19 Thread Jianchao Wang
t_queue directly before nvme_ns_remove. We have spliced the ctrl->namespaces, so nobody could access them and quiesce the queue any more. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/core.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) d

[PATCH] nvme: fix the suspicious RCU usage warning in nvme_mpath_clear_current_path

2018-04-18 Thread Jianchao Wang
With lockdep enabled, when trigger nvme_remove, suspicious RCU usage warning will be printed out. Fix it with adding srcu_read_lock/unlock in it. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/nvme.h | 9 +++-- 1 file changed, 7 insertions(+), 2 del

[PATCH] blk-mq: start request gstate with gen 1

2018-04-16 Thread Jianchao Wang
. Cc: Bart Van Assche <bart.vanass...@wdc.com> Cc: Tejun Heo <t...@kernel.org> Cc: Ming Lei <ming@redhat.com> Cc: Martin Steigerwald <mar...@lichtvoll.de> Cc: sta...@vger.kernel.org Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- block/blk-core.c |

[PATCH] blk-mq: start request gstate with gen 1

2018-04-16 Thread Jianchao Wang
. Cc: Bart Van Assche <bart.vanass...@wdc.com> Cc: Tejun Heo <t...@kernel.org> Cc: Ming Lei <ming@redhat.com> Cc: Martin Steigerwald <mar...@lichtvoll.de> Cc: sta...@vger.kernel.org Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- block/blk-core.c |

[PATCH] blk-mq: mark hctx RESTART when get budget fails

2018-04-16 Thread Jianchao Wang
When get budget fails, blk_mq_sched_dispatch_requests does not do anything to ensure the hctx to be restarted. We can survive from this, because only the scsi implements .get_budget and it always runs the hctx queues when request is completed. Signed-off-by: Jianchao Wang <jianchao.

[PATCH] scsi: qla2xxx: reduce the time granularity of qla2x00_eh_wait_on_command

2018-04-10 Thread Jianchao Wang
recovery works. Change the granularity to 1ms, even though more context switches would be introduced, but it should be ok as it is not hot path. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/scsi/qla2xxx/qla_os.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

[PATCH] blk-throttle: only update last_low_overflow_time when LIMIT_MAX

2018-04-09 Thread Jianchao Wang
not update last_low_overflow_time at the moment. Otherwise, it will be hard to upgrade limit_index when there is always bios to be submitted. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- block/blk-throttle.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff

[PATCH] blk-throttle: discard stale last_low_overflow_time

2018-04-09 Thread Jianchao Wang
bps/iops are indeed lower than low limit, return 0 as the last_low_overflow_time which indicates it is stale. We will discard the stale last_low_overflow_time, but if both types are stale, return 0, Otherwise, the cgroups which don't have any traffic will prevent upgrade. Signed-off-by: Jianchao

[PATCH V3] nvme-pci: assign separate irq vectors for adminq and ioq1

2018-03-13 Thread Jianchao Wang
the first one to adminq which will have affinity cpumask with all possible cpus. On the other hand, if controller has only legacy or single -message MSI, we will setup adminq and 1 ioq and let them share the only one irq vector. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> ---

[PATCH V4 1/5] nvme: do atomically bit operations on nvme_request.flags

2018-03-07 Thread Jianchao Wang
Do atomically bit operations on nvme_request.flags instead of regular read/write, then we could add other flags and set/clear them safely. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/core.c | 4 ++-- drivers/nvme/host/lightnvm.c | 4 ++-- drivers/nvm

[PATCH V4 4/5] nvme-pci: discard wait timeout when delete cq/sq

2018-03-07 Thread Jianchao Wang
in parallel. Use wait_for_completion instead of the timeout one here. The timeout path is reliable now and will complete the request to wakeup it. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/pci.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff

PATCH V4 0/5 nvme-pci: fixes on nvme_timeout and nvme_dev_disable

2018-03-07 Thread Jianchao Wang
in nvme core. 3rd patch is to avoid the nvme_dev_disable in nvme_timeout, it introduce new interface nvme_pci_disable_ctrl_directly and refactor the nvme_timeout 4th~5th is to fix issues introduced after 3rd patch. Jianchao Wang (5) 0001-nvme-do-atomically-bit-operations-on-nvme_request.fl.patch 0

[PATCH V4 3/5] nvme-pci: avoid nvme_dev_disable to be invoked in nvme_timeout

2018-03-07 Thread Jianchao Wang
for this, it doesn't send commands on adminq and the shutdown_lock is not needed here, because the nvme_abort_requests_sync in nvme_dev_disable could synchronize with nvme_timeout. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/pci.c

[PATCH V4 5/5] nvme-pci: add the timeout case for DELETEING state

2018-03-07 Thread Jianchao Wang
will hang forever. Add case for DELETEING in nvme_timeout, when abort fails, disable the controller and complete the request directly. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/pci.c | 27 +++ 1 file changed, 23 insertions(+), 4 del

[PATCH V4 2/5] nvme: add helper interface to flush in-flight requests

2018-03-07 Thread Jianchao Wang
completes. More details please refer to the comment of this interface. - nvme_flush_aborted_requests complete the requests 'aborted' by nvme_abort_requests_sync. It will be invoked after the controller is disabled/shutdown. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- driver

[PATCH] scsi: iscsi_tcp: set BDI_CAP_STABLE_WRITES when data digest enabled

2018-03-07 Thread Jianchao Wang
is enabled in iscsi_tcp .slave_configure callback. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/scsi/iscsi_tcp.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index 6198559..261c686 100644 --- a/driver

[PATCH V4] scsi: core: use blk_mq_requeue_request in __scsi_queue_insert

2018-03-02 Thread Jianchao Wang
with kick_requeue_list == true and put the reference of scsi_device. Cc: Christoph Hellwig <h...@lst.de> Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> Reviewed-by: Bart Van Assche <bart.vanass...@wdc.com> --- Changelog: V3 -> V4: - modify the comment and make it more clea

[PATCH V3] scsi: core: use blk_mq_requeue_request in __scsi_queue_insert

2018-03-01 Thread Jianchao Wang
with kick_requeue_list == true and put the reference of scsi_device. Cc: Christoph Hellwig <h...@lst.de> Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> Reviewed-by: Bart Van Assche <bart.vanass...@wdc.com> --- Changelog: V2 -> V3: - add commit to explain why

[PATCH V2] nvme-pci: assign separate irq vectors for adminq and ioq0

2018-02-28 Thread Jianchao Wang
add new helper interface nvme_ioq_vector to get ioq vector. V1->V2 - add case to handle the scenario where there is only one irq vector - add nvme_ioq_vector to map ioq vector and qid Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/p

[PATCH V2] scsi: core: use blk_mq_requeue_request in __scsi_queue_insert

2018-02-28 Thread Jianchao Wang
with kick_requeue_list == true and put the reference of scsi_device. V1 -> V2: - add put_device on scsi_device->sdev_gendev Cc: Christoph Hellwig <h...@lst.de> Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/scsi/scsi_lib.c | 3 ++- 1 file changed, 2 inserti

[PATCH] nvme-pci: assign separate irq vectors for adminq and ioq0

2018-02-27 Thread Jianchao Wang
vectors for adminq and ioq0, and not set irq affinity for adminq one. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/pci.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 7

[PATCH] scsi: core: fix two wrong indentation cases

2018-02-25 Thread Jianchao Wang
No functional changes. Just fix two wrong indentation cases in scsi_finish_command and scsi_decide_disposition. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/scsi/scsi.c | 2 +- drivers/scsi/scsi_error.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)

[PATCH] scsi: core: use blk_mq_requeue_request in __scsi_queue_insert

2018-02-25 Thread Jianchao Wang
with kick_requeue_list == true. Cc: Christoph Hellwig <h...@lst.de> Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/scsi/scsi_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index a86d

[PATCH V2] nvme-pci: set cq_vector to -1 if io queue setup fails

2018-02-15 Thread Jianchao Wang
st set cq_vector to -1 if io queue setup fails. - Change patch name and comment Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/pci.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host

[PATCH RESENT] nvme-pci: suspend queues based on online_queues

2018-02-12 Thread Jianchao Wang
. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/pci.c | 41 ++--- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 6e5d2ca..9b3cc2c 100644 --- a/drivers/nvm

[PATCH 5/8] nvme-pci: suspend queues based on online_queues

2018-02-12 Thread Jianchao Wang
. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/pci.c | 41 ++--- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 0cba8d8..2106681 100644 --- a/drivers/nvm

[PATCH 1/3] nvme: fix the dangerous reference of namespaces list

2018-02-12 Thread Jianchao Wang
nvme_remove_namespaces and nvme_remove_invalid_namespaces reference the ctrl->namespaces list w/o holding namespaces_mutext. It is ok to invoke nvme_ns_remove there, but what if there is others. To be safer, reference the ctrl->namespaces list under namespaces_mutext. Signed-off-by: Ji

[PATCH] nvme-pci: drain the entered requests after ctrl is shutdown

2018-02-12 Thread Jianchao Wang
Currently, we will unquiesce the queues after the controller is shutdown to avoid residual requests to be stuck. In fact, we can do it more cleanly, just wait freeze and drain the queue in nvme_dev_disable and finally leave the queues quiesced. Signed-off-by: Jianchao Wang <jianchao.

[PATCH] nvme-pci: quiesce IO queues prior to disabling device HMB accesses

2018-02-12 Thread Jianchao Wang
Quiesce IO queues prior to disabling device HMB accesses. A controller using HMB may relay on it to efficiently complete IO commands. Reviewed-by: Keith Busch <keith.bu...@intel.com> Reviewed-by: Sagi Grimberg <s...@grimberg.me> Signed-off-by: Jianchao Wang <jianchao.w.

[PATCH 2/3] nvme: fix the deadlock in nvme_update_formats

2018-02-12 Thread Jianchao Wang
. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/core.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index d05855b..a051c2f 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvm

[PATCH 3/3] nvme: change namespaces_mutext to namespaces_rwsem

2018-02-12 Thread Jianchao Wang
, circular dependency could be introduced easily. For example: context A context B nvme_xxx nvme_xxx hold namespaces_mutext require namespaces_mutext sync context B So it is better to change it from mutex to rwsem. Signed-off-by: Jianchao Wang <jianchao.

[PATCH 5/9] nvme-pci: suspend queues based on online_queues

2018-02-11 Thread Jianchao Wang
. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/pci.c | 41 ++--- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 00cffed..c5c1365 100644 --- a/drivers/nvm

[PATCH 3/9] nvme: change namespaces_mutext to namespaces_rwsem

2018-02-11 Thread Jianchao Wang
namespaces_mutext is used to synchronize the operations on ctrl namespaces list. Most of the time, it is a read operation. It is better to change it from mutex to rwsem. On the other hand, the namespaces mutex could introduce circular dependency easily. Signed-off-by: Jianchao Wang <jianchao.

[PATCH V3 0/6]nvme-pci: fixes on nvme_timeout and nvme_dev_disable

2018-02-11 Thread Jianchao Wang
It let nvme_delete_io_queues can only be wakeup by completion path. This patchset was tested under debug patch for some days. And some bugfix have been done. The patches are available in following it branch: https://github.com/jianchwa/linux-blcok.git nvme_fixes_V3_plus_rwsem Jianchao Wang (9) 0001-nv

[PATCH 9/9] nvme-pci: discard wait timeout when delete cq/sq

2018-02-11 Thread Jianchao Wang
to nvme_dev_disable, then handle the outstanding requests. This will race with the request timeout path. To fix it, just use wait_for_completion instead of the timeout one. The request timeout path will wakeup it. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/pci

[PATCH 2/9] nvme: fix the deadlock in nvme_update_formats

2018-02-11 Thread Jianchao Wang
. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/core.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index bc05bc4..7425124 100644 --- a/drivers/nvme/host/core.c +++ b/driver

[PATCH 7/9] blk-mq: make blk_mq_rq_update_aborted_gstate a external interface

2018-02-11 Thread Jianchao Wang
No functional change, just make blk_mq_rq_update_aborted_gstate a external interface. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- block/blk-mq.c | 3 ++- include/linux/blk-mq.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/block/blk-mq.c b

[PATCH 4/9] nvme-pci: quiesce IO queues prior to disabling device HMB accesses

2018-02-11 Thread Jianchao Wang
Quiesce IO queues prior to disabling device HMB accesses. A controller using HMB may relay on it to efficiently complete IO commands. Reviewed-by: Keith Busch <keith.bu...@intel.com> Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/pci.c | 8 +++-

[PATCH 1/9] nvme: fix the dangerous reference of namespaces list

2018-02-11 Thread Jianchao Wang
nvme_remove_namespaces and nvme_remove_invalid_namespaces reference the ctrl->namespaces list w/o holding namespaces_mutext. It is ok to invoke nvme_ns_remove there, but what if there is others. To be safer, reference the ctrl->namespaces list under namespaces_mutext. Signed-off-by: Ji

[PATCH 8/9] nvme-pci: break up nvme_timeout and nvme_dev_disable

2018-02-11 Thread Jianchao Wang
state, fail them and kill the controller) Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/pci.c | 192 +++- 1 file changed, 157 insertions(+), 35 deletions(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host

[PATCH 6/9] nvme-pci: drain the entered requests after ctrl is shutdown

2018-02-11 Thread Jianchao Wang
Currently, we will unquiesce the queues after the controller is shutdown to avoid residual requests to be stuck. In fact, we can do it more cleanly, just wait freeze and drain them before nvme_dev_disable return. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvm

[PATCH V2 1/6] nvme-pci: quiesce IO queues prior to disabling device HMB accesses

2018-02-05 Thread Jianchao Wang
Quiesce IO queues prior to disabling device HMB accesses. A controller using HMB may relay on it to efficiently complete IO commands. Reviewed-by: Keith Busch <keith.bu...@intel.com> Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/pci.c | 8 +++-

[PATCH V2 4/6] nvme-pci: suspend queues based on online_queues

2018-02-05 Thread Jianchao Wang
. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/pci.c | 30 +++--- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index a7fa397..117b837 100644 --- a/drivers/nvme/host/pci.c

[PATCH V2 3/6] blk-mq: make blk_mq_rq_update_aborted_gstate a external interface

2018-02-05 Thread Jianchao Wang
No functional change, just make blk_mq_rq_update_aborted_gstate a external interface. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- block/blk-mq.c | 3 ++- include/linux/blk-mq.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/block/blk-mq.c b

[PATCH V2 5/6] nvme-pci: break up nvme_timeout and nvme_dev_disable

2018-02-05 Thread Jianchao Wang
and return BLK_EH_HANDLED. nvme_dev_disable/nvme_reset_work will see the error. With this patch, we could avoid nvme_dev_disable to be invoked by nvme_timeout and implementat synchronization between them. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/pci.c

[PATCH V2 6/6] nvme-pci: discard wait timeout when delete cq/sq

2018-02-05 Thread Jianchao Wang
to nvme_dev_disable, then handle the outstanding requests. This will race with the request timeout path. To fix it, just use wait_for_completion instead of the timeout one. The request timeout path will wakeup it. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/pci

[PATCH V2 0/6]nvme-pci: fixes on nvme_timeout and nvme_dev_disable

2018-02-05 Thread Jianchao Wang
one. The patches are available in following it branch: https://github.com/jianchwa/linux-blcok.git nvme_fixes_V2 Jianchao Wang (6) 0001-nvme-pci-quiesce-IO-queues-prior-to-disabling-device.patch 0002-nvme-pci-fix-the-freeze-and-quiesce-for-shutdown-and.patch 0003-blk-mq-make-blk_mq_rq_update_aborted_gst

[PATCH V2 2/6] nvme-pci: fix the freeze and quiesce for shutdown and reset case

2018-02-05 Thread Jianchao Wang
controller has been shutdown. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/pci.c | 36 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 00cffed..a7fa397

[PATCH 5/6] nvme-pci: discard wait timeout when delete cq/sq

2018-02-01 Thread Jianchao Wang
to nvme_dev_disable, then handle the outstanding requests. This will race with the request timeout path. To fix it, just use wait_for_completion instead of the timeout one. The request timeout path will wakeup it. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/pci

[PATCH 3/6] blk-mq: make blk_mq_rq_update_aborted_gstate a external interface

2018-02-01 Thread Jianchao Wang
No functional change, just make blk_mq_rq_update_aborted_gstate a external interface. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- block/blk-mq.c | 3 ++- include/linux/blk-mq.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/block/blk-mq.c b

[PATCH 1/6] nvme-pci: move clearing host mem behind stopping queues

2018-02-01 Thread Jianchao Wang
Move clearing host mem behind stopping queues. Prepare for following patch which will grab all the outstanding requests. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/pci.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/driver

[PATCH 4/6] nvme-pci: break up nvme_timeout and nvme_dev_disable

2018-02-01 Thread Jianchao Wang
. With this patch, we could avoid nvme_dev_disable to be invoked by nvme_timeout and eliminate the race between nvme_timeout and nvme_dev_disable on outstanding requests. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/pci.c | 146 -

[PATCH 0/6]nvme-pci: fixes on nvme_timeout and nvme_dev_disable

2018-02-01 Thread Jianchao Wang
. 6th fixes a bug found when test, it is not related with 4th patch. This patchset was tested under debug patch for some days. And some bugfix have been done. The debug patch and other patches are available in following it branch: https://github.com/jianchwa/linux-blcok.git nvme_fixes_test Jianchao

[PATCH 6/6] nvme-pci: suspend queues based on online_queues

2018-02-01 Thread Jianchao Wang
. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/pci.c | 31 --- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index a838713c..e37f209 100644 --- a/drivers/nvme/host

[PATCH 2/6] nvme-pci: fix the freeze and quiesce for shutdown and reset case

2018-02-01 Thread Jianchao Wang
controller has been shutdown. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/pci.c | 36 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 00cffed..a7fa397

[PATCH 3/6] blk-mq: make blk_mq_rq_update_aborted_gstate a external interface

2018-02-01 Thread Jianchao Wang
No functional change, just make blk_mq_rq_update_aborted_gstate a external interface. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- block/blk-mq.c | 3 ++- include/linux/blk-mq.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/block/blk-mq.c b

[PATCH 1/6] nvme-pci: move clearing host mem behind stopping queues

2018-02-01 Thread Jianchao Wang
Move clearing host mem behind stopping queues. Prepare for following patch which will grab all the outstanding requests. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/pci.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/driver

[PATCH 6/6] nvme-pci: suspend queues based on online_queues

2018-02-01 Thread Jianchao Wang
. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/pci.c | 31 --- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index a838713c..e37f209 100644 --- a/drivers/nvme/host

[PATCH 2/6] nvme-pci: fix the freeze and quiesce for shutdown and reset case

2018-02-01 Thread Jianchao Wang
controller has been shutdown. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/pci.c | 36 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 00cffed..a7fa397

[PATCH 4/6] nvme-pci: break up nvme_timeout and nvme_dev_disable

2018-02-01 Thread Jianchao Wang
. With this patch, we could avoid nvme_dev_disable to be invoked by nvme_timeout and eliminate the race between nvme_timeout and nvme_dev_disable on outstanding requests. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/pci.c | 146 -

[no subject]

2018-02-01 Thread Jianchao Wang
. 6th fixes a bug found when test, it is not related with 4th patch. This patchset was tested under debug patch for some days. And some bugfix have been done. The debug patch and other patches are available in following it branch: https://github.com/jianchwa/linux-blcok.git nvme_fixes_test Jianchao

[PATCH 5/6] nvme-pci: discard wait timeout when delete cq/sq

2018-02-01 Thread Jianchao Wang
to nvme_dev_disable, then handle the outstanding requests. This will race with the request timeout path. To fix it, just use wait_for_completion instead of the timeout one. The request timeout path will wakeup it. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/pci

[PATCH] nvme-pci: use NOWAIT flag for nvme_set_host_mem

2018-01-28 Thread Jianchao Wang
NOWAIT flag. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 6fe7af0..9532529 100644 --- a/drivers/nvme/host/pci.c +++ b/driver

[PATCH RESENT] nvme-pci: introduce RECONNECTING state to mark initializing procedure

2018-01-22 Thread Jianchao Wang
; Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/core.c | 2 +- drivers/nvme/host/pci.c | 19 +-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 230cc09..23b3e53 10

[PATCH 1/4] nvme-pci: introduce RECONNECTING state to mark initializing procedure

2018-01-22 Thread Jianchao Wang
; Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/core.c | 2 +- drivers/nvme/host/pci.c | 19 +-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 230cc09..23b3e53 10

[PATCH] nvme-pci: ensure nvme_timeout complete before initializing procedure

2018-01-21 Thread Jianchao Wang
cel the requeue_work. Link: https://lkml.org/lkml/2018/1/19/68 Suggested-by: Keith Busch <keith.bu...@intel.com> Signed-off-by: Keith Busch <keith.bu...@intel.com> Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/core.c | 20 ++-- dri

[PATCH V5 1/2] nvme-pci: introduce RECONNECTING state to mark initializing procedure

2018-01-18 Thread Jianchao Wang
other initializing things. Introduce RECONNECTING to nvme-pci transport to do the same mark. Then we get a coherent state definition among nvme pci/rdma/fc transports. Suggested-by: James Smart <james.sm...@broadcom.com> Signed-off-by: Jianchao Wang <jianchao.w.w...@o

[PATCH V5 0/2] nvme-pci: fix the timeout case when reset is ongoing

2018-01-18 Thread Jianchao Wang
Hello Please consider the following scenario. nvme_reset_ctrl -> set state to RESETTING -> queue reset_work (scheduling) nvme_reset_work -> nvme_dev_disable -> quiesce queues -> nvme_cancel_request on outstanding requests ---_boundary_

[PATCH V5 2/2] nvme-pci: fixup the timeout case when reset is ongoing

2018-01-18 Thread Jianchao Wang
RECONNECTING, handle it as the original method and discard the nvme_dev_disable there, the nvme_reset_work will see the error and invoke itself. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/pci.c | 24 +++- 1 file changed, 15 insertions(+),

[PATCH V4 2/2] nvme-pci: fix the timeout case when reset is ongoing

2018-01-16 Thread Jianchao Wang
ble the dev itself, so discard the nvme_dev_disable here. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/pci.c | 29 - 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pc

[PATCH V4 1/2] nvme: add NVME_CTRL_RESET_PREPARE state

2018-01-16 Thread Jianchao Wang
igned-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/core.c | 18 +++--- drivers/nvme/host/fc.c | 4 ++-- drivers/nvme/host/nvme.h | 8 drivers/nvme/host/pci.c| 25 + drivers/nvme/host/rdma.c | 2 +- drivers/nvm

[PATCH V4 0/2] nvme-pci: fix the timeout case when reset is ongoing

2018-01-16 Thread Jianchao Wang
comments of patch Jianchao Wang (2) 0001-nvme-add-NVME_CTRL_RESET_PREPARE-state.patch 0002-nvme-pci-fix-the-timeout-case-when-reset-is-ongoing.patch drivers/nvme/host/core.c | 18 +--- drivers/nvme/host/fc.c | 4 ++-- drivers/nvme/host/nvme.h | 8 +++ drivers/nvme/host/pci.c

[PATCH] net/mlx4_en: ensure rx_desc updating reaches HW before prod db updating

2018-01-11 Thread Jianchao Wang
rx_desc and prod db still could lead to corruption on different inbound packages. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/net/ethernet/mellanox/mlx4/en_rx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx4/e

[PATCH] nvme-pci: calculate iod and avg_seg_size just before use them

2018-01-10 Thread Jianchao Wang
The calculation of iod and avg_seg_size maybe meaningless if nvme_pci_use_sgls returns before uses them. So calculate just before use them. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/pci.c | 11 +++ 1 file changed, 7 insertions(+), 4 del

[PATCH V3 0/2] nvme-pci: fix the timeout case when reset is ongoing

2018-01-10 Thread Jianchao Wang
Jianchao Wang(2) 0001-nvme-split-resetting-state-into-reset_prepate-and-re.patch 0002-nvme-pci-fix-the-timeout-case-when-reset-is-ongoing.patch drivers/nvme/host/core.c | 17 ++-- drivers/nvme/host/fc.c | 2 ++ drivers/nvme/host/nvme.h | 1 + drivers/nvme/host/pci.c| 51

[PATCH V3 2/2] nvme-pci: fix the timeout case when reset is ongoing

2018-01-10 Thread Jianchao Wang
ble the dev itself, so discard the nvme_dev_disable here. Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/pci.c | 25 - 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c inde

[PATCH V3 1/2] nvme: split resetting state into reset_prepate and resetting

2018-01-10 Thread Jianchao Wang
oph Hellwig <h...@lst.de> Signed-off-by: Jianchao Wang <jianchao.w.w...@oracle.com> --- drivers/nvme/host/core.c | 17 +++-- drivers/nvme/host/fc.c | 2 ++ drivers/nvme/host/nvme.h | 1 + drivers/nvme/host/pci.c| 28 ++-- drivers/nvme/hos

  1   2   >