Cross-device resource sharing
v3 cover Cross-device resource sharing
Hi all,
This is the next iteration of patches for adding support for sharing resources between different virtio devices. In addition to these patches, the most recent virtio-video patchset includes a patch for importing objects into that device [1].
[1] https://markmail.org/message/wxdne5re7aaugbjg
Changes v2 -> v3:
* Replace references to guest/host
* Remove unnecessary paragraph and field in exported object section
* Recommend RFC4122 version 4 UUIDs
* Represent UUID as u8[16] instead of le64 pair
David Stevens (2):
content: define what an exported object is
virtio-gpu: add the ability to export resources
content.tex | 12 ++++++++++++ introduction.tex | 4 ++++ virtio-gpu.tex | 29 +++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+)
Signature · 1 line
2.25.0.341.g760bfbb309-goog
RFC PATCH v3 1/2 content: define what an exported object is
Define a mechanism for sharing objects between different virtio devices.
--- content.tex | 12 ++++++++++++ introduction.tex | 4 ++++ 2 files changed, 16 insertions(+)
content.tex +12 -0
@@ -373,6 +373,18 @@ \section{Driver Notifications} \label{sec:Virtqueues / Driver notifications} \input{shared-mem.tex} +\section{Exporting Objects}\label{sec:Basic Facilities of a Virtio Device / Exporting Objects} + +When an object created by one virtio device needs to be +shared with a seperate virtio device, the first device can +export the object by generating a UUID which can then +be passed to the second device to identify the object. + +What constitutes an object, how to export objects, and +how to import objects are defined by the individual device +types. It is RECOMMENDED that devices generate version 4 +UUIDs as specified by \hyperref[intro:rfc4122]{[RFC4122]}. + \chapter{General Initialization And Device Operation}\label{sec:General Initialization And Device Operation} We start with an overview of device initialization, then expand on the
introduction.tex +4 -0
@@ -40,6 +40,10 @@ \section{Normative References}\label{sec:Normative References} \phantomsection\label{intro:rfc2119}\textbf{[RFC2119]} & Bradner S., ``Key words for use in RFCs to Indicate Requirement Levels'', BCP 14, RFC 2119, March 1997. \newline\url{http://www.ietf.org/rfc/rfc2119.txt}\\ + \phantomsection\label{intro:rfc4122}\textbf{[RFC4122]} & +Leach, P., Mealling, M., and R. Salz, ``A Universally Unique +IDentifier (UUID) URN Namespace'', RFC 4122, DOI 10.17487/RFC4122, +July 2005. \newline\url{http://www.ietf.org/rfc/rfc4122.txt}\\ \phantomsection\label{intro:S390 PoP}\textbf{[S390 PoP]} & z/Architecture Principles of Operation, IBM Publication SA22-7832, \newline\url{http://publibfi.boulder.ibm.com/epubs/pdf/dz9zr009.pdf}, and any future revisions\\ \phantomsection\label{intro:S390 Common I/O}\textbf{[S390 Common I/O]} & ESA/390 Common I/O-Device and Self-Description, IBM Publication SA22-7204, \newline\url{http://publibfp.dhe.ibm.com/cgi-bin/bookmgr/BOOKS/dz9ar501/CCONTENTS}, and any future revisions\\ \phantomsection\label{intro:PCI}\textbf{[PCI]} &
Signature · 18 lines
2.25.0.341.g760bfbb309-goog 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/
RFC PATCH v3 2/2 virtio-gpu: add the ability to export resources
In reply to David Stevens--- virtio-gpu.tex | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
virtio-gpu.tex +29 -0
@@ -186,12 +186,16 @@ \subsubsection{Device Operation: Request header}\label{sec:Device Types / GPU De VIRTIO_GPU_CMD_UPDATE_CURSOR = 0x0300, VIRTIO_GPU_CMD_MOVE_CURSOR, + /* misc commands */ + VIRTIO_GPU_CMD_RESOURCE_ASSIGN_UUID = 0x0400, + /* success responses */ VIRTIO_GPU_RESP_OK_NODATA = 0x1100, VIRTIO_GPU_RESP_OK_DISPLAY_INFO, VIRTIO_GPU_RESP_OK_CAPSET_INFO, VIRTIO_GPU_RESP_OK_CAPSET, VIRTIO_GPU_RESP_OK_EDID, + VIRTIO_GPU_RESP_OK_RESOURCE_ASSIGN_UUID, /* error responses */ VIRTIO_GPU_RESP_ERR_UNSPEC = 0x1200,
@@ -454,6 +458,31 @@ \subsubsection{Device Operation: controlq}\label{sec:Device Types / GPU Device / This detaches any backing pages from a resource, to be used in case of guest swapping or object destruction. +\item[VIRTIO_GPU_CMD_RESOURCE_ASSIGN_UUID] Creates an exported object from + a resource. Request data is \field{struct + virtio_gpu_resource_assign_uuid}. Response type is + VIRTIO_GPU_RESP_OK_RESOURCE_ASSIGN_UUID, response data is \field{struct + virtio_gpu_resp_resource_assign_uuid}. + +\begin{lstlisting} +struct virtio_gpu_resource_assign_uuid { + struct virtio_gpu_ctrl_hdr hdr; + le32 resource_id; + le32 padding; +}; + +struct virtio_gpu_resp_resource_assign_uuid { + struct virtio_gpu_ctrl_hdr hdr; + u8 uuid[16]; +}; +\end{lstlisting} + +The response contains a UUID which identifies the exported object created from +the host private resource. Note that if the resource has an attached backing, +modifications made to the host private resource through the exported object by +other devices are not visible in the attached backing until they are transferred +into the backing. + \end{description} \subsubsection{Device Operation: cursorq}\label{sec:Device Types / GPU Device / Device Operation / Device Operation: cursorq}
Signature · 1 line
2.25.0.341.g760bfbb309-goog
Re: [RFC PATCH v3 2/2] virtio-gpu: add the ability to export resources
Quoted 10 lines · David Stevens
Signed-off-by David Stevens <[email protected]>--- virtio-gpu.tex | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)virtio-gpu.tex +0
-0
virtio-gpu.tex \subsubsection{Device Operation: Request header}\label{sec:Device Types / GPU De · line 190
Quoted 5 lines
virtio-gpu.tex +2
-0@@ -186,12 +186,16 @@ \subsubsection{Device Operation: Request header}\label{sec:Device Types / GPU De VIRTIO_GPU_CMD_UPDATE_CURSOR = 0x0300, VIRTIO_GPU_CMD_MOVE_CURSOR, + /* misc commands */ + VIRTIO_GPU_CMD_RESOURCE_ASSIGN_UUID = 0x0400,
I'd suggest to move that to the "2d commands" section (which isn't really "2d" but more "not 3d").
We also need a feature flag signaling support for the new command.
Otherwise this looks ok to me.
Are there any patches and/or attempts to merge/discuss upstream? Specifically for handling the uuids for dma-bufs in linux (guest side)? I suspect there will be some discussions on this and having at least some plan upstream can agree on would be good.
cheers,
Gerd