From mboxrd@z Thu Jan 1 00:00:00 1970 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.subspace.kernel.org (Postfix) with ESMTPS id 5F8EF1B294 for ; Fri, 15 Sep 2023 21:33:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=klgxghukoLB077BcGmD37gwuwN5TiuVyvr8uJe/6qJU=; b=xTeTtvE1PB+sCk5jYN9CsRNDcC oq2rbg1f2LevVKTppTb9rvS7a6d9knnti9jQdDdUKPFipV/7xRYRi9bXw1loPY9YRQLYncMi0eTH0 eSA7OvBPVYDjb/pTBadQaMypikILS+6vmRakqpcosKTLfq6mA5A9nT5TFdX/6+BWkToM79mGvZ7C/ tfJjEHFIAWrCbPalQvlsnGYZpiYB2i4a7P6av3qMHhcJxJ08e6/CKkcCSA5aVBYA0JrWxd6Hx1R0v HvwVgB8hOjoe2H7UeTLiZRP+Ab6e+CWQp+OvTodpFSnvw6ER3Zk057IRQNPe4YstyGZWoX/Y8EDtM kClVBvPA==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1qhGQq-00BQna-1Y; Fri, 15 Sep 2023 21:32:56 +0000 From: Luis Chamberlain To: hch@infradead.org, djwong@kernel.org, dchinner@redhat.com, kbusch@kernel.org, sagi@grimberg.me, axboe@fb.com Cc: willy@infradead.org, brauner@kernel.org, hare@suse.de, ritesh.list@gmail.com, rgoldwyn@suse.com, jack@suse.cz, ziy@nvidia.com, ryan.roberts@arm.com, patches@lists.linux.dev, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, p.raghav@samsung.com, da.gomez@samsung.com, dan.helmick@samsung.com, mcgrof@kernel.org Subject: [RFC v2 09/10] nvme: add nvme_core.debug_large_atomics to force high awun as phys_bs Date: Fri, 15 Sep 2023 14:32:53 -0700 Message-Id: <20230915213254.2724586-10-mcgrof@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230915213254.2724586-1-mcgrof@kernel.org> References: <20230915213254.2724586-1-mcgrof@kernel.org> Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Luis Chamberlain A drive with atomic write support should have awun / nawun defined, for these drives it should be possible to play with and experiment safely with LBS support up to awun / nawun settings if you are completely ignoring power failure situations. Add support to experiment with this. The rationale to limit to awun / nawun is to avoid races with other on flight commands which otherwise could cause unexpected results. This also means this debug module parameter feature is not supported if your drive does not support atomics / awun / nawun. Suggested-by: Dan Helmick Signed-off-by: Luis Chamberlain --- drivers/nvme/host/core.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 7a3c51ac13bd..c1f9d8e3ea93 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -92,6 +92,10 @@ static bool debug_large_lbas; module_param(debug_large_lbas, bool, 0644); MODULE_PARM_DESC(debug_large_lbas, "allow LBAs > PAGE_SIZE"); +static unsigned int debug_large_atomics; +module_param(debug_large_atomics, uint, 0644); +MODULE_PARM_DESC(debug_large_atomics, "allow large atomics <= awun or nawun <= mdts"); + /* * nvme_wq - hosts nvme related works that are not reset or delete * nvme_reset_wq - hosts nvme reset works @@ -1958,6 +1962,20 @@ static void nvme_update_disk_info(struct gendisk *disk, * be aware of out of order reads/writes as npwg and nows * are purely performance optimizations. */ + + /* + * If you're not concerned about power failure, in theory, + * you should be able to experiment up to awun rather safely. + * + * Ignore qemu awun value of 1. + */ + if (debug_large_atomics && awun != 1) { + debug_large_atomics = min(awun_bs, debug_large_atomics); + phys_bs = atomic_bs = debug_large_atomics; + dev_info(ns->ctrl->device, + "Forcing large atomic: %u (awun_bs: %u awun: %u)\n", + debug_large_atomics, awun_bs, awun); + } } blk_queue_logical_block_size(disk->queue, bs); -- 2.39.2