* NVMe ZNS last zone size
@ 2023-08-23 13:26 Stefan Hajnoczi
2023-08-23 14:23 ` Sam Li
0 siblings, 1 reply; 7+ messages in thread
From: Stefan Hajnoczi @ 2023-08-23 13:26 UTC (permalink / raw)
To: olc, Klaus Jensen; +Cc: qemu-devel, Val Adler
Hi Sam and Klaus,
Val is adding nvme-io_uring ZNS support to libblkio
(https://gitlab.com/libblkio/libblkio/-/merge_requests/221) and asked
how to test the size of the last zone when the namespace's total size
is not a multiple of the zone size.
My understanding is that the zoned storage model allows the last zone
to be smaller than the zone size in this case. However, the NVMe ZNS
emulation code in QEMU makes all zones a multiple of the zone size. I
think QEMU cannot be used for this test case at the moment.
Are there any plans to allow the last zone to have a different size?
Maybe Sam's qcow2 work will allow this?
Thanks,
Stefan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: NVMe ZNS last zone size
2023-08-23 13:26 NVMe ZNS last zone size Stefan Hajnoczi
@ 2023-08-23 14:23 ` Sam Li
2023-08-23 14:41 ` Stefan Hajnoczi
0 siblings, 1 reply; 7+ messages in thread
From: Sam Li @ 2023-08-23 14:23 UTC (permalink / raw)
To: Stefan Hajnoczi; +Cc: Klaus Jensen, qemu-devel, Val Adler
Hi Stefan,
Stefan Hajnoczi <stefanha@gmail.com> 于2023年8月23日周三 21:26写道:
>
> Hi Sam and Klaus,
> Val is adding nvme-io_uring ZNS support to libblkio
> (https://gitlab.com/libblkio/libblkio/-/merge_requests/221) and asked
> how to test the size of the last zone when the namespace's total size
> is not a multiple of the zone size.
I think a zone report operation can do the trick. Given zone configs,
the size of last zone should be [size - (nr_zones - 1) * zone_size].
Reporting last zone on such devices tells whether the value is
correct.
>
> My understanding is that the zoned storage model allows the last zone
> to be smaller than the zone size in this case. However, the NVMe ZNS
> emulation code in QEMU makes all zones a multiple of the zone size. I
> think QEMU cannot be used for this test case at the moment.
>
> Are there any plans to allow the last zone to have a different size?
> Maybe Sam's qcow2 work will allow this?
Yes, the zone report in qcow2 allows smaller last zone.
Please let me know if there is any problem.
Thanks,
Sam
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: NVMe ZNS last zone size
2023-08-23 14:23 ` Sam Li
@ 2023-08-23 14:41 ` Stefan Hajnoczi
2023-08-23 14:58 ` Sam Li
0 siblings, 1 reply; 7+ messages in thread
From: Stefan Hajnoczi @ 2023-08-23 14:41 UTC (permalink / raw)
To: Sam Li; +Cc: Klaus Jensen, qemu-devel, Val Adler
On Wed, 23 Aug 2023 at 10:24, Sam Li <faithilikerun@gmail.com> wrote:
>
> Hi Stefan,
>
> Stefan Hajnoczi <stefanha@gmail.com> 于2023年8月23日周三 21:26写道:
> >
> > Hi Sam and Klaus,
> > Val is adding nvme-io_uring ZNS support to libblkio
> > (https://gitlab.com/libblkio/libblkio/-/merge_requests/221) and asked
> > how to test the size of the last zone when the namespace's total size
> > is not a multiple of the zone size.
>
> I think a zone report operation can do the trick. Given zone configs,
> the size of last zone should be [size - (nr_zones - 1) * zone_size].
> Reporting last zone on such devices tells whether the value is
> correct.
In nvme_ns_zoned_check_calc_geometry() the number of zones is rounded down:
ns->num_zones = le64_to_cpu(ns->id_ns.nsze) / ns->zone_size;
Afterwards nsze is recalculated as follows:
ns->id_ns.nsze = cpu_to_le64(ns->num_zones * ns->zone_size);
I interpret this to mean that when the namespace's total size is not a
multiple of the zone size, then the last part will be ignored and not
exposed as a zone.
>
> >
> > My understanding is that the zoned storage model allows the last zone
> > to be smaller than the zone size in this case. However, the NVMe ZNS
> > emulation code in QEMU makes all zones a multiple of the zone size. I
> > think QEMU cannot be used for this test case at the moment.
> >
> > Are there any plans to allow the last zone to have a different size?
> > Maybe Sam's qcow2 work will allow this?
>
> Yes, the zone report in qcow2 allows smaller last zone.
> Please let me know if there is any problem.
Great. Val can try your qcow2 patches and see if that allows her to
test last zone size != zone_size.
Thanks,
Stefan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: NVMe ZNS last zone size
2023-08-23 14:41 ` Stefan Hajnoczi
@ 2023-08-23 14:58 ` Sam Li
2023-08-23 18:52 ` Klaus Jensen
0 siblings, 1 reply; 7+ messages in thread
From: Sam Li @ 2023-08-23 14:58 UTC (permalink / raw)
To: Stefan Hajnoczi; +Cc: Klaus Jensen, qemu-devel, Val Adler
Stefan Hajnoczi <stefanha@gmail.com> 于2023年8月23日周三 22:41写道:
>
> On Wed, 23 Aug 2023 at 10:24, Sam Li <faithilikerun@gmail.com> wrote:
> >
> > Hi Stefan,
> >
> > Stefan Hajnoczi <stefanha@gmail.com> 于2023年8月23日周三 21:26写道:
> > >
> > > Hi Sam and Klaus,
> > > Val is adding nvme-io_uring ZNS support to libblkio
> > > (https://gitlab.com/libblkio/libblkio/-/merge_requests/221) and asked
> > > how to test the size of the last zone when the namespace's total size
> > > is not a multiple of the zone size.
> >
> > I think a zone report operation can do the trick. Given zone configs,
> > the size of last zone should be [size - (nr_zones - 1) * zone_size].
> > Reporting last zone on such devices tells whether the value is
> > correct.
>
> In nvme_ns_zoned_check_calc_geometry() the number of zones is rounded down:
>
> ns->num_zones = le64_to_cpu(ns->id_ns.nsze) / ns->zone_size;
>
> Afterwards nsze is recalculated as follows:
>
> ns->id_ns.nsze = cpu_to_le64(ns->num_zones * ns->zone_size);
>
> I interpret this to mean that when the namespace's total size is not a
> multiple of the zone size, then the last part will be ignored and not
> exposed as a zone.
I see. Current ZNS emulation does not support this case.
>
> >
> > >
> > > My understanding is that the zoned storage model allows the last zone
> > > to be smaller than the zone size in this case. However, the NVMe ZNS
> > > emulation code in QEMU makes all zones a multiple of the zone size. I
> > > think QEMU cannot be used for this test case at the moment.
> > >
> > > Are there any plans to allow the last zone to have a different size?
> > > Maybe Sam's qcow2 work will allow this?
> >
> > Yes, the zone report in qcow2 allows smaller last zone.
> > Please let me know if there is any problem.
>
> Great. Val can try your qcow2 patches and see if that allows her to
> test last zone size != zone_size.
Not sure how the test is set up. If requiring nvme passthrough, maybe
zns patches need to be on top of qcow2 patches. There are still some
cases to be fixed up. So just let me know any problem is on my side.
In case Val needs it, the lastest branch is:
https://github.com/sgzerolc/qemu/blob/dev-zns-v3/
Thanks,
Sam
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: NVMe ZNS last zone size
2023-08-23 14:58 ` Sam Li
@ 2023-08-23 18:52 ` Klaus Jensen
2023-08-23 18:59 ` Stefan Hajnoczi
2023-08-24 0:45 ` Sam Li
0 siblings, 2 replies; 7+ messages in thread
From: Klaus Jensen @ 2023-08-23 18:52 UTC (permalink / raw)
To: Sam Li; +Cc: Stefan Hajnoczi, qemu-devel, Val Adler
On Aug 23 22:58, Sam Li wrote:
> Stefan Hajnoczi <stefanha@gmail.com> 于2023年8月23日周三 22:41写道:
> >
> > On Wed, 23 Aug 2023 at 10:24, Sam Li <faithilikerun@gmail.com> wrote:
> > >
> > > Hi Stefan,
> > >
> > > Stefan Hajnoczi <stefanha@gmail.com> 于2023年8月23日周三 21:26写道:
> > > >
> > > > Hi Sam and Klaus,
> > > > Val is adding nvme-io_uring ZNS support to libblkio
> > > > (https://gitlab.com/libblkio/libblkio/-/merge_requests/221) and asked
> > > > how to test the size of the last zone when the namespace's total size
> > > > is not a multiple of the zone size.
> > >
> > > I think a zone report operation can do the trick. Given zone configs,
> > > the size of last zone should be [size - (nr_zones - 1) * zone_size].
> > > Reporting last zone on such devices tells whether the value is
> > > correct.
> >
> > In nvme_ns_zoned_check_calc_geometry() the number of zones is rounded down:
> >
> > ns->num_zones = le64_to_cpu(ns->id_ns.nsze) / ns->zone_size;
> >
> > Afterwards nsze is recalculated as follows:
> >
> > ns->id_ns.nsze = cpu_to_le64(ns->num_zones * ns->zone_size);
> >
> > I interpret this to mean that when the namespace's total size is not a
> > multiple of the zone size, then the last part will be ignored and not
> > exposed as a zone.
>
> I see. Current ZNS emulation does not support this case.
>
NVMe Zoned Namespaces requires all zones to be the same size. The
"trailing zone" is a thing in SMR HDDs.
Cheers,
Klaus
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: NVMe ZNS last zone size
2023-08-23 18:52 ` Klaus Jensen
@ 2023-08-23 18:59 ` Stefan Hajnoczi
2023-08-24 0:45 ` Sam Li
1 sibling, 0 replies; 7+ messages in thread
From: Stefan Hajnoczi @ 2023-08-23 18:59 UTC (permalink / raw)
To: Klaus Jensen; +Cc: Sam Li, qemu-devel, Val Adler
On Wed, 23 Aug 2023 at 14:53, Klaus Jensen <k.jensen@samsung.com> wrote:
>
> On Aug 23 22:58, Sam Li wrote:
> > Stefan Hajnoczi <stefanha@gmail.com> 于2023年8月23日周三 22:41写道:
> > >
> > > On Wed, 23 Aug 2023 at 10:24, Sam Li <faithilikerun@gmail.com> wrote:
> > > >
> > > > Hi Stefan,
> > > >
> > > > Stefan Hajnoczi <stefanha@gmail.com> 于2023年8月23日周三 21:26写道:
> > > > >
> > > > > Hi Sam and Klaus,
> > > > > Val is adding nvme-io_uring ZNS support to libblkio
> > > > > (https://gitlab.com/libblkio/libblkio/-/merge_requests/221) and asked
> > > > > how to test the size of the last zone when the namespace's total size
> > > > > is not a multiple of the zone size.
> > > >
> > > > I think a zone report operation can do the trick. Given zone configs,
> > > > the size of last zone should be [size - (nr_zones - 1) * zone_size].
> > > > Reporting last zone on such devices tells whether the value is
> > > > correct.
> > >
> > > In nvme_ns_zoned_check_calc_geometry() the number of zones is rounded down:
> > >
> > > ns->num_zones = le64_to_cpu(ns->id_ns.nsze) / ns->zone_size;
> > >
> > > Afterwards nsze is recalculated as follows:
> > >
> > > ns->id_ns.nsze = cpu_to_le64(ns->num_zones * ns->zone_size);
> > >
> > > I interpret this to mean that when the namespace's total size is not a
> > > multiple of the zone size, then the last part will be ignored and not
> > > exposed as a zone.
> >
> > I see. Current ZNS emulation does not support this case.
> >
>
> NVMe Zoned Namespaces requires all zones to be the same size. The
> "trailing zone" is a thing in SMR HDDs.
Thanks for letting me know.
Stefan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: NVMe ZNS last zone size
2023-08-23 18:52 ` Klaus Jensen
2023-08-23 18:59 ` Stefan Hajnoczi
@ 2023-08-24 0:45 ` Sam Li
1 sibling, 0 replies; 7+ messages in thread
From: Sam Li @ 2023-08-24 0:45 UTC (permalink / raw)
To: Klaus Jensen; +Cc: Stefan Hajnoczi, qemu-devel, Val Adler
Klaus Jensen <k.jensen@samsung.com> 于2023年8月24日周四 02:53写道:
>
> On Aug 23 22:58, Sam Li wrote:
> > Stefan Hajnoczi <stefanha@gmail.com> 于2023年8月23日周三 22:41写道:
> > >
> > > On Wed, 23 Aug 2023 at 10:24, Sam Li <faithilikerun@gmail.com> wrote:
> > > >
> > > > Hi Stefan,
> > > >
> > > > Stefan Hajnoczi <stefanha@gmail.com> 于2023年8月23日周三 21:26写道:
> > > > >
> > > > > Hi Sam and Klaus,
> > > > > Val is adding nvme-io_uring ZNS support to libblkio
> > > > > (https://gitlab.com/libblkio/libblkio/-/merge_requests/221) and asked
> > > > > how to test the size of the last zone when the namespace's total size
> > > > > is not a multiple of the zone size.
> > > >
> > > > I think a zone report operation can do the trick. Given zone configs,
> > > > the size of last zone should be [size - (nr_zones - 1) * zone_size].
> > > > Reporting last zone on such devices tells whether the value is
> > > > correct.
> > >
> > > In nvme_ns_zoned_check_calc_geometry() the number of zones is rounded down:
> > >
> > > ns->num_zones = le64_to_cpu(ns->id_ns.nsze) / ns->zone_size;
> > >
> > > Afterwards nsze is recalculated as follows:
> > >
> > > ns->id_ns.nsze = cpu_to_le64(ns->num_zones * ns->zone_size);
> > >
> > > I interpret this to mean that when the namespace's total size is not a
> > > multiple of the zone size, then the last part will be ignored and not
> > > exposed as a zone.
> >
> > I see. Current ZNS emulation does not support this case.
> >
>
> NVMe Zoned Namespaces requires all zones to be the same size. The
> "trailing zone" is a thing in SMR HDDs.
Thanks! Then qcow2 with ZNS should also ignore the trailing zone.
Sam
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-08-24 0:47 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-23 13:26 NVMe ZNS last zone size Stefan Hajnoczi
2023-08-23 14:23 ` Sam Li
2023-08-23 14:41 ` Stefan Hajnoczi
2023-08-23 14:58 ` Sam Li
2023-08-23 18:52 ` Klaus Jensen
2023-08-23 18:59 ` Stefan Hajnoczi
2023-08-24 0:45 ` Sam Li
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).