All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V4 00/16] scsi-mq support for ZBC disks
@ 2017-09-24 16:33 Damien Le Moal
  0 siblings, 0 replies; 4+ messages in thread
From: Damien Le Moal @ 2017-09-24 16:33 UTC (permalink / raw)
  To: linux-scsi, Martin K . Petersen, linux-block, Jens Axboe
  Cc: Christoph Hellwig, Bart Van Assche

This series implements support for ZBC disks used through the 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 sequential writes to
sequential zones. This method is however ineffective when scsi-mq is used with
zoned block devices. This is due to the different execution model of blk-mq
which passes a request to the scsi layer for dispatching after the request has
been removed from the I/O scheduler queue. That is, when the scsi layer tries
to lock the target zone of the request, the request may already be out of
order and zone write locking fails to prevent that.

Various approaches have been tried to solve this problem. All of them had the
serious disadvantage of cluttering blk-mq code with zoned block device specific
conditions and processing. As such extensive changes can only turn into a
maintenance nightmares, a radically different solution is proposed here.

This series proposes implementing scsi-mq support for zoned block devices at
the I/O scheduler level with simple modifications of the mq-deadline scheduler.
the modifications are the addition of a per zone write locking mechanism
similar to that implemented in sd_zbc.c for the legacy scsi path. The zone
write locking mechanism is used for the exact same purpose, that is, to limit
writes per zone to at most one request to avoid reordering. The locking context
however changes from that of scsi-sq and is moved to the dispatch_request
method of the scheduler. Within this context, under a spin lock guaranteeing
atomicity against other dispatch contexts, target zones of write requests can
be locked before write requests removal from the scheduler. In effect, this
results in the same behavior as the legacy scsi path. Sequential write ordering
is preserved.

The changes to mq-deadline do not affect regular disks: the same scheduling
behavior is maintained for these. The modification are also optimized to not
lock conventional zones. To do so, additional data is introduced in the
request queue structure so that the low level scsi code can pass upward
information such as the total number of zones and zone types of the device.
The availability of this new data avoids difficulties in accessing this
information from the I/O scheduler initialization method (init_queue() method)
context.

Of note is that patch 15 of this series removes setting mq-deadline as the
default scheduler for block devices with a single hardware queue. The reason for
this is that setting the default scheduler is done very early in the device
initialization sequence, when the disk characteristics are not yet known. This
results in mq-deadline not correctly setting the default zones write locking
behavior nased on the device zoning model. Setting of a default I/O scheduler
can be done easily with udev rules later in the system initialization process,
leading to correct default settings for zoned block devices.

Comments are as always very much appreciated.

Changes from v3:
* Integrated support directly into mq-deadline instead of creating a new I/O
  scheduler.
* Disable setting of default mq scheduler for single queue devices

Changes from v2:
* Introduced blk_zoned structure
* Moved I/O scheduler from drivers/scsi to block 

Changes from v1:
* Addressed Bart's comments for the blk-mq patches (declarations files)
* Split (former) patch 4 into multiple patches to facilitate review
* Fixed scsi disk lookup from io scheduler by introducing
  scsi_disk_from_queue()

Damien Le Moal (16):
  scsi: sd_zbc: Move ZBC declarations to scsi_proto.h
  scsi: sd_zbc: Fix comments and indentation
  scsi: sd_zbc: Rearrange code
  scsi: sd_zbc: Use well defined macros
  scsi: sd_zbc: Fix sd_zbc_read_zoned_characteristics()
  block: Add zoned block device information to request queue
  scsi: sd_zbc: Initialize device request queue zoned data
  scsi: sd_zbc: Limit zone write locking to sequential zones
  scsi: sd_zbc: Disable zone write locking with scsi-mq
  block: mq-deadline: Add zoned block device data
  block: mq-deadline: Introduce zones_wlock attribute
  blokc: mq-deadline: Introduce dispatch helpers
  block: mq-deadline: Introduce zone locking support
  block: mq-deadline: Limit write dispatch for zoned block devices
  block: do not set mq defaulte scheduler
  block: mq-deadline: Update documentation

 Documentation/block/deadline-iosched.txt |  17 ++
 block/elevator.c                         |  17 +-
 block/mq-deadline.c                      | 302 +++++++++++++++++++++++++++-
 drivers/scsi/scsi_lib.c                  |   5 +-
 drivers/scsi/sd_zbc.c                    | 325 ++++++++++++++++++++++++-------
 include/linux/blkdev.h                   |  48 +++++
 include/scsi/scsi_proto.h                |  45 +++--
 7 files changed, 656 insertions(+), 103 deletions(-)

-- 
2.13.5

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH V4 00/16] scsi-mq support for ZBC disks
  2017-09-24 15:02 ` Christoph Hellwig
@ 2017-09-24 16:36   ` Damien Le Moal
  0 siblings, 0 replies; 4+ messages in thread
From: Damien Le Moal @ 2017-09-24 16:36 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-scsi, Martin K . Petersen, linux-block, Jens Axboe,
	Bart Van Assche

On 9/24/17 17:02, Christoph Hellwig wrote:
>>  Documentation/block/zoned-iosched.txt |  48 ++
>>  block/Kconfig.iosched                 |  12 +
>>  block/Makefile                        |   1 +
>>  block/blk-mq-debugfs.h                |  14 +-
>>  block/blk-mq-sched.h                  |  11 +-
>>  block/zoned-iosched.c                 | 925 ++++++++++++++++++++++++++++++++++
>>  drivers/scsi/scsi_lib.c               |   5 +-
>>  drivers/scsi/sd_zbc.c                 | 267 +++++++---
>>  include/linux/blk-mq-debugfs.h        |  23 +
>>  include/linux/blk-mq-sched.h          |  14 +
>>  include/linux/blkdev.h                |  24 +
>>  include/scsi/scsi_proto.h             |  45 +-
>>  12 files changed, 1283 insertions(+), 106 deletions(-)
>>  create mode 100644 Documentation/block/zoned-iosched.txt
>>  create mode 100644 block/zoned-iosched.c
>>  create mode 100644 include/linux/blk-mq-debugfs.h
>>  create mode 100644 include/linux/blk-mq-sched.h
> 
> This still seems to document the previous version.  Did it get
> any smaller by merging the zoned schedule into mq-deadline?

Ooops... Sorry. I messed up the cover letter. Here are the changes:

Damien Le Moal (16):

  scsi: sd_zbc: Move ZBC declarations to scsi_proto.h

  scsi: sd_zbc: Fix comments and indentation

  scsi: sd_zbc: Rearrange code

  scsi: sd_zbc: Use well defined macros

  scsi: sd_zbc: Fix sd_zbc_read_zoned_characteristics()

  block: Add zoned block device information to request queue

  scsi: sd_zbc: Initialize device request queue zoned data

  scsi: sd_zbc: Limit zone write locking to sequential zones

  scsi: sd_zbc: Disable zone write locking with scsi-mq

  block: mq-deadline: Add zoned block device data

  block: mq-deadline: Introduce zones_wlock attribute

  blokc: mq-deadline: Introduce dispatch helpers

  block: mq-deadline: Introduce zone locking support

  block: mq-deadline: Limit write dispatch for zoned block devices

  block: do not set mq defaulte scheduler

  block: mq-deadline: Update documentation



 Documentation/block/deadline-iosched.txt |  17 ++

 block/elevator.c                         |  17 +-

 block/mq-deadline.c                      | 302
+++++++++++++++++++++++++++-
 drivers/scsi/scsi_lib.c                  |   5 +-

 drivers/scsi/sd_zbc.c                    | 325
++++++++++++++++++++++++-------
 include/linux/blkdev.h                   |  48 +++++

 include/scsi/scsi_proto.h                |  45 +++--

 7 files changed, 656 insertions(+), 103 deletions(-)

I resent the cover letter.

-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH V4 00/16] scsi-mq support for ZBC disks
  2017-09-24  7:02 Damien Le Moal
@ 2017-09-24 15:02 ` Christoph Hellwig
  2017-09-24 16:36   ` Damien Le Moal
  0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2017-09-24 15:02 UTC (permalink / raw)
  To: Damien Le Moal
  Cc: linux-scsi, Martin K . Petersen, linux-block, Jens Axboe,
	Christoph Hellwig, Bart Van Assche

>  Documentation/block/zoned-iosched.txt |  48 ++
>  block/Kconfig.iosched                 |  12 +
>  block/Makefile                        |   1 +
>  block/blk-mq-debugfs.h                |  14 +-
>  block/blk-mq-sched.h                  |  11 +-
>  block/zoned-iosched.c                 | 925 ++++++++++++++++++++++++++++++++++
>  drivers/scsi/scsi_lib.c               |   5 +-
>  drivers/scsi/sd_zbc.c                 | 267 +++++++---
>  include/linux/blk-mq-debugfs.h        |  23 +
>  include/linux/blk-mq-sched.h          |  14 +
>  include/linux/blkdev.h                |  24 +
>  include/scsi/scsi_proto.h             |  45 +-
>  12 files changed, 1283 insertions(+), 106 deletions(-)
>  create mode 100644 Documentation/block/zoned-iosched.txt
>  create mode 100644 block/zoned-iosched.c
>  create mode 100644 include/linux/blk-mq-debugfs.h
>  create mode 100644 include/linux/blk-mq-sched.h

This still seems to document the previous version.  Did it get
any smaller by merging the zoned schedule into mq-deadline?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH V4 00/16] scsi-mq support for ZBC disks
@ 2017-09-24  7:02 Damien Le Moal
  2017-09-24 15:02 ` Christoph Hellwig
  0 siblings, 1 reply; 4+ messages in thread
From: Damien Le Moal @ 2017-09-24  7:02 UTC (permalink / raw)
  To: linux-scsi, Martin K . Petersen, linux-block, Jens Axboe
  Cc: Christoph Hellwig, Bart Van Assche

This series implements support for ZBC disks used through the 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 sequential writes to
sequential zones. This method is however ineffective when scsi-mq is used with
zoned block devices. This is due to the different execution model of blk-mq
which passes a request to the scsi layer for dispatching after the request has
been removed from the I/O scheduler queue. That is, when the scsi layer tries
to lock the target zone of the request, the request may already be out of
order and zone write locking fails to prevent that.

Various approaches have been tried to solve this problem. All of them had the
serious disadvantage of cluttering blk-mq code with zoned block device specific
conditions and processing. As such extensive changes can only turn into a
maintenance nightmares, a radically different solution is proposed here.

This series proposes implementing scsi-mq support for zoned block devices at
the I/O scheduler level with simple modifications of the mq-deadline scheduler.
the modifications are the addition of a per zone write locking mechanism
similar to that implemented in sd_zbc.c for the legacy scsi path. The zone
write locking mechanism is used for the exact same purpose, that is, to limit
writes per zone to at most one request to avoid reordering. The locking context
however changes from that of scsi-sq and is moved to the dispatch_request
method of the scheduler. Within this context, under a spin lock guaranteeing
atomicity against other dispatch contexts, target zones of write requests can
be locked before write requests removal from the scheduler. In effect, this
results in the same behavior as the legacy scsi path. Sequential write ordering
is preserved.

The changes to mq-deadline do not affect regular disks: the same scheduling
behavior is maintained for these. The modification are also optimized to not
lock conventional zones. To do so, additional data is introduced in the
request queue structure so that the low level scsi code can pass upward
information such as the total number of zones and zone types of the device.
The availability of this new data avoids difficulties in accessing this
information from the I/O scheduler initialization method (init_queue() method)
context.

Of note is that patch 15 of this series removes setting mq-deadline as the
default scheduler for block devices with a single hardware queue. The reason for
this is that setting the default scheduler is done very early in the device
initialization sequence, when the disk characteristics are not yet known. This
results in mq-deadline not correctly setting the default zones write locking
behavior nased on the device zoning model. Setting of a default I/O scheduler
can be done easily with udev rules later in the system initialization process,
leading to correct default settings for zoned block devices.

Comments are as always very much appreciated.

Changes from v3:
* Integrated support directly into mq-deadline instead of creating a new I/O
  scheduler.
* Disable setting of default mq scheduler for single queue devices

Changes from v2:
* Introduced blk_zoned structure
* Moved I/O scheduler from drivers/scsi to block 

Changes from v1:
* Addressed Bart's comments for the blk-mq patches (declarations files)
* Split (former) patch 4 into multiple patches to facilitate review
* Fixed scsi disk lookup from io scheduler by introducing
  scsi_disk_from_queue()

Damien Le Moal (12):
  block: Fix declaration of blk-mq debugfs functions
  block: Fix declaration of blk-mq scheduler functions
  block: Add zoned block device information to request queue
  scsi: sd_zbc: Move ZBC declarations to scsi_proto.h
  scsi: sd_zbc: Fix comments and indentation
  scsi: sd_zbc: Rearrange code
  scsi: sd_zbc: Use well defined macros
  scsi: sd_zbc: Fix sd_zbc_read_zoned_characteristics()
  scsi: sd_zbc: Initialize device queue zoned structure
  scsi: sd_zbc: Limit zone write locking to sequential zones
  scsi: sd_zbc: Disable zone write locking with scsi-mq
  block: Introduce zoned I/O scheduler

 Documentation/block/zoned-iosched.txt |  48 ++
 block/Kconfig.iosched                 |  12 +
 block/Makefile                        |   1 +
 block/blk-mq-debugfs.h                |  14 +-
 block/blk-mq-sched.h                  |  11 +-
 block/zoned-iosched.c                 | 925 ++++++++++++++++++++++++++++++++++
 drivers/scsi/scsi_lib.c               |   5 +-
 drivers/scsi/sd_zbc.c                 | 267 +++++++---
 include/linux/blk-mq-debugfs.h        |  23 +
 include/linux/blk-mq-sched.h          |  14 +
 include/linux/blkdev.h                |  24 +
 include/scsi/scsi_proto.h             |  45 +-
 12 files changed, 1283 insertions(+), 106 deletions(-)
 create mode 100644 Documentation/block/zoned-iosched.txt
 create mode 100644 block/zoned-iosched.c
 create mode 100644 include/linux/blk-mq-debugfs.h
 create mode 100644 include/linux/blk-mq-sched.h

-- 
2.13.5






*** BLURB HERE ***

Damien Le Moal (16):
  scsi: sd_zbc: Move ZBC declarations to scsi_proto.h
  scsi: sd_zbc: Fix comments and indentation
  scsi: sd_zbc: Rearrange code
  scsi: sd_zbc: Use well defined macros
  scsi: sd_zbc: Fix sd_zbc_read_zoned_characteristics()
  block: Add zoned block device information to request queue
  scsi: sd_zbc: Initialize device request queue zoned data
  scsi: sd_zbc: Limit zone write locking to sequential zones
  scsi: sd_zbc: Disable zone write locking with scsi-mq
  block: mq-deadline: Add zoned block device data
  block: mq-deadline: Introduce zones_wlock attribute
  blokc: mq-deadline: Introduce dispatch helpers
  block: mq-deadline: Introduce zone locking support
  block: mq-deadline: Limit write dispatch for zoned block devices
  block: do not set mq defaulte scheduler
  block: mq-deadline: Update documentation

 Documentation/block/deadline-iosched.txt |  17 ++
 block/elevator.c                         |  17 +-
 block/mq-deadline.c                      | 302 +++++++++++++++++++++++++++-
 drivers/scsi/scsi_lib.c                  |   5 +-
 drivers/scsi/sd_zbc.c                    | 325 ++++++++++++++++++++++++-------
 include/linux/blkdev.h                   |  48 +++++
 include/scsi/scsi_proto.h                |  45 +++--
 7 files changed, 656 insertions(+), 103 deletions(-)

-- 
2.13.5

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-09-24 16:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-24 16:33 [PATCH V4 00/16] scsi-mq support for ZBC disks Damien Le Moal
  -- strict thread matches above, loose matches on Subject: below --
2017-09-24  7:02 Damien Le Moal
2017-09-24 15:02 ` Christoph Hellwig
2017-09-24 16:36   ` Damien Le Moal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.