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

2018-02-15 Thread Jianchao Wang
suggestion, just set cq_vector to -1 if io queue setup fails. - Change patch name and comment Signed-off-by: Jianchao Wang --- 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/pci.c index 4a7c420.

[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 --- drivers/nvme/host/pci.c | 18

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

2018-02-11 Thread Jianchao Wang
d kill the controller) Signed-off-by: Jianchao Wang --- 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/pci.c index f3e0eae..a0ff18e 100644 --- a/drivers

[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 Signed-off-by: Jianchao Wang --- drivers/nvme/host/pci.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a

[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 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 --- 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/block/blk-mq.c index 01f271d

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

2018-02-11 Thread Jianchao Wang
. Signed-off-by: Jianchao Wang --- 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/drivers/nvme/host/core.c @@ -1117,14

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

2018-02-11 Thread Jianchao Wang
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 --- drivers/nvme/host/pci.c | 6 +- 1 file changed, 1

[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 --- drivers

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

2018-02-11 Thread Jianchao Wang
troduced. 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) 0

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

2018-02-11 Thread Jianchao Wang
ine_queues. Signed-off-by: Jianchao Wang --- 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/nvme/host/pci.c +++ b/dr

[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 Signed-off-by: Jianchao Wang --- 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 a86df9c..06d8110 100644 --- a/drivers/scsi/scsi_lib.c +++ b

[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 --- drivers/scsi/scsi.c | 2 +- drivers/scsi/scsi_error.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/scsi.c

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

2018-02-01 Thread Jianchao Wang
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 --- drivers/nvme/host/pci.c | 6 +- 1 file changed, 1

[no subject]

2018-02-01 Thread Jianchao Wang
path. 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 Jia

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

2018-02-01 Thread Jianchao Wang
he error. 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 --- drivers/nvme/host/pci.c | 146

[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 --- drivers/nvme/host/pci.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme

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

2018-02-01 Thread Jianchao Wang
ine_queues. Signed-off-by: Jianchao Wang --- 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/pci.c +++ b/drivers/nvme/

[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 --- 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 100644 --- a/drivers/nvme/host/pci.c

[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 --- 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/block/blk-mq.c index 01f271d

[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 --- 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 100644 --- a/drivers/nvme/host/pci.c

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

2018-02-01 Thread Jianchao Wang
he error. 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 --- 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
path. 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 Jia

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

2018-02-01 Thread Jianchao Wang
ine_queues. Signed-off-by: Jianchao Wang --- 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/pci.c +++ b/drivers/nvme/

[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 --- drivers/nvme/host/pci.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme

[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 --- 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/block/blk-mq.c index 01f271d

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

2018-02-01 Thread Jianchao Wang
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 --- drivers/nvme/host/pci.c | 6 +- 1 file changed, 1

[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_

[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 --- 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 100644 --- a/drivers/nvme/host/pci.c

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

2018-02-05 Thread Jianchao Wang
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 --- drivers/nvme/host/pci.c | 6 +- 1 file changed, 1

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

2018-02-05 Thread Jianchao Wang
CELLED 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 --- drivers/nvme/host/p

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

2018-02-05 Thread Jianchao Wang
ine_queues. Signed-off-by: Jianchao Wang --- 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 +++ b/drivers/nvme/

[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 --- 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/block/blk-mq.c index 01f271d

[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 Signed-off-by: Jianchao Wang --- drivers/nvme/host/pci.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a

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

2018-02-12 Thread Jianchao Wang
. Signed-off-by: Jianchao Wang --- 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/nvme/host/core.c @@ -1119,14 +1119,19

[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 --- drivers/nvme/host

[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 --- drivers/nvme/host

[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 Reviewed-by: Sagi Grimberg Signed-off-by: Jianchao Wang --- drivers/nvme/host/pci.c | 9 - 1 file changed, 4 insertions(+), 5

[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 5/8] nvme-pci: suspend queues based on online_queues

2018-02-12 Thread Jianchao Wang
ine_queues. Signed-off-by: Jianchao Wang --- 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/nvme/host/pci.c +++ b/dr

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

2018-02-12 Thread Jianchao Wang
ine_queues. Signed-off-by: Jianchao Wang --- 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/nvme/host/pci.c +++ b/dr

[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 --- 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 73036d2..7f421b7 100644 --- a/drivers

[PATCH] nvme: check ctrl.tagset before start ns scan

2018-01-01 Thread Jianchao Wang
ctrl.tagset maybe NULL due to failure of io queue setup or blk-mq tagset allocation in nvme_reset_work. Then panic would come up. To fix this, just add ctrl.tagset check in nvme_scan_work. Signed-off-by: Jianchao Wang --- drivers/nvme/host/core.c | 2 +- 1 file changed, 1 insertion(+), 1

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

2018-01-01 Thread Jianchao Wang
: Jianchao Wang --- drivers/nvme/host/pci.c | 26 +- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index f5800c3..6e58de1 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -99,6 +99,9 @@ struct

[PATCH 1/3] nvme-pci: add nvme_pci_pre_init

2018-01-01 Thread Jianchao Wang
No fucntional change. Add nvme_pci_pre_init to package the nvme specified initialization work before configuring admin queue. Then nvme_pci_enable and nvme_pci_configure_admin_queue could be clearer. Signed-off-by: Jianchao Wang --- drivers/nvme/host/pci.c | 145

[PATCH 2/3] nvme-pci: change the name of functions corresponding to setup adminq

2018-01-01 Thread Jianchao Wang
No functional change. Just change name of functions corresponding to setup adminq to make it more readable. nvme_pci_configure_admin_queue -> nvme_pci_setup_adminq nvme_alloc_admin_tags -> nvme_pci_start_adminq Signed-off-by: Jianchao Wang --- drivers/nvme/host/pci.c | 8 -

[PATCHSET] nvme-pci: sort out nvme initialization procedure in nvme_rest_work

2018-01-02 Thread Jianchao Wang
identify information. Then nvme_pci_enable, nvme_pci_configure_admin_queue and nvme_reset_work could be clearer. Change functions' name, nvme_pci_configure_admin_queue and nvme_alloc_admin_tags to nvme_pci_setup_adminq and nvme_pci_start_adminq to make it more readable. Jianchao Wang (3) 0001-nvm

[PATCH 3/3] nvme-pci: add nvme_pci_post_init

2018-01-02 Thread Jianchao Wang
No functional change. Add new interface nvme_pci_post_init to get in the nvme sepcific initialization work after identify. Signed-off-by: Jianchao Wang --- drivers/nvme/host/pci.c | 58 + 1 file changed, 34 insertions(+), 24 deletions(-) diff

[PATCH V2] nvme-pci: fix NULL pointer reference in nvme_alloc_ns

2018-01-04 Thread Jianchao Wang
_LIVE. - Change patch name and comment. Suggested-by: Sagi Grimberg Signed-off-by: Jianchao Wang --- drivers/nvme/host/core.c | 20 +--- drivers/nvme/host/nvme.h | 1 + drivers/nvme/host/pci.c | 31 ++- 3 files changed, 40 insertions(+), 12 dele

[PATCH] blk-mq: put the driver tag of nxt rq before first one is requeued

2017-09-12 Thread Jianchao Wang
requeued in the failure branch of queue_rq callback and it is just needed there. Signed-off-by: Jianchao Wang --- block/blk-mq.c | 19 +-- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 4603b11..19f848e 100644 --- a/block/blk-mq.c

[PATCH] block: move sanity checking ahead of bi_front/back_seg_size updating

2017-09-15 Thread Jianchao Wang
If the bio_integrity_merge_rq() return false or nr_phys_segments exceeds the max_segments, the merging fails, but the bi_front/back_seg_size may have been modified. To avoid it, move the sanity checking ahead. Signed-off-by: Jianchao Wang --- block/blk-merge.c | 16 ++-- 1 file

[PATCH] block: consider merge of segments when merge bio into rq

2017-09-15 Thread Jianchao Wang
structure. Signed-off-by: Jianchao Wang --- block/blk-merge.c | 98 --- 1 file changed, 64 insertions(+), 34 deletions(-) diff --git a/block/blk-merge.c b/block/blk-merge.c index 14b6e37..b2f54fd 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c

[PATCH v3] block: consider merge of segments when merge bio into rq

2017-09-24 Thread Jianchao Wang
of segments merging check in ll_front/back_merge_fn() together into ll_new_hw_segment(). Change since v1: Add more comment to elaborate how this issue found and result after apply the patch. Signed-off-by: Jianchao Wang --- block/blk-merge.c | 49

[PATCH v4] block: consider merge of segments when merge bio into rq

2017-09-25 Thread Jianchao Wang
ll_new_hw_segment(). Change since v1: Add more comment to elaborate how this issue found and result after apply the patch. Signed-off-by: Jianchao Wang --- block/blk-merge.c | 49 +++-- 1 file changed, 35 insertions(+), 14 deletions(-) diff --git a/block/blk

[V2] block: consider merge of segments when merge bio into rq

2017-09-20 Thread Jianchao Wang
this issue found and result after apply the patch. Signed-off-by: Jianchao Wang --- block/blk-merge.c | 98 --- 1 file changed, 64 insertions(+), 34 deletions(-) diff --git a/block/blk-merge.c b/block/blk-merge.c index 14b6e37..b2f54fd 100644

[PATCH v2] block: consider merge of segments when merge bio into rq

2017-09-20 Thread Jianchao Wang
this issue found and result after apply the patch. Signed-off-by: Jianchao Wang --- block/blk-merge.c | 98 --- 1 file changed, 64 insertions(+), 34 deletions(-) diff --git a/block/blk-merge.c b/block/blk-merge.c index 14b6e37..b2f54fd 100644

<    1   2