From patchwork Thu Nov 26 23:45:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Klaus Jensen X-Patchwork-Id: 11934923 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4670FC63798 for ; Thu, 26 Nov 2020 23:49:27 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AD9AB21D91 for ; Thu, 26 Nov 2020 23:49:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AD9AB21D91 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=irrelevant.dk Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:48086 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kiR0v-0000mo-5j for qemu-devel@archiver.kernel.org; Thu, 26 Nov 2020 18:49:25 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55748) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kiQxq-0007Ol-EL; Thu, 26 Nov 2020 18:46:14 -0500 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:56235) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kiQxj-0003s4-C9; Thu, 26 Nov 2020 18:46:14 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 919BC5C01FE; Thu, 26 Nov 2020 18:46:05 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 26 Nov 2020 18:46:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irrelevant.dk; h=from:to:cc:subject:date:message-id:content-type:mime-version :content-transfer-encoding; s=fm1; bh=RVwrI04kwWNF8+JObBC8exJRrx jwURAWhpAEP5Z9qqk=; b=V+wIZKn+le2vO02v71dsLuydOO+kR0CaUzJM5+qJkd cIYgxlLJRRMcez8Wu3gy3DJczkBxd26V0flDD2NiDJbBej34MlL1qFV3azurUlYr SCTf444AEiXutOPoJvEgjhCBJps3iieRaJL0f0DstSCRf2GQOvSJYhCiUfg8pJGc LtBjk+AqHamk9EDLVOgREEmKz329Hn0rgNsbEC3OyIBcH3mYsO/z1TihFeNCI09D hS+7kV7m4JdFiso8FMyWaSVJA4NJNcFSBuhqy2yPStf6n3oJRGFT/+Bc8NRyu0be xGnAcycozynHwQp+BR7OHCzIZA/pT0vap+bx244LX8Ig== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=RVwrI0 4kwWNF8+JObBC8exJRrxjwURAWhpAEP5Z9qqk=; b=OIHRXj0RhofVR4PXCOR2Zu QSwqGbwgJxhszzyQtH9zZdMH9s+oBkYxbfcRbNj6S3DKwCYKZSJvY7q0RfzxTAPM 2dIM1kK8wCzn0wSsQcTD2P9CU9MFgOqhgZ0WCDQscspWvFEkbyhRS/SQ3wmyDhES wlyoIvJ+hxWwenHgxdTP8qnBXhJKKojmMVVum5Myl1wlEllcvjHASizklksqfPEi OPUXGmL7Olq1ohseNWmmXJisso4UNVsQl7p6B4MvvnkLjgdrbkLtlRbyrpwvoJzg 2mYf56URbnK3d1bqjFr/MHr0oM3vRnoeu57oG1IjYjgZeIgCWe8lcMZPAxQjaNgw == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrudehfedguddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffotggggfesthhqredtredtjeenucfhrhhomhepmfhlrghushcu lfgvnhhsvghnuceoihhtshesihhrrhgvlhgvvhgrnhhtrdgukheqnecuggftrfgrthhtvg hrnhepheegheeukeetjeduvdefkedvudduhedtjedttedugeejgeevhfekvedtvdeuffel necuffhomhgrihhnpehirhhrvghlvghvrghnthdrughknecukfhppeektddrudeijedrle ekrdduledtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhho mhepihhtshesihhrrhgvlhgvvhgrnhhtrdgukh X-ME-Proxy: Received: from apples.local (80-167-98-190-cable.dk.customer.tdc.net [80.167.98.190]) by mail.messagingengine.com (Postfix) with ESMTPA id 3C85A3064AAE; Thu, 26 Nov 2020 18:46:03 -0500 (EST) From: Klaus Jensen To: qemu-devel@nongnu.org Subject: [PATCH v5 00/12] hw/block/nvme: zoned namespace command set Date: Fri, 27 Nov 2020 00:45:49 +0100 Message-Id: <20201126234601.689714-1-its@irrelevant.dk> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Received-SPF: pass client-ip=66.111.4.27; envelope-from=its@irrelevant.dk; helo=out3-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Fam Zheng , qemu-block@nongnu.org, Klaus Jensen , Max Reitz , Keith Busch , Stefan Hajnoczi , Klaus Jensen Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Klaus Jensen Oi, Things seem to have slowed down a bit on the zoned front, so in the interest of moving things forward and catalyzing the process, I'm posting a v5 of my series (v4 never got posted, but it's in my repo for posterity, see below). I picked some preparatory patches from Dmitry and rebased on that. These patches apply on top of the "pmr/cmb coexist", "compare" and "simple copy" series that I've posted previously. An applied version is available here: https://irrelevant.dk/g/pci-nvme.git/tag/?h=zoned-v5 Changed for v5 ~~~~~~~~~~~~~~ * Rebased to work with the DULBE support, recently merged in nvme-next. * "hw/block/nvme: Separate read and write handlers" * "hw/block/nvme: Merge nvme_write_zeroes() with nvme_write()" * "hw/block/nvme: Generate namespace UUIDs" - Picked from Dmitry' series. * "hw/block/nvme: add commands supported and effects log page" * "hw/block/nvme: support namespace types" - Refactored and cribbed Keith's approach to CSE from the kb-zns branch and getting rid of the ugly macro initializers. * "hw/block/nvme: add persistence for zone info" - Marked RFC for obvious reasons. Changes for v4 ~~~~~~~~~~~~~~ * "hw/block/nvme: add the zone management send command" - Use a pwrite_zeroes for zone reset instead of a discard. Changes for v3 ~~~~~~~~~~~~~~ * Rebased on nvme-next with "[PATCH v2] hw/block/nvme: add dulbe support" applied. * "hw/block/nvme: add support for dulbe and block utilization tracking" - Dropped from this series. This series instead builds on the support for DULBE that I added in "[PATCH v2] hw/block/nvme: add dulbe support", previously posted. * "hw/block/nvme: add the zone management send command" - Use asynchronous discards. * "hw/block/nvme: add basic read/write for zoned namespaces" * "hw/block/nvme: add the zone management receive command" * "hw/block/nvme: add the zone management send command" * "hw/block/nvme: add the zone append command" * "hw/block/nvme: track and enforce zone resources" * "hw/block/nvme: allow open to close zone transitions by controller" - In compliance with the concensus I dropped zone persistence support from all patches. Changes for v2 ~~~~~~~~~~~~~~ * "hw/block/nvme: add support for dulbe and block utilization tracking" - Factor out pstate init/load into separate functions. - Fixed a stupid off-by-1 bug that would trigger when resetting the last zone. - I added a more formalized pstate file format that includes a header. This is pretty similar to what is done in Dmitry's series, but with fewer fields. The device parameters for nvme-ns are still the "authoritative" ones, so if any parameters that influence LBA size, number of zones, etc. do not match, an error indicating the discrepancy will be produced. IIRC, Dmitry's version does the same. It is set up such that newer versions can load pstate files from older versions. The file format header is not unlike a standard nvme datastructure with reserved areas. This means that when adding new command sets that require persistent state, it is not needed to bump the version number, unless the header has to change dramatically. This is demonstrated when the zoned namespace command set support is added in "hw/block/nvme: add basic read/write for zoned namespaces". * "hw/block/nvme: add basic read/write for zoned namespaces" - The device will now transition all opened zones to Closed on "normal shutdown". You can force the "transition to Full" behavior by killing QEMU from the monitor. * "hw/block/nvme: add the zone append command" - Slightly reordered the logic so a LBA Out of Range error is returned before Invalid Field in Command for normal read/write commands. * "hw/block/nvme: support zone active excursions" - Dropped. Optional and non-critical. * "hw/block/nvme: support reset/finish recommended limits" - Dropped. Optional and non-critical. Dmitry Fomichev (3): hw/block/nvme: Separate read and write handlers hw/block/nvme: Merge nvme_write_zeroes() with nvme_write() hw/block/nvme: Generate namespace UUIDs Gollu Appalanaidu (1): hw/block/nvme: add commands supported and effects log page Klaus Jensen (8): hw/block/nvme: support namespace types hw/block/nvme: add basic read/write for zoned namespaces hw/block/nvme: add the zone management receive command hw/block/nvme: add the zone management send command hw/block/nvme: add the zone append command hw/block/nvme: track and enforce zone resources hw/block/nvme: allow open to close zone transitions by controller hw/block/nvme: add persistence for zone info docs/specs/nvme.txt | 32 + hw/block/nvme-ns.h | 127 +++- hw/block/nvme.h | 10 + include/block/nvme.h | 218 +++++- block/nvme.c | 4 +- hw/block/nvme-ns.c | 341 ++++++++- hw/block/nvme.c | 1613 ++++++++++++++++++++++++++++++++++++++--- hw/block/trace-events | 35 +- 8 files changed, 2246 insertions(+), 134 deletions(-)