Re: [PATCH V2 6/8] block: allow to allocate req with REQF_PREEMPT when queue is frozen

2017-09-01 Thread Ming Lei
On Fri, Sep 01, 2017 at 08:07:04PM +, Bart Van Assche wrote: > On Sat, 2017-09-02 at 02:49 +0800, Ming Lei wrote: > > + if ((flags & BLK_MQ_REQ_PREEMPT) && blk_queue_is_freezing(q)) > > + blk_queue_enter_live(q); > > + else > > + ret = blk_queue_enter(q, !(gfp_mask & __G

[PATCH] target: Avoid that EXTENDED COPY commands triggers lock inversion

2017-09-01 Thread Bart Van Assche
This patch prevents that lockdep reports the following complaint: == WARNING: possible circular locking dependency detected 4.12.0-rc1-dbg+ #1 Not tainted -- rmdir/12053 is trying to acquire loc

Re: [PATCH V2 6/8] block: allow to allocate req with REQF_PREEMPT when queue is frozen

2017-09-01 Thread Bart Van Assche
On Sat, 2017-09-02 at 02:49 +0800, Ming Lei wrote: > + if ((flags & BLK_MQ_REQ_PREEMPT) && blk_queue_is_freezing(q)) > + blk_queue_enter_live(q); > + else > + ret = blk_queue_enter(q, !(gfp_mask & __GFP_DIRECT_RECLAIM)); Why did you repost this patch series without

[PATCH V2 8/8] SCSI: freeze block queue when SCSI device is put into quiesce

2017-09-01 Thread Ming Lei
Simply quiesing SCSI device and waiting for completeion of IO dispatched to SCSI queue isn't safe, it is easy to use up requests because all these allocated requests can't be dispatched when device is put in QIUESCE. Then no request can be allocated for RQF_PREEMPT, and system may hang somewhere, s

[PATCH V2 7/8] block: introduce preempt version of blk_[freeze|unfreeze]_queue

2017-09-01 Thread Ming Lei
The two APIs are required to allow request allocation for RQF_PREEMPT when queue is frozen. The following two points have to be guaranteed for one queue: 1) preempt freezing can be started only after all pending normal & preempt freezing are completed 2) normal freezing can't be started if there

[PATCH V2 6/8] block: allow to allocate req with REQF_PREEMPT when queue is frozen

2017-09-01 Thread Ming Lei
REQF_PREEMPT is a bit special because it is required to be dispatched to lld even when SCSI device is quiesced. So this patch introduces __blk_get_request() to allow block layer to allocate request when queue is frozen, since we will freeze queue before quiescing SCSI device in the following patch

[PATCH V2 5/8] block: tracking request allocation with q_usage_counter

2017-09-01 Thread Ming Lei
This usage is basically same with blk-mq, so that we can support to freeze queue easily. Signed-off-by: Ming Lei --- block/blk-core.c | 8 1 file changed, 8 insertions(+) diff --git a/block/blk-core.c b/block/blk-core.c index ce2d3b6f6c62..85b15833a7a5 100644 --- a/block/blk-core.c +++

[PATCH V2 4/8] blk-mq: rename blk_mq_freeze_queue_wait as blk_freeze_queue_wait

2017-09-01 Thread Ming Lei
The only change on legacy is that blk_drain_queue() is run from blk_freeze_queue(), which is called in blk_cleanup_queue(). So this patch removes the explicite __blk_drain_queue() in blk_cleanup_queue(). Signed-off-by: Ming Lei --- block/blk-core.c | 17 +++-- block/blk-mq.c

[PATCH V2 3/8] blk-mq: only run hw queues for blk-mq

2017-09-01 Thread Ming Lei
This patch just makes it explicitely. Reviewed-by: Johannes Thumshirn Signed-off-by: Ming Lei --- block/blk-mq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 8cf1f7cbef2b..4c532d8612e1 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.

[PATCH V2 2/8] blk-mq: rename blk_mq_freeze_queue as blk_freeze_queue

2017-09-01 Thread Ming Lei
This APIs will be used by legacy path too. Signed-off-by: Ming Lei --- block/bfq-iosched.c | 2 +- block/blk-cgroup.c | 4 ++-- block/blk-mq.c | 17 - block/blk-mq.h | 1 - block/elevator.c | 2 +- drivers/block/loop.c | 8

[PATCH V2 0/8] block/scsi: safe SCSI quiescing

2017-09-01 Thread Ming Lei
Hi, The current SCSI quiesce isn't safe and easy to trigger I/O deadlock. Once SCSI device is put into QUIESCE, no new request except for RQF_PREEMPT can be dispatched to SCSI successfully, and scsi_device_quiesce() just simply waits for completion of I/Os dispatched to SCSI stack. It isn't enoug

[PATCH V2 1/8] blk-mq: rename blk_mq_unfreeze_queue as blk_unfreeze_queue

2017-09-01 Thread Ming Lei
We will support to freeze queue on block legacy path too. Signed-off-by: Ming Lei --- block/blk-cgroup.c | 4 ++-- block/blk-mq.c | 10 +- block/elevator.c | 2 +- drivers/block/loop.c | 8 drivers/nvme/host/core.c | 4 ++-- include/linux/blk-mq.h

[PATCH V2 0/8] block/scsi: safe SCSI quiescing

2017-09-01 Thread Ming Lei
Hi, The current SCSI quiesce isn't safe and easy to trigger I/O deadlock. Once SCSI device is put into QUIESCE, no new request except for RQF_PREEMPT can be dispatched to SCSI successfully, and scsi_device_quiesce() just simply waits for completion of I/Os dispatched to SCSI stack. It isn't enoug

[PATCH V2 0/8] block/scsi: safe SCSI quiescing

2017-09-01 Thread Ming Lei
Hi, The current SCSI quiesce isn't safe and easy to trigger I/O deadlock. Once SCSI device is put into QUIESCE, no new request except for RQF_PREEMPT can be dispatched to SCSI successfully, and scsi_device_quiesce() just simply waits for completion of I/Os dispatched to SCSI stack. It isn't enoug

[PATCH V2 1/8] blk-mq: rename blk_mq_unfreeze_queue as blk_unfreeze_queue

2017-09-01 Thread Ming Lei
We will support to freeze queue on block legacy path too. Signed-off-by: Ming Lei --- block/blk-cgroup.c | 4 ++-- block/blk-mq.c | 10 +- block/elevator.c | 2 +- drivers/block/loop.c | 8 drivers/nvme/host/core.c | 4 ++-- include/linux/blk-mq.h

Re: [PATCH 8/8] scsi: Introduce ZBC disk I/O scheduler

2017-09-01 Thread Bart Van Assche
On Fri, 2017-09-01 at 20:36 +0900, Damien Le Moal wrote: > +static struct scsi_disk *__zoned_scsi_disk(struct request_queue *q) > +{ > + struct scsi_device *sdp; > + struct scsi_disk *sdkp; > + > + if (!blk_queue_is_zoned(q)) { > + pr_err("zoned: Not a zoned block de

Re: [PATCH 8/9] block: allow to allocate req with REQF_PREEMPT when queue is frozen

2017-09-01 Thread Ming Lei
On Fri, Sep 01, 2017 at 03:43:39PM +, Bart Van Assche wrote: > On Fri, 2017-09-01 at 11:55 +0800, Ming Lei wrote: > > On Thu, Aug 31, 2017 at 10:50:25PM +, Bart Van Assche wrote: > > > On Fri, 2017-09-01 at 01:27 +0800, Ming Lei wrote: > > > > @@ -1413,9 +1414,17 @@ static struct request >

Re: [PATCH 7/8] scsi: sd_zbc: Disable zone write locking with scsi-mq

2017-09-01 Thread Bart Van Assche
On Fri, 2017-09-01 at 20:36 +0900, Damien Le Moal wrote: > In the case of a ZBC disk used with scsi-mq, zone write locking does > not prevent write reordering in sequential zones. Unlike the legacy > case, zone locking can only be done after the command request is > removed from the scheduler dispa

Re: [PATCH 6/8] scsi: sd_zbc: Limit zone write locking to sequential zones

2017-09-01 Thread Bart Van Assche
On Fri, 2017-09-01 at 20:36 +0900, Damien Le Moal wrote: > Zoned block devices have no write constraints for conventional zones > so write locking of conventional zones is not necessary and can hurt > performance. To avoid this, introduce the seq_zones bitmap to indicate > if a zone is a sequential

Re: [PATCH 5/8] scsi: sd_zbc: Fix sd_zbc_read_zoned_characteristics()

2017-09-01 Thread Bart Van Assche
On Fri, 2017-09-01 at 20:36 +0900, Damien Le Moal wrote: > The three values starting at byte 8 of the Zoned Block Device > Characteristics VPD page B6h are 32 bits values, not 64bits. So use > get_unaligned_be32() to retrieve the values and not get_unaligned_be64() Reviewed-by: Bart Van Assche

Re: [PATCH 4/8] scsi: sd_zbc: Reorganize and cleanup

2017-09-01 Thread Bart Van Assche
On Fri, 2017-09-01 at 20:36 +0900, Damien Le Moal wrote: > Introduce sd_zbc.h for zbc related declarations (avoid cluttering sd.h). > > Fix comments style in sd_zbc.c (do not use documentation format) and > add/fix comments to enhance explanations. Also remove a useless blank > line in sd_zbc_read

Re: [PATCH 3/8] scsi: sd_zbc: Move ZBC declarations to scsi_proto.h

2017-09-01 Thread Bart Van Assche
On Fri, 2017-09-01 at 20:36 +0900, Damien Le Moal wrote: > +/* Zone types of REPORT ZONES zone descriptors */ > +enum zbc_zone_type { > + ZBC_ZONE_TYPE_CONV = 0x1, > + ZBC_ZONE_TYPE_SEQWRITE_REQ = 0x2, > + ZBC_ZONE_TYPE_SEQWRITE_PREF = 0x3, > + /* 0x4 to 0xf ar

Re: [PATCH 1/9] percpu-refcount: introduce percpu_ref_is_dead()

2017-09-01 Thread Ming Lei
On Fri, Sep 01, 2017 at 06:59:15AM -0700, Tejun Heo wrote: > Hello, Ming. > > > +/** > > + * percpu_ref_is_dead - test whether a percpu refcount is killed > > + * @ref: percpu_ref to test > > + * > > + * Returns %true if @ref is dead > > + * > > + * This function is safe to call as long as @ref is

Re: [PATCH 2/8] block: Fix declaration of blk-mq scheduler functions

2017-09-01 Thread Bart Van Assche
On Fri, 2017-09-01 at 20:36 +0900, Damien Le Moal wrote: > --- a/include/linux/blk-mq.h > +++ b/include/linux/blk-mq.h > @@ -284,6 +284,16 @@ void blk_mq_update_nr_hw_queues(struct blk_mq_tag_set > *set, int nr_hw_queues); > void blk_mq_quiesce_queue_nowait(struct request_queue *q); > > /* > +

Re: [PATCH 1/8] block: Fix declaration of blk-mq debugfs functions

2017-09-01 Thread Bart Van Assche
On Fri, 2017-09-01 at 20:36 +0900, Damien Le Moal wrote: > diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h > index 14542308d25b..a369174a9679 100644 > --- a/include/linux/blk-mq.h > +++ b/include/linux/blk-mq.h > @@ -5,6 +5,21 @@ > #include > #include > > +#ifdef CONFIG_BLK_DEBUG

Re: [PATCH v3 2/5] dt-bindings: scsi: ufs: add document for hisi-ufs

2017-09-01 Thread Rob Herring
On Tue, Aug 29, 2017 at 04:41:13PM +0800, Li Wei wrote: > add ufs node document for Hisilicon > > Signed-off-by: Li Wei > --- > Documentation/devicetree/bindings/ufs/ufs-hisi.txt | 35 > ++ > 1 file changed, 35 insertions(+) > create mode 100644 Documentation/devicetree/bin

Re: [PATCH 1/9] percpu-refcount: introduce percpu_ref_is_dead()

2017-09-01 Thread Bart Van Assche
On Fri, 2017-09-01 at 06:59 -0700, Tejun Heo wrote: > > +/** > > + * percpu_ref_is_dead - test whether a percpu refcount is killed > > + * @ref: percpu_ref to test > > + * > > + * Returns %true if @ref is dead > > + * > > + * This function is safe to call as long as @ref is between init and exit. >

Re: [PATCH 8/9] block: allow to allocate req with REQF_PREEMPT when queue is frozen

2017-09-01 Thread Bart Van Assche
On Fri, 2017-09-01 at 11:55 +0800, Ming Lei wrote: > On Thu, Aug 31, 2017 at 10:50:25PM +, Bart Van Assche wrote: > > On Fri, 2017-09-01 at 01:27 +0800, Ming Lei wrote: > > > @@ -1413,9 +1414,17 @@ static struct request *blk_old_get_request(struct > > > request_queue *q, > > > /* create ioc

Re: [PATCH 1/9] percpu-refcount: introduce percpu_ref_is_dead()

2017-09-01 Thread Tejun Heo
Hello, Ming. > +/** > + * percpu_ref_is_dead - test whether a percpu refcount is killed > + * @ref: percpu_ref to test > + * > + * Returns %true if @ref is dead > + * > + * This function is safe to call as long as @ref is between init and exit. > + */ > +static inline bool percpu_ref_is_dead(struc

Re: [PATCH 4/9] blk-mq: only run hw queues for blk-mq

2017-09-01 Thread Johannes Thumshirn
On Fri, Sep 01, 2017 at 08:33:40PM +0800, Ming Lei wrote: > Given it is the only case that blk_mq_run_hw_queues() is run on > !q->mq_ops now, I suggest to check q->mq_ops outside, otherwise > it can be a bit overkill. Fair enough, Reviewed-by: Johannes Thumshirn -- Johannes Thumshirn

Re: [PATCH 4/9] blk-mq: only run hw queues for blk-mq

2017-09-01 Thread Ming Lei
On Fri, Sep 01, 2017 at 10:16:34AM +0200, Johannes Thumshirn wrote: > Hi Ming, > > On Fri, Sep 01, 2017 at 01:27:23AM +0800, Ming Lei wrote: > > - blk_mq_run_hw_queues(q, false); > > + if (q->mq_ops) > > + blk_mq_run_hw_queues(q, false); > > What speaks again

[PATCH 6/8] scsi: sd_zbc: Limit zone write locking to sequential zones

2017-09-01 Thread Damien Le Moal
Zoned block devices have no write constraints for conventional zones so write locking of conventional zones is not necessary and can hurt performance. To avoid this, introduce the seq_zones bitmap to indicate if a zone is a sequential one. Use this information to allow any write to be issued to con

[PATCH 8/8] scsi: Introduce ZBC disk I/O scheduler

2017-09-01 Thread Damien Le Moal
The zoned I/O scheduler is mostly identical to mq-deadline and retains the same configuration attributes. The main difference is that the zoned scheduler will ensure that at any time at most only one write request (command) per sequential zone is in flight (has been issued to the disk) in order to

[PATCH 3/8] scsi: sd_zbc: Move ZBC declarations to scsi_proto.h

2017-09-01 Thread Damien Le Moal
Move standard macro definitions for the zone types and zone conditions to scsi_proto.h together with the definitions related to the REPORT ZONES command. While at it, define all values in the enums to be clear. Signed-off-by: Damien Le Moal --- drivers/scsi/sd_zbc.c | 18 --

[PATCH 7/8] scsi: sd_zbc: Disable zone write locking with scsi-mq

2017-09-01 Thread Damien Le Moal
In the case of a ZBC disk used with scsi-mq, zone write locking does not prevent write reordering in sequential zones. Unlike the legacy case, zone locking can only be done after the command request is removed from the scheduler dispatch queue. That is, at the time of zone locking, the write comman

[PATCH 5/8] scsi: sd_zbc: Fix sd_zbc_read_zoned_characteristics()

2017-09-01 Thread Damien Le Moal
The three values starting at byte 8 of the Zoned Block Device Characteristics VPD page B6h are 32 bits values, not 64bits. So use get_unaligned_be32() to retrieve the values and not get_unaligned_be64() Fixes: 89d947561077 ("sd: Implement support for ZBC devices") Cc: Signed-off-by: Damien Le Mo

[PATCH 2/8] block: Fix declaration of blk-mq scheduler functions

2017-09-01 Thread Damien Le Moal
The functions blk_mq_sched_free_hctx_data(), blk_mq_sched_try_merge(), blk_mq_sched_try_insert_merge() and blk_mq_sched_request_inserted() are all exported symbols but declared only internally in block/blk-mq-sched.h. Move their declaration to include/linux/blk-mq.h to make them available to block

[PATCH 4/8] scsi: sd_zbc: Reorganize and cleanup

2017-09-01 Thread Damien Le Moal
Introduce sd_zbc.h for zbc related declarations (avoid cluttering sd.h). Fix comments style in sd_zbc.c (do not use documentation format) and add/fix comments to enhance explanations. Also remove a useless blank line in sd_zbc_read_zones(). Rearrange sd_zbc_setup() to include use_16_for_rw and us

[PATCH 1/8] block: Fix declaration of blk-mq debugfs functions

2017-09-01 Thread Damien Le Moal
__blk_mq_debugfs_rq_show() and blk_mq_debugfs_rq_show() are exported symbols but declared in the block internal file block/blk-mq-debugfs.h. Move the declaration of these functions to the public linux/blk-mq.h file to make these functions available to other modules. While at it, also move the defi

[PATCH 0/8] blk-mq/scsi-mq support for ZBC disks

2017-09-01 Thread Damien Le Moal
This series implements support for ZBC disks used through the blk-mq/scsi-mq I/O path. The current scsi level support of ZBC disks guarantees write request ordering using a per-zone write lock which prevents issuing simultaneously multiple write commands to a zone, doing so avoid reordering of seq

Re: [PATCH 3/6] pm80xx : Different SAS addresses for phys.

2017-09-01 Thread Jack Wang
2017-08-30 18:55 GMT+02:00 Viswas G : > Hi Jack, > > This is a customer requirement. Since the SAS addresses of all the phys were > same , when the attached SAS addresses are different, it was forming only one > domain. If we assign different SAS addresses, this will cause duplicate > domain un

Re: [PATCH V2 1/2] scsi: sd: Fix sd_config_write_same()

2017-09-01 Thread Damien Le Moal
Martin, On 9/1/17 12:36, Martin K. Petersen wrote: > > Damien, > >> +if (sdkp->max_ws_blocks && >> +sdkp->physical_block_size > logical_block_size) { >> +/* >> + * Reporting a maximum number of blocks that is not aligned >> + * on the device physic

[Resend v5 04/14] mpt3sas: Added support for nvme encapsulated request message.

2017-09-01 Thread Suganath Prabu S
* Mpt3sas driver uses the NVMe Encapsulated Request message to send an NVMe command to an NVMe device attached to the IOC. * Normal I/O commands like reads and writes are passed to the controller as SCSI commands and the controller has the ability to translate the commands to NVMe equivalent. * T

Re: [PATCH v4 00/14] mpt3sas driver NVMe support:

2017-09-01 Thread Suganath Prabu Subramani
Hi Martin, On Fri, Sep 1, 2017 at 8:52 AM, Martin K. Petersen wrote: > > Hi Suganath, > >> Let me explain - NVME device fast path is possible in two ways. IEEE >> SGL and PRP SGL. Due to h/w constraint we choose IEEE SGL only for >> smaller IO size. Both above is true h/w Fast Path and no firmw

Re: Buffer overflow in the mptctl_replace_fw() function in linux kernel MPT ioctl driver

2017-09-01 Thread Dan Carpenter
On Fri, Sep 01, 2017 at 02:00:48PM +0800, Dison River wrote: > newFwSize = ALIGN(karg.newImageSize, 4); This is an integer overflow, but it's harmless... As a static checker developer this is where I would print a warning: drivers/message/fusion/mptctl.c:1748 mptctl_replace_fw() warn: potenti

Re: [PATCH 4/9] blk-mq: only run hw queues for blk-mq

2017-09-01 Thread Johannes Thumshirn
Hi Ming, On Fri, Sep 01, 2017 at 01:27:23AM +0800, Ming Lei wrote: > - blk_mq_run_hw_queues(q, false); > + if (q->mq_ops) > + blk_mq_run_hw_queues(q, false); What speaks against putting the if (q->mq_ops) directly into blk_mq_run_hw_queues() so we can't

Re: [PATCH] Remove Scsi_Host.uspace_req_q

2017-09-01 Thread Christoph Hellwig
Looks fine, Reviewed-by: Christoph Hellwig

Re: [PATCH] Remove Scsi_Host.uspace_req_q

2017-09-01 Thread Johannes Thumshirn
Looks good, Reviewed-by: Johannes Thumshirn -- Johannes Thumshirn Storage jthumsh...@suse.de+49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG N