linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* atomic queue limits updates v5
@ 2024-02-13  7:34 Christoph Hellwig
  2024-02-13  7:34 ` [PATCH 01/15] block: move max_{open,active}_zones to struct queue_limits Christoph Hellwig
                   ` (15 more replies)
  0 siblings, 16 replies; 24+ messages in thread
From: Christoph Hellwig @ 2024-02-13  7:34 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Michael S. Tsirkin, Jason Wang, Xuan Zhuo, Paolo Bonzini,
	Stefan Hajnoczi, Martin K. Petersen, Damien Le Moal, Keith Busch,
	Sagi Grimberg, linux-block, linux-nvme, virtualization

Hi Jens,

currently queue limits updates are a mess in that they are updated one
limit at a time, which makes both cross-checking them against other
limits hard, and also makes it hard to provide atomicy.

This series tries to change this by updating the whole set of queue
limits atomically.   This in done in two ways:

 - for the initial setup the queue_limits structure is simply passed to
   the queue/disk allocation helpers and applies there after validation.
 - for the (relatively few) cases that update limits at runtime a pair
   of helpers to take a snapshot of the current limits and to commit it
   after picking up the callers changes are provided.

As the series is big enough it only converts two drivers - virtio_blk as
a heavily used driver in virtualized setups, and loop as one that actually
does runtime updates while being fairly simple.  I plan to update most
drivers for this merge window, although SCSI will probably have to wait
for the next one given that it will need extensive API changes in the
LLDD and ULD interfaces.

Chances since v4:
 - fix a newly added bisection hazard
 - fix a comment
 - moar SECTOR_SIZE

Chances since v3:
 - fix a max_user_discard_sectors bisection hazard
 - fix the max_user_discard_sectors initialization for the new API.
   This led to some major refactoring, so there is a new patch and
   I've dropped the reviews for two existing ones that have major
   modifications

Chances since v2:
 - fix the physical block size default
 - use PAGE_SECTORS_SHIFT more 

Chances since v1:
 - remove a spurious NULL return in blk_alloc_queue
 - keep the existing max_discard_sectors == 0 behavior
 - drop the patch nvme discard limit update hack - it will go into
   the series updating nvme instead
 - drop a chunk_sector check
 - use PAGE_SECTORS in a few places
 - document the checks and defaults in blk_validate_limits
 - various spelling fixes

Diffstat:
 arch/um/drivers/ubd_kern.c          |    2 
 block/blk-core.c                    |   27 ++-
 block/blk-mq.c                      |   27 +--
 block/blk-settings.c                |  276 +++++++++++++++++++++++++++------
 block/blk-sysfs.c                   |   59 +++----
 block/blk.h                         |    4 
 block/bsg-lib.c                     |    2 
 block/genhd.c                       |    5 
 drivers/block/amiflop.c             |    2 
 drivers/block/aoe/aoeblk.c          |    2 
 drivers/block/ataflop.c             |    2 
 drivers/block/floppy.c              |    2 
 drivers/block/loop.c                |   75 ++++-----
 drivers/block/mtip32xx/mtip32xx.c   |    2 
 drivers/block/nbd.c                 |    2 
 drivers/block/null_blk/main.c       |    2 
 drivers/block/ps3disk.c             |    2 
 drivers/block/rbd.c                 |    2 
 drivers/block/rnbd/rnbd-clt.c       |    2 
 drivers/block/sunvdc.c              |    2 
 drivers/block/swim.c                |    2 
 drivers/block/swim3.c               |    2 
 drivers/block/ublk_drv.c            |    2 
 drivers/block/virtio_blk.c          |  299 ++++++++++++++++++------------------
 drivers/block/xen-blkfront.c        |    2 
 drivers/block/z2ram.c               |    2 
 drivers/cdrom/gdrom.c               |    2 
 drivers/memstick/core/ms_block.c    |    2 
 drivers/memstick/core/mspro_block.c |    2 
 drivers/mmc/core/queue.c            |    2 
 drivers/mtd/mtd_blkdevs.c           |    2 
 drivers/mtd/ubi/block.c             |    2 
 drivers/nvme/host/apple.c           |    2 
 drivers/nvme/host/core.c            |    8 
 drivers/s390/block/dasd_genhd.c     |    2 
 drivers/s390/block/scm_blk.c        |    2 
 drivers/scsi/scsi_scan.c            |    2 
 drivers/ufs/core/ufshcd.c           |    2 
 include/linux/blk-mq.h              |   10 -
 include/linux/blkdev.h              |   36 +++-
 40 files changed, 547 insertions(+), 337 deletions(-)

^ permalink raw reply	[flat|nested] 24+ messages in thread
* atomic queue limits updates v4
@ 2024-02-12  6:45 Christoph Hellwig
  2024-02-12  6:45 ` [PATCH 04/15] block: add an API to atomically update queue limits Christoph Hellwig
  0 siblings, 1 reply; 24+ messages in thread
From: Christoph Hellwig @ 2024-02-12  6:45 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Michael S. Tsirkin, Jason Wang, Xuan Zhuo, Paolo Bonzini,
	Stefan Hajnoczi, Martin K. Petersen, Damien Le Moal, Keith Busch,
	Sagi Grimberg, linux-block, linux-nvme, virtualization

Hi Jens,

currently queue limits updates are a mess in that they are updated one
limit at a time, which makes both cross-checking them against other
limits hard, and also makes it hard to provide atomicy.

This series tries to change this by updating the whole set of queue
limits atomically.   This in done in two ways:

 - for the initial setup the queue_limits structure is simply passed to
   the queue/disk allocation helpers and applies there after validation.
 - for the (relatively few) cases that update limits at runtime a pair
   of helpers to take a snapshot of the current limits and to commit it
   after picking up the callers changes are provided.

As the series is big enough it only converts two drivers - virtio_blk as
a heavily used driver in virtualized setups, and loop as one that actually
does runtime updates while being fairly simple.  I plan to update most
drivers for this merge window, although SCSI will probably have to wait
for the next one given that it will need extensive API changes in the
LLDD and ULD interfaces.

Chances since v3:
 - fix a max_user_discard_sectors bisection hazard
 - fix the max_user_discard_sectors initialization for the new API.
   This led to some major refactoring, so there is a new patch and
   I've dropped the reviews for two existing ones that have major
   modifications

Chances since v2:
 - fix the physical block size default
 - use PAGE_SECTORS_SHIFT more 

Chances since v1:
 - remove a spurious NULL return in blk_alloc_queue
 - keep the existing max_discard_sectors == 0 behavior
 - drop the patch nvme discard limit update hack - it will go into
   the series updating nvme instead
 - drop a chunk_sector check
 - use PAGE_SECTORS in a few places
 - document the checks and defaults in blk_validate_limits
 - various spelling fixes

Diffstat:
 arch/um/drivers/ubd_kern.c          |    2 
 block/blk-core.c                    |   27 ++-
 block/blk-mq.c                      |   27 +--
 block/blk-settings.c                |  276 +++++++++++++++++++++++++++------
 block/blk-sysfs.c                   |   59 +++----
 block/blk.h                         |    4 
 block/bsg-lib.c                     |    2 
 block/genhd.c                       |    5 
 drivers/block/amiflop.c             |    2 
 drivers/block/aoe/aoeblk.c          |    2 
 drivers/block/ataflop.c             |    2 
 drivers/block/floppy.c              |    2 
 drivers/block/loop.c                |   75 ++++-----
 drivers/block/mtip32xx/mtip32xx.c   |    2 
 drivers/block/nbd.c                 |    2 
 drivers/block/null_blk/main.c       |    2 
 drivers/block/ps3disk.c             |    2 
 drivers/block/rbd.c                 |    2 
 drivers/block/rnbd/rnbd-clt.c       |    2 
 drivers/block/sunvdc.c              |    2 
 drivers/block/swim.c                |    2 
 drivers/block/swim3.c               |    2 
 drivers/block/ublk_drv.c            |    2 
 drivers/block/virtio_blk.c          |  299 ++++++++++++++++++------------------
 drivers/block/xen-blkfront.c        |    2 
 drivers/block/z2ram.c               |    2 
 drivers/cdrom/gdrom.c               |    2 
 drivers/memstick/core/ms_block.c    |    2 
 drivers/memstick/core/mspro_block.c |    2 
 drivers/mmc/core/queue.c            |    2 
 drivers/mtd/mtd_blkdevs.c           |    2 
 drivers/mtd/ubi/block.c             |    2 
 drivers/nvme/host/apple.c           |    2 
 drivers/nvme/host/core.c            |    8 
 drivers/s390/block/dasd_genhd.c     |    2 
 drivers/s390/block/scm_blk.c        |    2 
 drivers/scsi/scsi_scan.c            |    2 
 drivers/ufs/core/ufshcd.c           |    2 
 include/linux/blk-mq.h              |   10 -
 include/linux/blkdev.h              |   36 +++-
 40 files changed, 547 insertions(+), 337 deletions(-)

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

end of thread, other threads:[~2024-07-26 20:48 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-13  7:34 atomic queue limits updates v5 Christoph Hellwig
2024-02-13  7:34 ` [PATCH 01/15] block: move max_{open,active}_zones to struct queue_limits Christoph Hellwig
2024-02-13  7:34 ` [PATCH 02/15] block: refactor disk_update_readahead Christoph Hellwig
2024-02-13  7:34 ` [PATCH 03/15] block: decouple blk_set_stacking_limits from blk_set_default_limits Christoph Hellwig
2024-02-13  7:34 ` [PATCH 04/15] block: add an API to atomically update queue limits Christoph Hellwig
2024-02-13 12:00   ` Hannes Reinecke
2024-07-26 20:48   ` Christian Lamparter
2024-02-13  7:34 ` [PATCH 05/15] block: use queue_limits_commit_update in queue_max_sectors_store Christoph Hellwig
2024-02-13  7:34 ` [PATCH 06/15] block: add a max_user_discard_sectors queue limit Christoph Hellwig
2024-02-13  7:34 ` [PATCH 07/15] block: use queue_limits_commit_update in queue_discard_max_store Christoph Hellwig
2024-02-13  7:34 ` [PATCH 08/15] block: pass a queue_limits argument to blk_alloc_queue Christoph Hellwig
2024-02-13 12:01   ` Hannes Reinecke
2024-02-13  7:34 ` [PATCH 09/15] block: pass a queue_limits argument to blk_mq_init_queue Christoph Hellwig
2024-02-13  7:34 ` [PATCH 10/15] block: pass a queue_limits argument to blk_mq_alloc_disk Christoph Hellwig
2024-02-13  7:34 ` [PATCH 11/15] virtio_blk: split virtblk_probe Christoph Hellwig
2024-02-13  7:34 ` [PATCH 12/15] virtio_blk: pass queue_limits to blk_mq_alloc_disk Christoph Hellwig
2024-02-13  7:34 ` [PATCH 13/15] loop: cleanup loop_config_discard Christoph Hellwig
2024-02-13  7:34 ` [PATCH 14/15] loop: pass queue_limits to blk_mq_alloc_disk Christoph Hellwig
2024-02-13  7:34 ` [PATCH 15/15] loop: use the atomic queue limits update API Christoph Hellwig
2024-02-13 15:57 ` atomic queue limits updates v5 Jens Axboe
  -- strict thread matches above, loose matches on Subject: below --
2024-02-12  6:45 atomic queue limits updates v4 Christoph Hellwig
2024-02-12  6:45 ` [PATCH 04/15] block: add an API to atomically update queue limits Christoph Hellwig
2024-02-12  7:24   ` Damien Le Moal
2024-02-12  7:29     ` Christoph Hellwig
2024-02-12  7:31   ` Hannes Reinecke

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).