Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 74AFCC47DB3 for ; Wed, 31 Jan 2024 13:04:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=N4sYla1a0QtG7XOpUQix+TE2gZLQu9Wmvb54FRTzyAU=; b=gXOz+n40i+yH+W9zOI5aUUqCQh WRdAziCkZhgJ/uL5TJbwmDBgNgJh66ui5N+VSauJeRW9Ibw1Rlvf9Lc5lCJc8ZJaVHCatYgzm3d86 QGHzpC6jjQXhmt2jfY1w3YZO5IB8EmFj9SqhfFxYMPoTkBzCGfji8aHfbuTZtoFU3dgvQ1MD832z4 iA18RYkTR4M+xDZKDWzuc3h6xD1sg3pKQZV7HaTtGyIWJquIxKoIpOCbCD54dT+rbfDD1ZSIfTian Bm+J96Zt4fnpZEpuUmMTfYJQaaklJzXKven1y/bV9nM+U/XOb1kh9mg/T/OI6AdPEIXq9QH9mZTZG zvm5LKHw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVAG8-00000003V26-46OG; Wed, 31 Jan 2024 13:04:08 +0000 Received: from 2a02-8389-2341-5b80-39d3-4735-9a3c-88d8.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:39d3:4735:9a3c:88d8] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVAG5-00000003V0b-2xvn; Wed, 31 Jan 2024 13:04:06 +0000 From: Christoph Hellwig 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@vger.kernel.org, linux-nvme@lists.infradead.org, virtualization@lists.linux.dev Subject: atomic queue limits updates v3 Date: Wed, 31 Jan 2024 14:03:46 +0100 Message-Id: <20240131130400.625836-1-hch@lst.de> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-nvme" Errors-To: linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org 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 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 | 31 ++- block/blk-mq.c | 26 +-- block/blk-settings.c | 213 ++++++++++++++++++++++++- block/blk-sysfs.c | 59 +++---- block/blk.h | 3 block/bsg-lib.c | 2 block/genhd.c | 4 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, 526 insertions(+), 296 deletions(-)