Add VIRTIO_RING_F_LARGE_INDIRECT_DESC
PATCH 1/1 Add VIRTIO_RING_F_LARGE_INDIRECT_DESC
This new feature flag allows indirect descriptor tables to exceed the queue size.
---
Stefan noted that there should also be a numeric configuration field reflecting a precise limit of indirect descriptors. The question is where should that go to exactly? Some devices currently handle this in their device specific configuration space. Wouldn't it make sense to handle that in the common configuration space instead?
--- content.tex | 21 +++++++++++++++++++++ split-ring.tex | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-)
content.tex +21 -0
@@ -6693,6 +6693,27 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits} transport specific. For more details about driver notifications over PCI see \ref{sec:Virtio Transport Options / Virtio Over PCI Bus / PCI-specific Initialization And Device Operation / Available Buffer Notifications}. + \item[VIRTIO_RING_F_LARGE_INDIRECT_DESC(40)] This feature indicates that the + amount of descriptors in an indirect descriptor table is allowed to exceed + the Queue Size. + + If this feature bit is not negotiated, then a driver MUST NOT create a + descriptor chain longer than the Queue Size, which then also applies to + indirect descriptor tables as in \ref{sec:Basic Facilities of a Virtio + Device / Virtqueues / The Virtqueue Descriptor Table / Indirect + Descriptors}. Which means without this feature, the Queue Size limits + both the maximum amount of pending messages being emplaced in the vring, + as well as the actual bulk data size being transmitted. + + With this feature enabled, the Queue Size only limits the maximum amount + of pending messages in the vring, but does not oppose a limit to the actual + bulk data size being transmitted. Decoupling these two configuration + parameters this way not only allows much larger bulk data being transferred + per message, but also avoids complicated synchronization mechanisms if + device only supports a very small amount of pending/active messages. + Due to the 16-bit size of a descriptor's "next" field there is still an + absolute limit of $2^{16}$ descriptors per indirect descriptor table. + \end{description} \drivernormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}
split-ring.tex +1 -1
@@ -269,7 +269,7 @@ \subsubsection{Indirect Descriptors}\label{sec:Basic Facilities of a Virtio Devi one table per descriptor). A driver MUST NOT create a descriptor chain longer than the Queue Size of -the device. +the device unless VIRTIO_RING_F_LARGE_INDIRECT_DESC has been negotiated. A driver MUST NOT set both VIRTQ_DESC_F_INDIRECT and VIRTQ_DESC_F_NEXT in \field{flags}.
Signature · 1 line
2.20.1
Quoted 10 lines · Christian Schoenebeck
This new feature flag allows indirect descriptor tables to exceed the queue size.
Signed-off-by Christian Schoenebeck <[email protected]>---
Stefan noted that there should also be a numeric configuration field reflecting a precise limit of indirect descriptors. The question is where should that go to exactly? Some devices currently handle this in their device specific configuration space. Wouldn't it make sense to handle that in the common configuration space instead?
It could be added as a read-only struct virtio_pci_common_cfg le16 queue_indirect_size field. The same needs to be done for the other transports.
Quoted 13 lines
--- content.tex | 21 +++++++++++++++++++++ split-ring.tex | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-)content.tex +0
-0@@ -6693,6 +6693,27 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits} transport specific. For more details about driver notifications over PCI see \ref{sec:Virtio Transport Options / Virtio Over PCI Bus / PCI-specific Initialization And Device Operation / Available Buffer Notifications}.
content.tex \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits} · line 6705
Quoted 10 lines
content.tex +10
-0+ \item[VIRTIO_RING_F_LARGE_INDIRECT_DESC(40)] This feature indicates that the + amount of descriptors in an indirect descriptor table is allowed to exceed + the Queue Size. + + If this feature bit is not negotiated, then a driver MUST NOT create a + descriptor chain longer than the Queue Size, which then also applies to + indirect descriptor tables as in \ref{sec:Basic Facilities of a Virtio + Device / Virtqueues / The Virtqueue Descriptor Table / Indirect + Descriptors}. Which means without this feature, the Queue Size limits + both the maximum amount of pending messages being emplaced in the vring,
The word "buffers" is typically used instead of "messages".
content.tex \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits} · line 6710
Quoted 5 lines
content.tex +5
-0+ as well as the actual bulk data size being transmitted. + + With this feature enabled, the Queue Size only limits the maximum amount + of pending messages in the vring, but does not oppose a limit to the actual + bulk data size being transmitted. Decoupling these two configuration
I think we're still limited by Queue Size in the virtqueue descriptor table so this statement only applies when indirect descriptors are used:
"... build data size being transmitted when indirect descriptors are used."
Quoted 25 lines
content.tex +6
-0+ parameters this way not only allows much larger bulk data being transferred + per message, but also avoids complicated synchronization mechanisms if + device only supports a very small amount of pending/active messages. + Due to the 16-bit size of a descriptor's "next" field there is still an + absolute limit of $2^{16}$ descriptors per indirect descriptor table. + \end{description} \drivernormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}split-ring.tex +1
-1@@ -269,7 +269,7 @@ \subsubsection{Indirect Descriptors}\label{sec:Basic Facilities of a Virtio Devi one table per descriptor). A driver MUST NOT create a descriptor chain longer than the Queue Size of -the device. +the device unless VIRTIO_RING_F_LARGE_INDIRECT_DESC has been negotiated. A driver MUST NOT set both VIRTQ_DESC_F_INDIRECT and VIRTQ_DESC_F_NEXT in \field{flags}.Signature · 1 line
2.20.1
Quoted 12 lines · On Mittwoch, 24. November 2021 18:14:59 CET Stefan Hajnoczi wrote:
Quoted 10 lines · Christian Schoenebeck
This new feature flag allows indirect descriptor tables to exceed the queue size.
Signed-off-by Christian Schoenebeck <[email protected]>---
Stefan noted that there should also be a numeric configuration field reflecting a precise limit of indirect descriptors. The question is where should that go to exactly? Some devices currently handle this in their device specific configuration space. Wouldn't it make sense to handle that in the common configuration space instead?
Quoted 3 lines
It could be added as a read-only struct
virtio_pci_common_cfgle16queue_indirect_sizefield. The same needs to be done for the other transports.
OK, do I have to make it clear that it is an optional field in virtio_pci_common_cfg?
Are you sure about read-only? QEMU currently reserves the worst case expected amount of descriptors on stack on every vring entry being processed. If that field was read-write instead, and if guest driver never uses the amount of descriptors as advertised by host device being support, guest driver could simply lower that value and reduce the pressure on host device.
So maybe it would make sense making it read-write with the requirement that guest driver must not increase the value? In the end that write option would be a soft feature, device could still ignore it and allocate more, it wouldn't hurt IMO and avoids another feature flag being required for this in future.
Quoted 21 lines
Quoted 21 lines
---
content.tex | 21 +++++++++++++++++++++ split-ring.tex | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-)content.tex +0
-0@@ -6693,6 +6693,27 @@ \chapter{Reserved Feature Bits}\label{sec:ReservedFeature Bits}>
transport specific.
For more details about driver notifications over PCI see \ref{sec:Virtio Transport Options / Virtio Over PCI Bus / PCI-specific Initialization And Device Operation / Available Buffer Notifications}.>
+ \item[VIRTIO_RING_F_LARGE_INDIRECT_DESC(40)] This feature indicates that the + amount of descriptors in an indirect descriptor table is allowed to exceed + the Queue Size.content.tex +2
-0+ + If this feature bit is not negotiated, then a driver MUST NOT create a
Quoted 8 lines
Quoted 6 lines
content.tex +5
-0+ descriptor chain longer than the Queue Size, which then also applies to + indirect descriptor tables as in \ref{sec:Basic Facilities of a Virtio + Device / Virtqueues / The Virtqueue Descriptor Table / Indirect + Descriptors}. Which means without this feature, the Queue Size limits + both the maximum amount of pending messages being emplaced in thevring,
The word "buffers" is typically used instead of "messages".
If that's the common terminology in the virtio spec, OK, I'll change that.
Quoted 7 lines
Quoted 7 lines
content.tex +3
-0+ as well as the actual bulk data size being transmitted. + + With this feature enabled, the Queue Size only limits the maximumamount
+ of pending messages in the vring, but does not oppose a limit to the actual + bulk data size being transmitted. Decoupling these two configuration
Quoted 5 lines
I think we're still limited by Queue Size in the virtqueue descriptor table so this statement only applies when indirect descriptors are used:
"... build data size being transmitted when indirect descriptors are
used."
I thought this was already implied in this block, but sure it makes it more clear, so fine with me.
Quoted 19 lines
Quoted 19 lines
+ parameters this way not only allows much larger bulk data being transferred + per message, but also avoids complicated synchronization mechanisms if + device only supports a very small amount of pending/active messages. + Due to the 16-bit size of a descriptor's "next" field there is still an + absolute limit of $2^{16}$ descriptors per indirect descriptor table. +
\end{description}
\drivernormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}
split-ring.tex +0
-0@@ -269,7 +269,7 @@ \subsubsection{Indirect Descriptors}\label{sec:BasicFacilities of a Virtio Devi>
one table per descriptor).
Quoted 7 lines
split-ring.tex \subsubsection{Indirect Descriptors}\label{sec:Basic Facilities of a Virtio Devi · line 275
Quoted 7 lines
A driver MUST NOT create a descriptor chain longer than the Queue Size of
split-ring.tex +1
-1-the device. +the device unless VIRTIO_RING_F_LARGE_INDIRECT_DESC has been negotiated. A driver MUST NOT set both VIRTQ_DESC_F_INDIRECT and VIRTQ_DESC_F_NEXT in \field{flags}.
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/
Quoted 13 lines · Christian Schoenebeck
Quoted 12 lines · On Mittwoch, 24. November 2021 18:14:59 CET Stefan Hajnoczi wrote:
Quoted 10 lines · Christian Schoenebeck
This new feature flag allows indirect descriptor tables to exceed the queue size.
Signed-off-by Christian Schoenebeck <[email protected]>---
Stefan noted that there should also be a numeric configuration field reflecting a precise limit of indirect descriptors. The question is where should that go to exactly? Some devices currently handle this in their device specific configuration space. Wouldn't it make sense to handle that in the common configuration space instead?
Quoted 6 lines
Quoted 3 lines
It could be added as a read-only struct
virtio_pci_common_cfgle16queue_indirect_sizefield. The same needs to be done for the other transports.OK, do I have to make it clear that it is an optional field in
virtio_pci_common_cfg?
It would need to be something like "this field only exists if VIRTIO_RING_F_LARGE_INDIRECT_DESC has been negotiated".
I'm not quite sure how MMIO expresses optional registers.
For CCW, it's a bit more complicated: You would need to extend two command payloads (vq_config_block and vq_info_block, assuming you want to make this read/write); to do that, we will likely want to introduce revision 3 (and make the feature bit dependent on revision 3).
Quoted 11 lines
Are you sure about read-only? QEMU currently reserves the worst case expected amount of descriptors on stack on every vring entry being processed. If that field was read-write instead, and if guest driver never uses the amount of descriptors as advertised by host device being support, guest driver could simply lower that value and reduce the pressure on host device.
So maybe it would make sense making it read-write with the requirement that guest driver must not increase the value? In the end that write option would be a soft feature, device could still ignore it and allocate more, it wouldn't hurt IMO and avoids another feature flag being required for this in future.
I agree, this should be read/write. It's similar to the queue size, where the driver may also configure a lower number.
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/
Quoted 39 lines · Cornelia Huck
Quoted 13 lines · Christian Schoenebeck
Quoted 12 lines · On Mittwoch, 24. November 2021 18:14:59 CET Stefan Hajnoczi wrote:
Quoted 10 lines · Christian Schoenebeck
This new feature flag allows indirect descriptor tables to exceed the queue size.
Signed-off-by Christian Schoenebeck <[email protected]>---
Stefan noted that there should also be a numeric configuration field reflecting a precise limit of indirect descriptors. The question is where should that go to exactly? Some devices currently handle this in their device specific configuration space. Wouldn't it make sense to handle that in the common configuration space instead?Quoted 6 lines
Quoted 3 lines
It could be added as a read-only struct
virtio_pci_common_cfgle16queue_indirect_sizefield. The same needs to be done for the other transports.OK, do I have to make it clear that it is an optional field in
virtio_pci_common_cfg?It would need to be something like "this field only exists if
VIRTIO_RING_F_LARGE_INDIRECT_DESChas been negotiated".I'm not quite sure how MMIO expresses optional registers.
For CCW, it's a bit more complicated: You would need to extend two command payloads (
vq_config_blockandvq_info_block, assuming you want to make this read/write); to do that, we will likely want to introduce revision 3 (and make the feature bit dependent on revision 3).Quoted 7 lines
Are you sure about read-only? QEMU currently reserves the worst case expected amount of descriptors on stack on every vring entry being processed. If that field was read-write instead, and if guest driver never uses the amount of descriptors as advertised by host device being support, guest driver could simply lower that value and reduce the pressure on host device.
Quoted 7 lines
Quoted 4 lines
So maybe it would make sense making it read-write with the requirement that guest driver must not increase the value? In the end that write option would be a soft feature, device could still ignore it and allocate more, it wouldn't hurt IMO and avoids another feature flag being required for this in future.
I agree, this should be read/write. It's similar to the queue size, where the driver may also configure a lower number.
Sounds good.
Stefan