qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Sam Li <faithilikerun@gmail.com>
To: qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, "Kevin Wolf" <kwolf@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	stefanha@redhat.com, "Peter Xu" <peterx@redhat.com>,
	"David Hildenbrand" <david@redhat.com>,
	dmitry.fomichev@wdc.com, hare@suse.de,
	"Hanna Reitz" <hreitz@redhat.com>,
	"Eric Blake" <eblake@redhat.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	dlemoal@kernel.org, "Keith Busch" <kbusch@kernel.org>,
	"Klaus Jensen" <its@irrelevant.dk>,
	"Sam Li" <faithilikerun@gmail.com>,
	"Klaus Jensen" <k.jensen@samsung.com>
Subject: [RFC v3 0/7] Add persistence to NVMe ZNS emulation
Date: Mon, 22 Jan 2024 20:00:06 +0100	[thread overview]
Message-ID: <20240122190013.41302-1-faithilikerun@gmail.com> (raw)

ZNS emulation follows NVMe ZNS spec but the state of namespace
zones does not persist accross restarts of QEMU. This patch makes the
metadata of ZNS emulation persistent by using new block layer APIs and
the qcow2 img as backing file. It is the second part after the patches
- adding full zoned storage emulation to qcow2 driver [v7]

The metadata of ZNS emulation divides into two parts, zone metadata and
zone descriptor extension data. The zone metadata is composed of zone
states, zone type, wp and zone attributes. The zone information can be
stored at an uint64_t wp to save space and easy access. The structure of
wp of each zone is as follows:
|0000(4)| zone type (1)| zone attr (8)| wp (51) ||

The zone descriptor extension data is relatively small comparing to the
overall size therefore we adopt the option that store zded of all zones
in an array regardless of the valid bit set.

Creating a zns format qcow2 image file adds one more option zd_extension_size
to zoned device configurations.

For a closer look, you can apply the zns patches on this branch:
https://github.com/sgzerolc/qemu/tree/dev-qcow2-v7
Or use the local zns branch directly:
https://github.com/sgzerolc/qemu/tree/dev-zns-v7

To attach this file as emulated zns drive in the command line of QEMU, use:
  -drive file=${znsimg},id=nvmezns0,format=qcow2,if=none \
  -device nvme-ns,drive=nvmezns0,bus=nvme0,nsid=1,uuid=xxx \

Acked-by: Klaus Jensen <k.jensen@samsung.com>

---

v2->v3:
- fix compatability issue with the qcow2 patch series [Markus]
- address review comments [Markus]

v1->v2:
- split [v1 2/5] patch to three (doc, config, block layer API)
- adapt qcow2 v6

Sam Li (7):
  docs/qcow2: add zd_extension_size option to the zoned format feature
  qcow2: add zd_extension configurations to zoned metadata
  hw/nvme: use blk_get_*() to access zone info in the block layer
  hw/nvme: add blk_get_zone_extension to access zd_extensions
  hw/nvme: make the metadata of ZNS emulation persistent
  hw/nvme: refactor zone append write using block layer APIs
  hw/nvme: make ZDED persistent

 block/block-backend.c             |   88 ++
 block/qcow2.c                     |  120 ++-
 block/qcow2.h                     |    2 +
 docs/interop/qcow2.txt            |    9 +
 hw/nvme/ctrl.c                    | 1246 ++++++++---------------------
 hw/nvme/ns.c                      |  162 +---
 hw/nvme/nvme.h                    |   95 +--
 include/block/block-common.h      |    9 +
 include/block/block_int-common.h  |    8 +
 include/sysemu/block-backend-io.h |   11 +
 include/sysemu/dma.h              |    3 +
 qapi/block-core.json              |    4 +
 system/dma-helpers.c              |   17 +
 13 files changed, 648 insertions(+), 1126 deletions(-)

-- 
2.40.1



             reply	other threads:[~2024-01-22 19:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-22 19:00 Sam Li [this message]
2024-01-22 19:00 ` [RFC v3 1/7] docs/qcow2: add zd_extension_size option to the zoned format feature Sam Li
2024-01-22 19:00 ` [RFC v3 2/7] qcow2: add zd_extension configurations to zoned metadata Sam Li
2024-01-22 19:00 ` [RFC v3 3/7] hw/nvme: use blk_get_*() to access zone info in the block layer Sam Li
2024-01-22 19:00 ` [RFC v3 4/7] hw/nvme: add blk_get_zone_extension to access zd_extensions Sam Li
2024-01-22 19:00 ` [RFC v3 5/7] hw/nvme: make the metadata of ZNS emulation persistent Sam Li
2024-01-22 19:00 ` [RFC v3 6/7] hw/nvme: refactor zone append write using block layer APIs Sam Li
2024-01-22 19:00 ` [RFC v3 7/7] hw/nvme: make ZDED persistent Sam Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240122190013.41302-1-faithilikerun@gmail.com \
    --to=faithilikerun@gmail.com \
    --cc=armbru@redhat.com \
    --cc=david@redhat.com \
    --cc=dlemoal@kernel.org \
    --cc=dmitry.fomichev@wdc.com \
    --cc=eblake@redhat.com \
    --cc=hare@suse.de \
    --cc=hreitz@redhat.com \
    --cc=its@irrelevant.dk \
    --cc=k.jensen@samsung.com \
    --cc=kbusch@kernel.org \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).