Re: [PATCH 2/2] virtio-blk: Ensure no requests in virtqueues before deleting vqs.

2024-01-23 Thread yi sun
Yes, I'm using virtio-mmio. On Tue, Jan 23, 2024 at 11:09 PM Stefan Hajnoczi wrote: > > Hi Michael, > This could potentially affect other VIRTIO drivers too. Please see > below. > > On Tue, Jan 23, 2024 at 11:27:40AM +0800, yi sun wrote: > > On Mon, Jan 22, 2024 at 11:43 PM Stefan Hajnoczi > >

Re: [PATCH 15/15] loop: use the atomic queue limits update API

2024-01-23 Thread Hannes Reinecke
On 1/22/24 18:36, Christoph Hellwig wrote: Pass the default limits to blk_mq_alloc_disk and then use the queue_limits_{start,commit}_update API to change the limits in an atomic way on existing loop gendisks. Signed-off-by: Christoph Hellwig --- drivers/block/loop.c | 41 +

Re: [PATCH 14/15] loop: pass queue_limits to blk_mq_alloc_disk

2024-01-23 Thread Hannes Reinecke
On 1/22/24 18:36, Christoph Hellwig wrote: Pass the max_hw_sector limit loop sets at initialization time directly to blk_mq_alloc_disk instead of updating it right after the allocation. Signed-off-by: Christoph Hellwig --- drivers/block/loop.c | 11 +++ 1 file changed, 7 insertions(+

Re: [PATCH 13/15] loop: cleanup loop_config_discard

2024-01-23 Thread Hannes Reinecke
On 1/22/24 18:36, Christoph Hellwig wrote: Initialize the local variables for the discard max sectors and granularity to zero as a sensible default, and then merge the calls assigning them to the queue limits. Signed-off-by: Christoph Hellwig --- drivers/block/loop.c | 27

Re: [PATCH 12/15] virtio_blk: pass queue_limits to blk_mq_alloc_disk

2024-01-23 Thread Hannes Reinecke
On 1/22/24 18:36, Christoph Hellwig wrote: Call virtblk_read_limits and most of virtblk_probe_zoned_device before allocating the gendisk and thus request_queue and make them read into a queue_limits structure instead. Pass this initialized queue_limits to blk_mq_alloc_disk to set the queue up wi

Re: [PATCH 11/15] virtio_blk: split virtblk_probe

2024-01-23 Thread Hannes Reinecke
On 1/22/24 18:36, Christoph Hellwig wrote: Split out a virtblk_read_limits helper that just reads the various queue limits to separate it from the higher level probing logic. Signed-off-by: Christoph Hellwig --- drivers/block/virtio_blk.c | 193 +++-- 1 file c

Re: [PATCH 10/15] block: pass a queue_limits argument to blk_mq_alloc_disk

2024-01-23 Thread Hannes Reinecke
On 1/22/24 18:36, Christoph Hellwig wrote: Pass a queue_limits to blk_mq_alloc_disk and apply it if non-NULL. This will allow allocating queues with valid queue limits instead of setting the values one at a time later. Signed-off-by: Christoph Hellwig --- arch/um/drivers/ubd_kern.c

Re: [PATCH 09/15] block: pass a queue_limits argument to blk_mq_init_queue

2024-01-23 Thread Hannes Reinecke
On 1/22/24 18:36, Christoph Hellwig wrote: Pass a queue_limits to blk_mq_init_queue and apply it if non-NULL. This will allow allocating queues with valid queue limits instead of setting the values one at a time later. Also rename the function to blk_mq_alloc_queue as that is a much better name

Re: [PATCH 08/15] block: pass a queue_limits argument to blk_alloc_queue

2024-01-23 Thread Hannes Reinecke
On 1/22/24 18:36, Christoph Hellwig wrote: Pass a queue_limits to blk_alloc_queue and apply it if non-NULL. This will allow allocating queues with valid queue limits instead of setting the values one at a time later. Signed-off-by: Christoph Hellwig --- block/blk-core.c | 28

Re: [PATCH 07/15] block: use queue_limits_commit_update in queue_discard_max_store

2024-01-23 Thread Hannes Reinecke
On 1/22/24 18:36, Christoph Hellwig wrote: Convert queue_discard_max_store to use queue_limits_commit_update to check and updated the max_sectors limit and freeze the queue before doing so to ensure we don't have request in flight while changing the limits. Signed-off-by: Christoph Hellwig ---

Re: [PATCH 06/15] nvme: remove the hack to not update the discard limits in nvme_config_discard

2024-01-23 Thread Hannes Reinecke
On 1/22/24 18:36, Christoph Hellwig wrote: Now that the block layer tracks a separate user max discard limit, there is no need to prevent nvme from updating it on controller capability changes. Signed-off-by: Christoph Hellwig --- drivers/nvme/host/core.c | 10 -- 1 file changed, 10

Re: [PATCH 05/15] block: add a max_user_discard_sectors queue limit

2024-01-23 Thread Hannes Reinecke
On 1/22/24 18:36, Christoph Hellwig wrote: Add a new max_user_discard_sectors limit that mirrors max_user_sectors and stores the value that the user manually set. This now allows updates of the max_hw_discard_sectors to not worry about the user limit. Signed-off-by: Christoph Hellwig --- blo

Re: [PATCH 04/15] block: use queue_limits_commit_update in queue_max_sectors_store

2024-01-23 Thread Hannes Reinecke
On 1/22/24 18:36, Christoph Hellwig wrote: Convert queue_max_sectors_store to use queue_limits_commit_update to check and updated the max_sectors limit and freeze the queue before doing so to ensure we don't have request in flight while changing the limits. Note that this removes the previously

Re: [PATCH 03/15] block: add an API to atomically update queue limits

2024-01-23 Thread Hannes Reinecke
On 1/22/24 18:36, Christoph Hellwig wrote: Add a new queue_limits_{start,commit}_update pair of functions that allows taking an atomic snapshot of queue limits, update it, and commit it if it passes validity checking. Signed-off-by: Christoph Hellwig --- block/blk-core.c | 1 + block

Re: [PATCH 02/15] block: refactor disk_update_readahead

2024-01-23 Thread Hannes Reinecke
On 1/22/24 18:36, Christoph Hellwig wrote: Factor out a blk_apply_bdi_limits limits helper that can be used with an explicit queue_limits argument, which will be useful later. Signed-off-by: Christoph Hellwig --- block/blk-settings.c | 21 - 1 file changed, 12 insertions(

Re: [PATCH 01/15] block: move max_{open,active}_zones to struct queue_limits

2024-01-23 Thread Hannes Reinecke
On 1/22/24 18:36, Christoph Hellwig wrote: The maximum number of open and active zones is a limit on the queue and should be places there so that we can including it in the upcoming queue limits batch update API. Signed-off-by: Christoph Hellwig --- include/linux/blkdev.h | 12 ++--

Re: [PATCH 13/15] loop: cleanup loop_config_discard

2024-01-23 Thread Chaitanya Kulkarni
On 1/22/24 09:36, Christoph Hellwig wrote: > Initialize the local variables for the discard max sectors and > granularity to zero as a sensible default, and then merge the > calls assigning them to the queue limits. > > Signed-off-by: Christoph Hellwig > Looks good. Reviewed-by: Chaitanya Kulkar

Re: [PATCH 11/15] virtio_blk: split virtblk_probe

2024-01-23 Thread Chaitanya Kulkarni
On 1/22/2024 9:36 AM, Christoph Hellwig wrote: > Split out a virtblk_read_limits helper that just reads the various > queue limits to separate it from the higher level probing logic. > > Signed-off-by: Christoph Hellwig > --- Thanks for doing this. Reviewed-by: Chaitanya Kulkarni -ck

Re: [PATCH 1/2] blk-mq: introduce blk_mq_tagset_wait_request_completed()

2024-01-23 Thread Keith Busch
On Mon, Jan 22, 2024 at 07:07:21PM +0800, Yi Sun wrote: > In some cases, it is necessary to wait for all requests to become complete > status before performing other operations. Otherwise, these requests will > never > be processed successfully. > > For example, when the virtio device is in hiber

Re: [PATCH 1/2] blk-mq: introduce blk_mq_tagset_wait_request_completed()

2024-01-23 Thread kernel test robot
Hi Yi, kernel test robot noticed the following build warnings: [auto build test WARNING on axboe-block/for-next] [also build test WARNING on linus/master v6.8-rc1 next-20240123] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use

Re: [PATCH 2/2] virtio-blk: Ensure no requests in virtqueues before deleting vqs.

2024-01-23 Thread Stefan Hajnoczi
Hi Michael, This could potentially affect other VIRTIO drivers too. Please see below. On Tue, Jan 23, 2024 at 11:27:40AM +0800, yi sun wrote: > On Mon, Jan 22, 2024 at 11:43 PM Stefan Hajnoczi wrote: > > > > On Mon, Jan 22, 2024 at 07:07:22PM +0800, Yi Sun wrote: > > > Ensure no remaining request

Re: [PATCH 12/15] virtio_blk: pass queue_limits to blk_mq_alloc_disk

2024-01-23 Thread Stefan Hajnoczi
On Mon, Jan 22, 2024 at 06:36:42PM +0100, Christoph Hellwig wrote: > Call virtblk_read_limits and most of virtblk_probe_zoned_device before > allocating the gendisk and thus request_queue and make them read into > a queue_limits structure instead. Pass this initialized queue_limits > to blk_mq_all

Re: [PATCH 11/15] virtio_blk: split virtblk_probe

2024-01-23 Thread Stefan Hajnoczi
On Mon, Jan 22, 2024 at 06:36:41PM +0100, Christoph Hellwig wrote: > Split out a virtblk_read_limits helper that just reads the various > queue limits to separate it from the higher level probing logic. > > Signed-off-by: Christoph Hellwig > --- > drivers/block/virtio_blk.c | 193 +++

Re: [PATCH 06/15] nvme: remove the hack to not update the discard limits in nvme_config_discard

2024-01-23 Thread Christoph Hellwig
On Tue, Jan 23, 2024 at 02:12:37PM +0900, Damien Le Moal wrote: > > blk_queue_max_discard_sectors(queue, max_discard_sectors); > > This function references max_user_discard_sectors but that access is done > without holding the queue limits mutex. Is that safe ? No. But fixing nvme will be do

Re: [PATCH 03/15] block: add an API to atomically update queue limits

2024-01-23 Thread Christoph Hellwig
On Tue, Jan 23, 2024 at 01:50:32PM +0900, Damien Le Moal wrote: > > + return -EINVAL; > > + return 0; > > + } > > + > > + if (WARN_ON_ONCE(!IS_ENABLED(CONFIG_BLK_DEV_ZONED))) > > + return -EINVAL; > > + > > + if (lim->zone_write_granularity < lim->logical

Re: [PATCH 02/15] block: refactor disk_update_readahead

2024-01-23 Thread Christoph Hellwig
On Tue, Jan 23, 2024 at 01:41:05PM +0900, Damien Le Moal wrote: > > +{ > > + /* > > +* For read-ahead of large files to be effective, we need to read ahead > > +* at least twice the optimal I/O size. > > +*/ > > + bdi->ra_pages = max(lim->io_opt * 2 / PAGE_SIZE, VM_READAHEAD_PAGES);