[PATCH V2 0/4] hw/block/nvme: Implement ZNS finish-zone ZDC AEN

clay.mayers@kioxia.com posted 4 patches 1 year, 6 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20221021231038.1042659-1-clay.mayers@kioxia.com
Maintainers: Keith Busch <kbusch@kernel.org>, Klaus Jensen <its@irrelevant.dk>, Stefan Hajnoczi <stefanha@redhat.com>, Fam Zheng <fam@euphon.net>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>
docs/system/devices/nvme.rst |   5 +
hw/nvme/ctrl.c               | 174 +++++++++++++++++++++++++++++++++--
hw/nvme/ns.c                 |  15 +++
hw/nvme/nvme.h               |  37 +++++++-
hw/nvme/trace-events         |   3 +-
include/block/nvme.h         |  14 ++-
6 files changed, 233 insertions(+), 15 deletions(-)
[PATCH V2 0/4] hw/block/nvme: Implement ZNS finish-zone ZDC AEN
Posted by clay.mayers@kioxia.com 1 year, 6 months ago
From: Clay Mayers <clay.mayers@kioxia.com>

ZNS controllers have the option to limit the time a zone can remain in
the active state.  It begins with a background process in the controller
setting the finish-zone-recommended FZR attribute for a zone.  As part of
setting this attribute, the zone's id is added to the namespace's
zone-descriptor-changed (ZDC) log page. If enabled, items added to the
ZDC log page generate a ZDC "asynchronous event notification" AEN. Optionally,
the control can induce a "zone excursion" forcing the zone into the finished
state that also generates a ZDC event.

Zone enabled applications need to properly handle ZDC events. In a real device,
the timeout is many hours making testing an application difficult.
Implemented is the generation of FZR ZDC events to speed up O/S and application
testing.

Added to the zoned NVMe command set is an optional, per-namespace timer
(zoned.finish_time) to set the FZR attr for long-lived active zones; A per
namespace ZDC log page; AEN results to including CQE.DW1 (the NSID of the ZDC
AEN) and generating a ZDC AEN if it's been enabled. Zone excursions are not
modeled.

See section 5.5 of the NVMe Zoned Namespace Command Set Specification v1.1
for more details.

Changes since v1
- Fixed offset length checking in zdc log page
- Moved zdc_event_queued to the patch 4
- Unwatched zdc events in nvme_exit()

Clay Mayers (4):
  hw/block/nvme: add ZONE_FINISH_RECOMMENDED functionality
  hw/block/nvme: add zone descriptor changed log page
  hw/block/nvme: supply dw1 for aen result
  hw/block/nvme: add zone descriptor changed AEN

 docs/system/devices/nvme.rst |   5 +
 hw/nvme/ctrl.c               | 174 +++++++++++++++++++++++++++++++++--
 hw/nvme/ns.c                 |  15 +++
 hw/nvme/nvme.h               |  37 +++++++-
 hw/nvme/trace-events         |   3 +-
 include/block/nvme.h         |  14 ++-
 6 files changed, 233 insertions(+), 15 deletions(-)

-- 
2.27.0
Re: [PATCH V2 0/4] hw/block/nvme: Implement ZNS finish-zone ZDC AEN
Posted by Klaus Jensen 1 year, 5 months ago
On Oct 21 16:10, clay.mayers@kioxia.com wrote:
> From: Clay Mayers <clay.mayers@kioxia.com>
> 
> ZNS controllers have the option to limit the time a zone can remain in
> the active state.  It begins with a background process in the controller
> setting the finish-zone-recommended FZR attribute for a zone.  As part of
> setting this attribute, the zone's id is added to the namespace's
> zone-descriptor-changed (ZDC) log page. If enabled, items added to the
> ZDC log page generate a ZDC "asynchronous event notification" AEN. Optionally,
> the control can induce a "zone excursion" forcing the zone into the finished
> state that also generates a ZDC event.
> 
> Zone enabled applications need to properly handle ZDC events. In a real device,
> the timeout is many hours making testing an application difficult.
> Implemented is the generation of FZR ZDC events to speed up O/S and application
> testing.
> 
> Added to the zoned NVMe command set is an optional, per-namespace timer
> (zoned.finish_time) to set the FZR attr for long-lived active zones; A per
> namespace ZDC log page; AEN results to including CQE.DW1 (the NSID of the ZDC
> AEN) and generating a ZDC AEN if it's been enabled. Zone excursions are not
> modeled.
> 
> See section 5.5 of the NVMe Zoned Namespace Command Set Specification v1.1
> for more details.
> 
> Changes since v1
> - Fixed offset length checking in zdc log page
> - Moved zdc_event_queued to the patch 4
> - Unwatched zdc events in nvme_exit()
> 
> Clay Mayers (4):
>   hw/block/nvme: add ZONE_FINISH_RECOMMENDED functionality
>   hw/block/nvme: add zone descriptor changed log page
>   hw/block/nvme: supply dw1 for aen result
>   hw/block/nvme: add zone descriptor changed AEN
> 
>  docs/system/devices/nvme.rst |   5 +
>  hw/nvme/ctrl.c               | 174 +++++++++++++++++++++++++++++++++--
>  hw/nvme/ns.c                 |  15 +++
>  hw/nvme/nvme.h               |  37 +++++++-
>  hw/nvme/trace-events         |   3 +-
>  include/block/nvme.h         |  14 ++-
>  6 files changed, 233 insertions(+), 15 deletions(-)
> 
> -- 
> 2.27.0
> 

Nice work Clay!

Series looks good to me,

Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
RE: [PATCH V2 0/4] hw/block/nvme: Implement ZNS finish-zone ZDC AEN
Posted by Clay Mayers 1 year, 5 months ago
> From: Klaus Jensen <its@irrelevant.dk>
> Sent: Wednesday, November 9, 2022 12:40 AM
> 
> On Oct 21 16:10, clay.mayers@kioxia.com wrote:
> > From: Clay Mayers <clay.mayers@kioxia.com>
> >
> > ZNS controllers have the option to limit the time a zone can remain in
> > the active state.  It begins with a background process in the controller
> > setting the finish-zone-recommended FZR attribute for a zone.  As part of
> > setting this attribute, the zone's id is added to the namespace's
> > zone-descriptor-changed (ZDC) log page. If enabled, items added to the
> > ZDC log page generate a ZDC "asynchronous event notification" AEN.
> Optionally,
> > the control can induce a "zone excursion" forcing the zone into the finished
> > state that also generates a ZDC event.
> >
> > Zone enabled applications need to properly handle ZDC events. In a real
> device,
> > the timeout is many hours making testing an application difficult.
> > Implemented is the generation of FZR ZDC events to speed up O/S and
> application
> > testing.
> >
> > Added to the zoned NVMe command set is an optional, per-namespace timer
> > (zoned.finish_time) to set the FZR attr for long-lived active zones; A per
> > namespace ZDC log page; AEN results to including CQE.DW1 (the NSID of the
> ZDC
> > AEN) and generating a ZDC AEN if it's been enabled. Zone excursions are not
> > modeled.
> >
> > See section 5.5 of the NVMe Zoned Namespace Command Set Specification
> v1.1
> > for more details.
> >
> > Changes since v1
> > - Fixed offset length checking in zdc log page
> > - Moved zdc_event_queued to the patch 4
> > - Unwatched zdc events in nvme_exit()
> >
> > Clay Mayers (4):
> >   hw/block/nvme: add ZONE_FINISH_RECOMMENDED functionality
> >   hw/block/nvme: add zone descriptor changed log page
> >   hw/block/nvme: supply dw1 for aen result
> >   hw/block/nvme: add zone descriptor changed AEN
> >
> >  docs/system/devices/nvme.rst |   5 +
> >  hw/nvme/ctrl.c               | 174 +++++++++++++++++++++++++++++++++--
> >  hw/nvme/ns.c                 |  15 +++
> >  hw/nvme/nvme.h               |  37 +++++++-
> >  hw/nvme/trace-events         |   3 +-
> >  include/block/nvme.h         |  14 ++-
> >  6 files changed, 233 insertions(+), 15 deletions(-)
> >
> > --
> > 2.27.0
> >
> 
> Nice work Clay!

Thanks! I think you had implemented excursions at one point and I'm
not sure why it didn't make it in. I originally left out excursions because
all I needed was the AEN to test my Linux patch.  I have a V3 in the works
with excursions so I can test what happens to libzbd applications. I can't
tell if there is real interest in this but I've tested rocksDB using zenfs and
it has difficulties with zone excursions.  What I don't know is if excursions
are a corner case or not - in my world, they are not.

> 
> Series looks good to me,
> 
> Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
RE: [PATCH V2 0/4] hw/block/nvme: Implement ZNS finish-zone ZDC AEN
Posted by Clay Mayers 1 year, 6 months ago
> From:  clay.mayers@kioxia.com
> Sent: Friday, October 21, 2022 4:11 PM
> To: qemu-devel@nongnu.org
> Cc: Keith Busch <kbusch@kernel.org>; Klaus Jensen <its@irrelevant.dk>; Fam
> Zheng <fam@euphon.net>; Phlippe Mathieu-Daudé <f4bug@amsat.org>
> Subject: [PATCH V2 0/4] hw/block/nvme: Implement ZNS finish-zone ZDC AEN
> 
> From: Clay Mayers <clay.mayers@kioxia.com>
> 
> ZNS controllers have the option to limit the time a zone can remain in
> the active state.  It begins with a background process in the controller
> setting the finish-zone-recommended FZR attribute for a zone.  As part of
> setting this attribute, the zone's id is added to the namespace's
> zone-descriptor-changed (ZDC) log page. If enabled, items added to the
> ZDC log page generate a ZDC "asynchronous event notification" AEN.
> Optionally,
> the control can induce a "zone excursion" forcing the zone into the finished
> state that also generates a ZDC event.
> 
> Zone enabled applications need to properly handle ZDC events. In a real
> device,
> the timeout is many hours making testing an application difficult.
> Implemented is the generation of FZR ZDC events to speed up O/S and
> application
> testing.
> 
> Added to the zoned NVMe command set is an optional, per-namespace timer
> (zoned.finish_time) to set the FZR attr for long-lived active zones; A per
> namespace ZDC log page; AEN results to including CQE.DW1 (the NSID of the
> ZDC
> AEN) and generating a ZDC AEN if it's been enabled. Zone excursions are not
> modeled.
> 
> See section 5.5 of the NVMe Zoned Namespace Command Set Specification
> v1.1
> for more details.
> 
> Changes since v1
> - Fixed offset length checking in zdc log page
> - Moved zdc_event_queued to the patch 4
> - Unwatched zdc events in nvme_exit()
> 
> Clay Mayers (4):
>   hw/block/nvme: add ZONE_FINISH_RECOMMENDED functionality
>   hw/block/nvme: add zone descriptor changed log page
>   hw/block/nvme: supply dw1 for aen result
>   hw/block/nvme: add zone descriptor changed AEN
> 
>  docs/system/devices/nvme.rst |   5 +
>  hw/nvme/ctrl.c               | 174 +++++++++++++++++++++++++++++++++--
>  hw/nvme/ns.c                 |  15 +++
>  hw/nvme/nvme.h               |  37 +++++++-
>  hw/nvme/trace-events         |   3 +-
>  include/block/nvme.h         |  14 ++-
>  6 files changed, 233 insertions(+), 15 deletions(-)
> 
> --
> 2.27.0

I forgot to add Dmitry to the CC list for v2