Skip to contentSkip to conversation

virtio-blk: clarify descriptor-segment relation

PATCH In review Laura Loghin 2 participants 3 messages Jan 12, 2021 – Jan 13, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 virtio-blk: clarify descriptor-segment relation

Regarding the relation between data descriptors and segments, the commit that added discard and write zeroes to the spec, stated that the idea is "using 16 Bytes payload to support 1 descriptor" (not, for example, 32 bytes). There wasn't any mention in the spec about one data descriptor corresponding to exactly one segment. Added this constraint to block documentation.

---
 content.tex | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
content.tex +3 -2
index 620c0e2..6393b68 100644
@@ -4599,8 +4599,9 @@ \subsection{Device Operation}\label{sec:Device Types / Block Device / Device Ope
 of 512 bytes).
 
 The \field{data} used for discard or write zeroes commands consists of one or
-more segments.  The maximum number of segments is \field{max_discard_seg} for
-discard commands and \field{max_write_zeroes_seg} for write zeroes commands.
+more segments, and one data descriptor corresponds to exactly one such segment.
+The maximum number of segments is \field{max_discard_seg} for discard commands
+and \field{max_write_zeroes_seg} for write zeroes commands.
 Each segment is of form:
 
 \begin{lstlisting}
Signature · 23 lines
2.17.1




Amazon Development Center (Romania) S.R.L. registered office: 27A Sf. Lazar Street, UBC5, floor 2, Iasi, Iasi County, 700045, Romania. Registered in Romania. Registration number J22/2621/2005.


This publicly archived list offers a means to provide input to the
OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and
to minimize spam in the list archive, subscription is required
before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/
#1 lore raw
Quoted 17 lines · Laura Loghin

Regarding the relation between data descriptors and segments, the commit that added discard and write zeroes to the spec, stated that the idea is "using 16 Bytes payload to support 1 descriptor" (not, for example, 32 bytes). There wasn't any mention in the spec about one data descriptor corresponding to exactly one segment. Added this constraint to block documentation.

---
 content.tex | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
content.tex +0 -0
index 620c0e2..6393b68 100644

content.tex \subsection{Device Operation}\label{sec:Device Types / Block Device / Device Ope · line 4605

Quoted 9 lines
content.tex +3 -2
@@ -4599,8 +4599,9 @@ \subsection{Device Operation}\label{sec:Device Types / Block Device / Device Ope
 of 512 bytes).
 
 The \field{data} used for discard or write zeroes commands consists of one or
-more segments.  The maximum number of segments is \field{max_discard_seg} for
-discard commands and \field{max_write_zeroes_seg} for write zeroes commands.
+more segments, and one data descriptor corresponds to exactly one such segment.
+The maximum number of segments is \field{max_discard_seg} for discard commands
+and \field{max_write_zeroes_seg} for write zeroes commands.
 Each segment is of form:

I'm not sure what this means, could you clarify?

There is no concept of "descriptor" in virtio-blk write zeroes/discard. There is only the "segment" (struct virtio_blk_discard_write_zeroes).

If you are referring to vring descriptors, then there is no relationship between struct virtio_blk_req::data[] and vring descriptors. The driver may choose any vring descriptor framing/layout (see 2.6.4 Message Framing).

Stefan

#2 lore raw
Quoted 32 lines · Stefan Hajnoczi
Quoted 17 lines · Laura Loghin

Regarding the relation between data descriptors and segments, the commit that added discard and write zeroes to the spec, stated that the idea is "using 16 Bytes payload to support 1 descriptor" (not, for example, 32 bytes). There wasn't any mention in the spec about one data descriptor corresponding to exactly one segment. Added this constraint to block documentation.

---
 content.tex | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
content.tex +0 -0
index 620c0e2..6393b68 100644

content.tex \subsection{Device Operation}\label{sec:Device Types / Block Device / Device Ope · line 4605

Quoted 9 lines
content.tex +3 -2
@@ -4599,8 +4599,9 @@ \subsection{Device Operation}\label{sec:Device Types / Block Device / Device Ope
 of 512 bytes).
 
 The \field{data} used for discard or write zeroes commands consists of one or
-more segments.  The maximum number of segments is \field{max_discard_seg} for
-discard commands and \field{max_write_zeroes_seg} for write zeroes commands.
+more segments, and one data descriptor corresponds to exactly one such segment.
+The maximum number of segments is \field{max_discard_seg} for discard commands
+and \field{max_write_zeroes_seg} for write zeroes commands.
 Each segment is of form:

I'm not sure what this means, could you clarify?

There is no concept of "descriptor" in virtio-blk write zeroes/discard. There is only the "segment" (struct virtio_blk_discard_write_zeroes).

Quoted 6 lines

If you are referring to vring descriptors, then there is no relationship between struct virtio_blk_req::data[] and vring descriptors. The driver may choose any vring descriptor framing/layout (see 2.6.4 Message Framing).

Stefan

Basically what I was trying to understand is if the specification enforces/should enforce that len field from a vring descriptor that is pointing to data that belongs to a discard/write zeroes command is always 16 bytes. So what you are saying is that something like:

struct virtq_desc {
        /* Address (guest-physical). */
        le64 addr;
        /* Length. */
        le32 32;
     ...
};

is totally legit for a virtq descriptor that belongs to a (large) discard/write zeroes request? So this descriptor will point to a memory region where you have two virtio_blk_discard_write_zeroes segments, one at addr address from above and the other one at addr + 16.

Thanks!
Laura

Amazon Development Center (Romania) S.R.L. registered office: 27A Sf. Lazar Street, UBC5, floor 2, Iasi, Iasi County, 700045, Romania. Registered in Romania. Registration number J22/2621/2005.

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/