docs/design: introduce HVMMEM_ioreq_serverX types
PATCH 1/1 docs/design: introduce HVMMEM_ioreq_serverX types
This patch adds a new 'designs' subdirectory under docs as a repository for this and future design proposals.
---
For convenience this document can also be viewed in PDF at:
http://xenbits.xen.org/people/pauldu/hvmmem_ioreq_server.pdf
--- docs/designs/hvmmem_ioreq_server.md | 63 +++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100755 docs/designs/hvmmem_ioreq_server.md
docs/designs/hvmmem_ioreq_server.md new file +63 -0
@@ -0,0 +1,63 @@ +HVMMEM\_ioreq\_serverX +---------------------- + +Background +========== + +The concept of the IOREQ server was introduced to allow multiple distinct +device emulators to a single VM. The XenGT project uses an IOREQ server to +provide mediated pass-through of Intel GPUs to guests and, as part of the +mediation, needs to intercept accesses to GPU page-tables (or GTTs) that +reside in guest RAM. + +The current implementation of this sets the type of GTT pages to type +HVMMEM\_mmio\_write\_dm, which causes Xen to emulate writes to such pages, +and then maps the guest physical addresses of those pages to the XenGT +IOREQ server using the HVMOP\_map\_io\_range\_to\_ioreq\_server hypercall. +However, because the number of GTTs is potentially large, using this +approach does not scale well. + +Proposal +======== + +Because the number of spare types available in the P2M type-space is +currently very limited it is proposed that HVMMEM\_mmio\_write\_dm be +replaced by a single new type HVMMEM\_ioreq\_server. In future, if the +P2M type-space is increased, this can be renamed to HVMMEM\_ioreq\_server0 +and new HVMMEM\_ioreq\_server1, HVMMEM\_ioreq\_server2, etc. types +can be added. + +Accesses to a page of type HVMMEM\_ioreq\_serverX should be the same as +HVMMEM\_ram\_rw until the type is _claimed_ by an IOREQ server. Furthermore +it should only be possible to set the type of a page to +HVMMEM\_ioreq\_serverX if that page is currently of type HVMMEM\_ram\_rw. + +To allow an IOREQ server to claim or release a claim to a type a new pair +of hypercalls will be introduced: + +- HVMOP\_map\_mem\_type\_to\_ioreq\_server +- HVMOP\_unmap\_mem\_type\_from\_ioreq\_server + +and an associated argument structure: + + struct hvm_ioreq_mem_type { + domid_t domid; /* IN - domain to be serviced */ + ioservid_t id; /* IN - server id */ + hvmmem_type_t type; /* IN - memory type */ + uint32_t flags; /* IN - types of access to be + intercepted */ + + #define _HVMOP_IOREQ_MEM_ACCESS_READ 0 + #define HVMOP_IOREQ_MEM_ACCESS_READ \ + (1 << _HVMOP_IOREQ_MEM_ACCESS_READ) + + #define _HVMOP_IOREQ_MEM_ACCESS_WRITE 1 + #define HVMOP_IOREQ_MEM_ACCESS_WRITE \ + (1 << _HVMOP_IOREQ_MEM_ACCESS_WRITE) + + }; + + +Once the type has been claimed then the requested types of access to any +page of the claimed type will be passed to the IOREQ server for handling. +Only HVMMEM\_ioreq\_serverX types may be claimed.
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Quoted 6 lines · Paul Durrant
This patch adds a new 'designs' subdirectory under docs as a repository for this and future design proposals.
Signed-off-by Paul Durrant <[email protected]>---
Quoted 7 lines
For convenience this document can also be viewed in PDF at:
http://xenbits.xen.org/people/pauldu/hvmmem_ioreq_server.pdf
--- docs/designs/hvmmem_ioreq_server.md | 63 +++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100755 docs/designs/hvmmem_ioreq_server.md
If you name it .markdown, the docs buildsystem will be able to publish it automatically. Alternatively, teach the build system about .md.
On the other hand, .pandoc tends to end up making nicer PDFs.
Quoted 12 lines
docs/designs/hvmmem_ioreq_server.md new file +5
-0@@ -0,0 +1,63 @@ +HVMMEM\_ioreq\_serverX +---------------------- + +Background +==========
docs/designs/hvmmem_ioreq_server.md line 15
Quoted 10 lines
docs/designs/hvmmem_ioreq_server.md new file +10
-0+ +The concept of the IOREQ server was introduced to allow multiple distinct +device emulators to a single VM. The XenGT project uses an IOREQ server to +provide mediated pass-through of Intel GPUs to guests and, as part of the +mediation, needs to intercept accesses to GPU page-tables (or GTTs) that +reside in guest RAM. + +The current implementation of this sets the type of GTT pages to type +HVMMEM\_mmio\_write\_dm, which causes Xen to emulate writes to such pages, +and then maps the guest physical addresses of those pages to the XenGT
"then sends the guest physical" surely?
Quoted 27 lines
docs/designs/hvmmem_ioreq_server.md new file +27
-0+IOREQ server using the HVMOP\_map\_io\_range\_to\_ioreq\_server hypercall. +However, because the number of GTTs is potentially large, using this +approach does not scale well. + +Proposal +======== + +Because the number of spare types available in the P2M type-space is +currently very limited it is proposed that HVMMEM\_mmio\_write\_dm be +replaced by a single new type HVMMEM\_ioreq\_server. In future, if the +P2M type-space is increased, this can be renamed to HVMMEM\_ioreq\_server0 +and new HVMMEM\_ioreq\_server1, HVMMEM\_ioreq\_server2, etc. types +can be added. + +Accesses to a page of type HVMMEM\_ioreq\_serverX should be the same as +HVMMEM\_ram\_rw until the type is _claimed_ by an IOREQ server. Furthermore +it should only be possible to set the type of a page to +HVMMEM\_ioreq\_serverX if that page is currently of type HVMMEM\_ram\_rw. + +To allow an IOREQ server to claim or release a claim to a type a new pair +of hypercalls will be introduced: + +- HVMOP\_map\_mem\_type\_to\_ioreq\_server +- HVMOP\_unmap\_mem\_type\_from\_ioreq\_server + +and an associated argument structure: +
docs/designs/hvmmem_ioreq_server.md line 52
Quoted 10 lines
docs/designs/hvmmem_ioreq_server.md new file +10
-0+ struct hvm_ioreq_mem_type { + domid_t domid; /* IN - domain to be serviced */ + ioservid_t id; /* IN - server id */ + hvmmem_type_t type; /* IN - memory type */ + uint32_t flags; /* IN - types of access to be + intercepted */ + + #define _HVMOP_IOREQ_MEM_ACCESS_READ 0 + #define HVMOP_IOREQ_MEM_ACCESS_READ \ + (1 << _HVMOP_IOREQ_MEM_ACCESS_READ)
(1U << ...)
docs/designs/hvmmem_ioreq_server.md line 63
Quoted 11 lines
docs/designs/hvmmem_ioreq_server.md new file +11
-0+ + #define _HVMOP_IOREQ_MEM_ACCESS_WRITE 1 + #define HVMOP_IOREQ_MEM_ACCESS_WRITE \ + (1 << _HVMOP_IOREQ_MEM_ACCESS_WRITE) + + }; + + +Once the type has been claimed then the requested types of access to any +page of the claimed type will be passed to the IOREQ server for handling. +Only HVMMEM\_ioreq\_serverX types may be claimed.
LGTM.
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 19 lines
-----Original Message-----
From: Andrew Cooper [mailto:[email protected]]
Sent: 25 February 2016 16:28
To: Paul Durrant; [email protected]
Subject: Re: [Xen-devel] [PATCH] docs/design: introduceHVMMEM_ioreq_serverXtypesQuoted 11 lines · Paul Durrant
This patch adds a new 'designs' subdirectory under docs as a repository for this and future design proposals.
Signed-off-by Paul Durrant <[email protected]>---
For convenience this document can also be viewed in PDF at:
http://xenbits.xen.org/people/pauldu/hvmmem_ioreq_server.pdf
--- docs/designs/hvmmem_ioreq_server.md | 63
Quoted 9 lines
+++++++++++++++++++++++++++++++++++++
Quoted 2 lines
1 file changed, 63 insertions(+) create mode 100755 docs/designs/hvmmem_ioreq_server.mdIf you name it .markdown, the docs buildsystem will be able to publish it automatically. Alternatively, teach the build system about .md.
On the other hand, .pandoc tends to end up making nicer PDFs.
Ok. Good idea. I'll look at doing that.
Quoted 66 lines
Review
Quoted 2 lines
(quoted diff) +0
-0
b/docs/designs/hvmmem_ioreq_server.mddocs/designs/hvmmem_ioreq_server.md line 8
Quoted 13 lines
new file mode 100755
index 0000000..47fa715docs/designs/hvmmem_ioreq_server.md new file +8
-0@@ -0,0 +1,63 @@ +HVMMEM\_ioreq\_serverX +---------------------- + +Background +========== + +The concept of the IOREQ server was introduced to allow multiple distinct +device emulators to a single VM. The XenGT project uses an IOREQ serverto
docs/designs/hvmmem_ioreq_server.md
Quoted 6 lines
docs/designs/hvmmem_ioreq_server.md new file +6
-0+provide mediated pass-through of Intel GPUs to guests and, as part of the +mediation, needs to intercept accesses to GPU page-tables (or GTTs) that +reside in guest RAM. + +The current implementation of this sets the type of GTT pages to type +HVMMEM\_mmio\_write\_dm, which causes Xen to emulate writes tosuch pages,
docs/designs/hvmmem_ioreq_server.md line 15
Quoted 1 line
docs/designs/hvmmem_ioreq_server.md new file +1
-0+and then maps the guest physical addresses of those pages to the XenGT"then sends the guest physical" surely?
docs/designs/hvmmem_ioreq_server.md line 16
Quoted 1 line
docs/designs/hvmmem_ioreq_server.md new file +1
-0+IOREQ server using the HVMOP\_map\_io\_range\_to\_ioreq\_serverhypercall.
docs/designs/hvmmem_ioreq_server.md
Quoted 8 lines
docs/designs/hvmmem_ioreq_server.md new file +8
-0+However, because the number of GTTs is potentially large, using this +approach does not scale well. + +Proposal +======== + +Because the number of spare types available in the P2M type-space is +currently very limited it is proposed that HVMMEM\_mmio\_write\_dmbe
docs/designs/hvmmem_ioreq_server.md line 26
Quoted 2 lines
docs/designs/hvmmem_ioreq_server.md new file +2
-0+replaced by a single new type HVMMEM\_ioreq\_server. In future, if the +P2M type-space is increased, this can be renamed toHVMMEM\_ioreq\_server0
docs/designs/hvmmem_ioreq_server.md line 27
Quoted 1 line
docs/designs/hvmmem_ioreq_server.md new file +1
-0+and new HVMMEM\_ioreq\_server1, HVMMEM\_ioreq\_server2, etc.types
docs/designs/hvmmem_ioreq_server.md
Quoted 3 lines
docs/designs/hvmmem_ioreq_server.md new file +3
-0+can be added. + +Accesses to a page of type HVMMEM\_ioreq\_serverX should be thesame as
docs/designs/hvmmem_ioreq_server.md line 31
Quoted 1 line
docs/designs/hvmmem_ioreq_server.md new file +1
-0+HVMMEM\_ram\_rw until the type is _claimed_ by an IOREQ server.Furthermore
docs/designs/hvmmem_ioreq_server.md line 33
Quoted 2 lines
docs/designs/hvmmem_ioreq_server.md new file +2
-0+it should only be possible to set the type of a page to +HVMMEM\_ioreq\_serverX if that page is currently of typeHVMMEM\_ram\_rw.
Quoted 13 lines
docs/designs/hvmmem_ioreq_server.md new file +13
-0+ +To allow an IOREQ server to claim or release a claim to a type a new pair +of hypercalls will be introduced: + +- HVMOP\_map\_mem\_type\_to\_ioreq\_server +- HVMOP\_unmap\_mem\_type\_from\_ioreq\_server + +and an associated argument structure: + + struct hvm_ioreq_mem_type { + domid_t domid; /* IN - domain to be serviced */ + ioservid_t id; /* IN - server id */ + hvmmem_type_t type; /* IN - memory type */
Quoted 9 lines
docs/designs/hvmmem_ioreq_server.md line 52
Quoted 6 lines
docs/designs/hvmmem_ioreq_server.md new file +6
-0+ uint32_t flags; /* IN - types of access to be + intercepted */ + + #define _HVMOP_IOREQ_MEM_ACCESS_READ 0 + #define HVMOP_IOREQ_MEM_ACCESS_READ \ + (1 << _HVMOP_IOREQ_MEM_ACCESS_READ)(1U << ...)
Yep. Should be.
Quoted 10 lines
docs/designs/hvmmem_ioreq_server.md
Quoted 9 lines
docs/designs/hvmmem_ioreq_server.md new file +9
-0+ + #define _HVMOP_IOREQ_MEM_ACCESS_WRITE 1 + #define HVMOP_IOREQ_MEM_ACCESS_WRITE \ + (1 << _HVMOP_IOREQ_MEM_ACCESS_WRITE) + + }; + + +Once the type has been claimed then the requested types of access toany
Quoted 4 lines
docs/designs/hvmmem_ioreq_server.md line 63
Quoted 2 lines
docs/designs/hvmmem_ioreq_server.md new file +2
-0+page of the claimed type will be passed to the IOREQ server for handling. +Only HVMMEM\_ioreq\_serverX types may be claimed.LGTM.
Thanks :-)
Paul
Quoted 2 lines
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 15 lines
Quoted 1 line
Quoted 1 line · On 25.02.16 at 16:49, <[email protected]> wrote:
docs/designs/hvmmem_ioreq_server.md new file +14
-0+To allow an IOREQ server to claim or release a claim to a type a new pair +of hypercalls will be introduced: + +- HVMOP\_map\_mem\_type\_to\_ioreq\_server +- HVMOP\_unmap\_mem\_type\_from\_ioreq\_server + +and an associated argument structure: + + struct hvm_ioreq_mem_type { + domid_t domid; /* IN - domain to be serviced */ + ioservid_t id; /* IN - server id */ + hvmmem_type_t type; /* IN - memory type */ + uint32_t flags; /* IN - types of access to be + intercepted */
docs/designs/hvmmem_ioreq_server.md line 58
Quoted 10 lines
docs/designs/hvmmem_ioreq_server.md new file +10
-0+ + #define _HVMOP_IOREQ_MEM_ACCESS_READ 0 + #define HVMOP_IOREQ_MEM_ACCESS_READ \ + (1 << _HVMOP_IOREQ_MEM_ACCESS_READ) + + #define _HVMOP_IOREQ_MEM_ACCESS_WRITE 1 + #define HVMOP_IOREQ_MEM_ACCESS_WRITE \ + (1 << _HVMOP_IOREQ_MEM_ACCESS_WRITE) + + };
How about having just one new hypercall, with flags being zero meaning "unmap"?
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 29 lines
-----Original Message-----
From: Xen-devel [mailto:[email protected]] On Behalf Of Jan Beulich
Sent: 25 February 2016 16:48
To: Paul Durrant
Cc: [email protected]
Subject: Re: [Xen-devel] [PATCH] docs/design: introduceHVMMEM_ioreq_serverXtypesQuoted 20 lines
Quoted 1 line
Quoted 1 line · On 25.02.16 at 16:49, <[email protected]> wrote:
docs/designs/hvmmem_ioreq_server.md new file +19
-0+To allow an IOREQ server to claim or release a claim to a type a new pair +of hypercalls will be introduced: + +- HVMOP\_map\_mem\_type\_to\_ioreq\_server +- HVMOP\_unmap\_mem\_type\_from\_ioreq\_server + +and an associated argument structure: + + struct hvm_ioreq_mem_type { + domid_t domid; /* IN - domain to be serviced */ + ioservid_t id; /* IN - server id */ + hvmmem_type_t type; /* IN - memory type */ + uint32_t flags; /* IN - types of access to be + intercepted */ + + #define _HVMOP_IOREQ_MEM_ACCESS_READ 0 + #define HVMOP_IOREQ_MEM_ACCESS_READ \ + (1 << _HVMOP_IOREQ_MEM_ACCESS_READ) +
Quoted 8 lines
docs/designs/hvmmem_ioreq_server.md line 58
Quoted 5 lines
docs/designs/hvmmem_ioreq_server.md new file +5
-0+ #define _HVMOP_IOREQ_MEM_ACCESS_WRITE 1 + #define HVMOP_IOREQ_MEM_ACCESS_WRITE \ + (1 << _HVMOP_IOREQ_MEM_ACCESS_WRITE) + + };How about having just one new hypercall, with flags being zero meaning "unmap"?
Hmm, yes we could do it that way. I saves an op code so I'll re-spin the doc.
Thanks,
Paul
Quoted 8 lines
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 48 lines
From: Paul Durrant
Sent: Thursday, February 25, 2016 11:49 PMThis patch adds a new 'designs' subdirectory under docs as a repository for this and future design proposals.
Signed-off-by Paul Durrant <[email protected]>---
For convenience this document can also be viewed in PDF at:
http://xenbits.xen.org/people/pauldu/hvmmem_ioreq_server.pdf
--- docs/designs/hvmmem_ioreq_server.md | 63 +++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100755 docs/designs/hvmmem_ioreq_server.mddocs/designs/hvmmem_ioreq_server.md new file +23
-0@@ -0,0 +1,63 @@ +HVMMEM\_ioreq\_serverX +---------------------- + +Background +========== + +The concept of the IOREQ server was introduced to allow multiple distinct +device emulators to a single VM. The XenGT project uses an IOREQ server to +provide mediated pass-through of Intel GPUs to guests and, as part of the +mediation, needs to intercept accesses to GPU page-tables (or GTTs) that +reside in guest RAM. + +The current implementation of this sets the type of GTT pages to type +HVMMEM\_mmio\_write\_dm, which causes Xen to emulate writes to such pages, +and then maps the guest physical addresses of those pages to the XenGT +IOREQ server using the HVMOP\_map\_io\_range\_to\_ioreq\_server hypercall. +However, because the number of GTTs is potentially large, using this +approach does not scale well. + +Proposal +======== + +Because the number of spare types available in the P2M type-space is
docs/designs/hvmmem_ioreq_server.md line 33
Quoted 10 lines
docs/designs/hvmmem_ioreq_server.md new file +10
-0+currently very limited it is proposed that HVMMEM\_mmio\_write\_dm be +replaced by a single new type HVMMEM\_ioreq\_server. In future, if the +P2M type-space is increased, this can be renamed to HVMMEM\_ioreq\_server0 +and new HVMMEM\_ioreq\_server1, HVMMEM\_ioreq\_server2, etc. types +can be added. + +Accesses to a page of type HVMMEM\_ioreq\_serverX should be the same as +HVMMEM\_ram\_rw until the type is _claimed_ by an IOREQ server. Furthermore +it should only be possible to set the type of a page to +HVMMEM\_ioreq\_serverX if that page is currently of type HVMMEM\_ram\_rw.
Is there similar assumption on the opposite change, i.e. from ioreq_serverX only to ram_rw?
Quoted 21 lines
docs/designs/hvmmem_ioreq_server.md new file +21
-0+ +To allow an IOREQ server to claim or release a claim to a type a new pair +of hypercalls will be introduced: + +- HVMOP\_map\_mem\_type\_to\_ioreq\_server +- HVMOP\_unmap\_mem\_type\_from\_ioreq\_server + +and an associated argument structure: + + struct hvm_ioreq_mem_type { + domid_t domid; /* IN - domain to be serviced */ + ioservid_t id; /* IN - server id */ + hvmmem_type_t type; /* IN - memory type */ + uint32_t flags; /* IN - types of access to be + intercepted */ + + #define _HVMOP_IOREQ_MEM_ACCESS_READ 0 + #define HVMOP_IOREQ_MEM_ACCESS_READ \ + (1 << _HVMOP_IOREQ_MEM_ACCESS_READ) + + #define _HVMOP_IOREQ_MEM_ACCESS_WRITE 1
docs/designs/hvmmem_ioreq_server.md
Quoted 10 lines
docs/designs/hvmmem_ioreq_server.md new file +9
-1+ #define HVMOP_IOREQ_MEM_ACCESS_WRITE \ + (1 << _HVMOP_IOREQ_MEM_ACCESS_WRITE) + + }; + + +Once the type has been claimed then the requested types of access to any +page of the claimed type will be passed to the IOREQ server for handling. +Only HVMMEM\_ioreq\_serverX types may be claimed. --
It'd good to also add how to handle multiple ioreq servers claiming one same type for a given domain.
Thanks
Kevin
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 10 lines
Quoted 10 lines
Quoted 1 line · On 26.02.16 at 05:24, <[email protected]> wrote:
docs/designs/hvmmem_ioreq_server.md new file +9
-0+Proposal +======== + +Because the number of spare types available in the P2M type-space is +currently very limited it is proposed that HVMMEM\_mmio\_write\_dm be +replaced by a single new type HVMMEM\_ioreq\_server. In future, if the +P2M type-space is increased, this can be renamed to HVMMEM\_ioreq\_server0 +and new HVMMEM\_ioreq\_server1, HVMMEM\_ioreq\_server2, etc. types +can be added.
Quoted 8 lines
docs/designs/hvmmem_ioreq_server.md line 33
Quoted 5 lines
docs/designs/hvmmem_ioreq_server.md new file +5
-0+ +Accesses to a page of type HVMMEM\_ioreq\_serverX should be the same as +HVMMEM\_ram\_rw until the type is _claimed_ by an IOREQ server. Furthermore +it should only be possible to set the type of a page to +HVMMEM\_ioreq\_serverX if that page is currently of type HVMMEM\_ram\_rw.Is there similar assumption on the opposite change, i.e. from
ioreq_serverXonly toram_rw?
Yes. The above should be re-worded to make clear this is a bi-directional requirement.
Quoted 25 lines
Quoted 25 lines
docs/designs/hvmmem_ioreq_server.md new file +25
-0+To allow an IOREQ server to claim or release a claim to a type a new pair +of hypercalls will be introduced: + +- HVMOP\_map\_mem\_type\_to\_ioreq\_server +- HVMOP\_unmap\_mem\_type\_from\_ioreq\_server + +and an associated argument structure: + + struct hvm_ioreq_mem_type { + domid_t domid; /* IN - domain to be serviced */ + ioservid_t id; /* IN - server id */ + hvmmem_type_t type; /* IN - memory type */ + uint32_t flags; /* IN - types of access to be + intercepted */ + + #define _HVMOP_IOREQ_MEM_ACCESS_READ 0 + #define HVMOP_IOREQ_MEM_ACCESS_READ \ + (1 << _HVMOP_IOREQ_MEM_ACCESS_READ) + + #define _HVMOP_IOREQ_MEM_ACCESS_WRITE 1 + #define HVMOP_IOREQ_MEM_ACCESS_WRITE \ + (1 << _HVMOP_IOREQ_MEM_ACCESS_WRITE) + + }; +
Quoted 8 lines
docs/designs/hvmmem_ioreq_server.md
Quoted 5 lines
docs/designs/hvmmem_ioreq_server.md new file +4
-1+ +Once the type has been claimed then the requested types of access to any +page of the claimed type will be passed to the IOREQ server for handling. +Only HVMMEM\_ioreq\_serverX types may be claimed. --It'd good to also add how to handle multiple ioreq servers claiming one same type for a given domain.
It's going to fail, but I agree that perhaps this would better be spelled out.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 69 lines
-----Original Message-----
From: Tian, Kevin [mailto:[email protected]]
Sent: 26 February 2016 04:25
To: Paul Durrant; [email protected]
Subject: RE: [Xen-devel] [PATCH] docs/design: introduceHVMMEM_ioreq_serverXtypesQuoted 25 lines
From: Paul Durrant
Sent: Thursday, February 25, 2016 11:49 PMThis patch adds a new 'designs' subdirectory under docs as a repository for this and future design proposals.
Signed-off-by Paul Durrant <[email protected]>---
For convenience this document can also be viewed in PDF at:
http://xenbits.xen.org/people/pauldu/hvmmem_ioreq_server.pdf
--- docs/designs/hvmmem_ioreq_server.md | 63 +++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100755 docs/designs/hvmmem_ioreq_server.mddocs/designs/hvmmem_ioreq_server.md new file +0
-0docs/designs/hvmmem_ioreq_server.md line 8
Quoted 8 lines
docs/designs/hvmmem_ioreq_server.md new file +8
-0@@ -0,0 +1,63 @@ +HVMMEM\_ioreq\_serverX +---------------------- + +Background +========== + +The concept of the IOREQ server was introduced to allow multiple distinct +device emulators to a single VM. The XenGT project uses an IOREQ serverto
docs/designs/hvmmem_ioreq_server.md
Quoted 6 lines
docs/designs/hvmmem_ioreq_server.md new file +6
-0+provide mediated pass-through of Intel GPUs to guests and, as part of the +mediation, needs to intercept accesses to GPU page-tables (or GTTs) that +reside in guest RAM. + +The current implementation of this sets the type of GTT pages to type +HVMMEM\_mmio\_write\_dm, which causes Xen to emulate writes tosuch pages,
docs/designs/hvmmem_ioreq_server.md line 16
Quoted 2 lines
docs/designs/hvmmem_ioreq_server.md new file +2
-0+and then maps the guest physical addresses of those pages to the XenGT +IOREQ server using the HVMOP\_map\_io\_range\_to\_ioreq\_serverhypercall.
docs/designs/hvmmem_ioreq_server.md
Quoted 8 lines
docs/designs/hvmmem_ioreq_server.md new file +8
-0+However, because the number of GTTs is potentially large, using this +approach does not scale well. + +Proposal +======== + +Because the number of spare types available in the P2M type-space is +currently very limited it is proposed that HVMMEM\_mmio\_write\_dmbe
docs/designs/hvmmem_ioreq_server.md line 26
Quoted 2 lines
docs/designs/hvmmem_ioreq_server.md new file +2
-0+replaced by a single new type HVMMEM\_ioreq\_server. In future, if the +P2M type-space is increased, this can be renamed toHVMMEM\_ioreq\_server0
docs/designs/hvmmem_ioreq_server.md line 27
Quoted 1 line
docs/designs/hvmmem_ioreq_server.md new file +1
-0+and new HVMMEM\_ioreq\_server1, HVMMEM\_ioreq\_server2, etc.types
docs/designs/hvmmem_ioreq_server.md
Quoted 3 lines
docs/designs/hvmmem_ioreq_server.md new file +3
-0+can be added. + +Accesses to a page of type HVMMEM\_ioreq\_serverX should be thesame as
Quoted 9 lines
docs/designs/hvmmem_ioreq_server.md line 31
Quoted 1 line
docs/designs/hvmmem_ioreq_server.md new file +1
-0+HVMMEM\_ram\_rw until the type is _claimed_ by an IOREQ server.Furthermore
docs/designs/hvmmem_ioreq_server.md line 33
Quoted 2 lines
docs/designs/hvmmem_ioreq_server.md new file +2
-0+it should only be possible to set the type of a page to +HVMMEM\_ioreq\_serverX if that page is currently of typeHVMMEM\_ram\_rw.
Is there similar assumption on the opposite change, i.e. from
ioreq_serverXonly toram_rw?
Yes, I will call that out.
Quoted 29 lines
Quoted 18 lines
docs/designs/hvmmem_ioreq_server.md new file +18
-0+ +To allow an IOREQ server to claim or release a claim to a type a new pair +of hypercalls will be introduced: + +- HVMOP\_map\_mem\_type\_to\_ioreq\_server +- HVMOP\_unmap\_mem\_type\_from\_ioreq\_server + +and an associated argument structure: + + struct hvm_ioreq_mem_type { + domid_t domid; /* IN - domain to be serviced */ + ioservid_t id; /* IN - server id */ + hvmmem_type_t type; /* IN - memory type */ + uint32_t flags; /* IN - types of access to be + intercepted */ + + #define _HVMOP_IOREQ_MEM_ACCESS_READ 0 + #define HVMOP_IOREQ_MEM_ACCESS_READ \docs/designs/hvmmem_ioreq_server.md
Quoted 10 lines
docs/designs/hvmmem_ioreq_server.md new file +10
-0+ (1 << _HVMOP_IOREQ_MEM_ACCESS_READ) + + #define _HVMOP_IOREQ_MEM_ACCESS_WRITE 1 + #define HVMOP_IOREQ_MEM_ACCESS_WRITE \ + (1 << _HVMOP_IOREQ_MEM_ACCESS_WRITE) + + }; + + +Once the type has been claimed then the requested types of access toany
Quoted 7 lines
docs/designs/hvmmem_ioreq_server.md
Quoted 3 lines
docs/designs/hvmmem_ioreq_server.md new file +2
-1+page of the claimed type will be passed to the IOREQ server for handling. +Only HVMMEM\_ioreq\_serverX types may be claimed. --It'd good to also add how to handle multiple ioreq servers claiming one same type for a given domain.
That would clearly be an error so I imagine -EBUSY would be an appropriate return value from the map hypercall.
Paul
Quoted 2 lines
Thanks
Kevin
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Hi Paul,
Thanks a lot for your help on this! And below are my questions.
Quoted 41 lines · Paul Durrant
This patch adds a new 'designs' subdirectory under docs as a repository for this and future design proposals.
Signed-off-by Paul Durrant <[email protected]>---
For convenience this document can also be viewed in PDF at:
http://xenbits.xen.org/people/pauldu/hvmmem_ioreq_server.pdf
--- docs/designs/hvmmem_ioreq_server.md | 63 +++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+)create mode 100755
docs/designs/hvmmem_ioreq_server.mddocs/designs/hvmmem_ioreq_server.md new file +21
-0@@ -0,0 +1,63 @@ +HVMMEM\_ioreq\_serverX +---------------------- + +Background +========== + +The concept of the IOREQ server was introduced to allow multiple distinct +device emulators to a single VM. The XenGT project uses an IOREQ server to +provide mediated pass-through of Intel GPUs to guests and, as part of the +mediation, needs to intercept accesses to GPU page-tables (or GTTs) that +reside in guest RAM. + +The current implementation of this sets the type of GTT pages to type +HVMMEM\_mmio\_write\_dm, which causes Xen to emulate writes to such pages, +and then maps the guest physical addresses of those pages to the XenGT +IOREQ server using the HVMOP\_map\_io\_range\_to\_ioreq\_server hypercall. +However, because the number of GTTs is potentially large, using this +approach does not scale well. + +Proposal +========
docs/designs/hvmmem_ioreq_server.md line 31
Quoted 10 lines
docs/designs/hvmmem_ioreq_server.md new file +10
-0+ +Because the number of spare types available in the P2M type-space is +currently very limited it is proposed that HVMMEM\_mmio\_write\_dm be +replaced by a single new type HVMMEM\_ioreq\_server. In future, if the +P2M type-space is increased, this can be renamed to HVMMEM\_ioreq\_server0 +and new HVMMEM\_ioreq\_server1, HVMMEM\_ioreq\_server2, etc. types +can be added. + +Accesses to a page of type HVMMEM\_ioreq\_serverX should be the same as +HVMMEM\_ram\_rw until the type is _claimed_ by an IOREQ server. Furthermore
Sorry, do you mean even when a gfn is set to HVMMEM_ioreq_serverX type, its access rights in P2M still remains unchanged? So the new hypercall pair, HVMOP_[un]map_mem_type_to_ioreq_server, are also responsible for the PTE updates on the access bits?
If it is true, I'm afraid this would be time consuming, because the map/unmap will have to traverse all P2M structures to detect the PTEs with HVMMEM_ioreq_serverX flag set. Yet in XenGT, setting this flag is triggered dynamically with the construction/destruction of shadow PPGTT. But I'm not sure to which degree the performance casualties will be, with frequent EPT table walk and EPT tlb flush.
If it is not, I guess we can(e.g. when trying to WP a gfn):
1> use HVMOP_set_mem_type to set the HVMMEM_ioreq_serverX flag, which for the write protected case works the same as HVMMEM_mmio_write_dm; If successful, accesses to a page of type HVMMEM_ioreq_serverX should trigger the ioreq server selection path, but will be discarded. 2> after HVMOP_map_mem_type_to_ioreq_server is called, all accesses to this pages of type HVMMEM_ioreq_serverX would be forwarded to a specified ioreq server.
As to XenGT backend device model, we only need to use the map hypercall once when trying to contruct the first shadow PPGTT, and use the unmap hypercall when a VM is going to be torn down.
Any suggestions? :)
Thanks
Yu
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 19 lines
docs/designs/hvmmem_ioreq_server.md line 31
Quoted 13 lines
Quoted 1 line · On 26.02.16 at 07:59, <[email protected]> wrote:
docs/designs/hvmmem_ioreq_server.md new file +12
-0+Proposal +======== + +Because the number of spare types available in the P2M type-space is +currently very limited it is proposed that HVMMEM\_mmio\_write\_dm be +replaced by a single new type HVMMEM\_ioreq\_server. In future, if the +P2M type-space is increased, this can be renamed to HVMMEM\_ioreq\_server0 +and new HVMMEM\_ioreq\_server1, HVMMEM\_ioreq\_server2, etc. types +can be added. + +Accesses to a page of type HVMMEM\_ioreq\_serverX should be the same as +HVMMEM\_ram\_rw until the type is _claimed_ by an IOREQ server. FurthermoreSorry, do you mean even when a gfn is set to
HVMMEM_ioreq_serverXtype, its access rights in P2M still remains unchanged? So the new hypercall pair, HVMOP_[un]map_mem_type_to_ioreq_server, are also responsible for the PTE updates on the access bits?
Quoted 6 lines
If it is true, I'm afraid this would be time consuming, because the map/unmap will have to traverse all P2M structures to detect the PTEs with
HVMMEM_ioreq_serverXflag set. Yet in XenGT, setting this flag is triggered dynamically with the construction/destruction of shadow PPGTT. But I'm not sure to which degree the performance casualties will be, with frequent EPT table walk and EPT tlb flush.
No walking of EPT trees will be necessary in that case, just like it already has been made unnecessary for other changes resulting in various PTE attributes needing re-calculation. We'll only need to extend the p2m_memory_type_changed() mechanism to cover changes like this one.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 26 lines · Jan Beulich
Quoted 19 lines
docs/designs/hvmmem_ioreq_server.md line 31
Quoted 13 lines
Quoted 1 line · On 26.02.16 at 07:59, <[email protected]> wrote:
docs/designs/hvmmem_ioreq_server.md new file +12
-0+Proposal +======== + +Because the number of spare types available in the P2M type-space is +currently very limited it is proposed that HVMMEM\_mmio\_write\_dm be +replaced by a single new type HVMMEM\_ioreq\_server. In future, if the +P2M type-space is increased, this can be renamed to HVMMEM\_ioreq\_server0 +and new HVMMEM\_ioreq\_server1, HVMMEM\_ioreq\_server2, etc. types +can be added. + +Accesses to a page of type HVMMEM\_ioreq\_serverX should be the same as +HVMMEM\_ram\_rw until the type is _claimed_ by an IOREQ server. FurthermoreSorry, do you mean even when a gfn is set to
HVMMEM_ioreq_serverXtype, its access rights in P2M still remains unchanged? So the new hypercall pair, HVMOP_[un]map_mem_type_to_ioreq_server, are also responsible for the PTE updates on the access bits?Quoted 6 lines
If it is true, I'm afraid this would be time consuming, because the map/unmap will have to traverse all P2M structures to detect the PTEs with
HVMMEM_ioreq_serverXflag set. Yet in XenGT, setting this flag is triggered dynamically with the construction/destruction of shadow PPGTT. But I'm not sure to which degree the performance casualties will be, with frequent EPT table walk and EPT tlb flush.
Quoted 5 lines
No walking of EPT trees will be necessary in that case, just like it already has been made unnecessary for other changes resulting in various PTE attributes needing re-calculation. We'll only need to extend the
p2m_memory_type_changed()mechanism to cover changes like this one.
So you mean when the access bits are to be updated, we can leverage something like p2m_memory_type_changed(which I guess only deals with memory types, not access bits) to avoid the walking of EPT trees? I'll need to study this part.
Anyway, thanks for your advice. :)
B.R.
Yu
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 50 lines
-----Original Message-----
From: Yu, Zhang [mailto:[email protected]]
Sent: 26 February 2016 09:37
To: Jan Beulich
Cc: Paul Durrant; [email protected]
Subject: Re: [Xen-devel] [PATCH] docs/design: introduceHVMMEM_ioreq_serverXtypesQuoted 6 lines · Jan Beulich
Quoted 6 lines
docs/designs/hvmmem_ioreq_server.md
Quoted 6 lines
Quoted 1 line · On 26.02.16 at 07:59, <[email protected]> wrote:
docs/designs/hvmmem_ioreq_server.md new file +5
-0+Proposal +======== + +Because the number of spare types available in the P2M type-space is +currently very limited it is proposed thatHVMMEM\_mmio\_write\_dm be
Quoted 1 line
Quoted 1 line
Quoted 1 line
+replaced by a single new type HVMMEM\_ioreq\_server. In future, if
the
Quoted 1 line
Quoted 1 line
Quoted 1 line
+P2M type-space is increased, this can be renamed to
HVMMEM\_ioreq\_server0
Quoted 1 line
Quoted 1 line
Quoted 1 line
+and new HVMMEM\_ioreq\_server1, HVMMEM\_ioreq\_server2, etc.
types
Quoted 3 lines
Quoted 3 lines
docs/designs/hvmmem_ioreq_server.md
Quoted 3 lines
docs/designs/hvmmem_ioreq_server.md new file +3
-0+can be added. + +Accesses to a page of type HVMMEM\_ioreq\_serverX should be thesame as
Quoted 1 line
Quoted 1 line
Quoted 1 line
+HVMMEM\_ram\_rw until the type is _claimed_ by an IOREQ server.
Furthermore
Quoted 2 lines
Quoted 2 lines
Sorry, do you mean even when a gfn is set to
HVMMEM_ioreq_serverXtype,
Quoted 2 lines
Quoted 2 lines
its access rights in P2M still remains unchanged? So the new hypercall pair, HVMOP_[un]map_mem_type_to_ioreq_server, are also
responsible for
Quoted 6 lines
Quoted 6 lines
the PTE updates on the access bits?
If it is true, I'm afraid this would be time consuming, because the map/unmap will have to traverse all P2M structures to detect the PTEs with
HVMMEM_ioreq_serverXflag set. Yet in XenGT, setting this flag is triggered dynamically with the construction/destruction of shadowPPGTT.
Quoted 8 lines
Quoted 2 lines
But I'm not sure to which degree the performance casualties will be, with frequent EPT table walk and EPT tlb flush.
No walking of EPT trees will be necessary in that case, just like it already has been made unnecessary for other changes resulting in various PTE attributes needing re-calculation. We'll only need to extend the
p2m_memory_type_changed()mechanism to cover changes like this one.
Quoted 4 lines
So you mean when the access bits are to be updated, we can leverage something like
p2m_memory_type_changed(which I guess only deals with memory types, not access bits)to avoid the walking of EPT trees? I'll need to study this part.
No, the P2M is walked when the map/unmap hypercall is issued but, in the XenGT use-case, that hypercall is issued once at start of day and - if everything is working as it I believe it should - there won't actually be any pages of type HVMMEM_ioreq_server at that point, so no EPT flush is required.
Quoted 1 line
Anyway, thanks for your advice. :)
I will post an implementation hopefully in the next few days once I've proved it works in my XenGT rig.
Paul
Quoted 3 lines
B.R.
Yu
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 55 lines · Paul Durrant
Quoted 50 lines
-----Original Message-----
From: Yu, Zhang [mailto:[email protected]]
Sent: 26 February 2016 09:37
To: Jan Beulich
Cc: Paul Durrant; [email protected]
Subject: Re: [Xen-devel] [PATCH] docs/design: introduceHVMMEM_ioreq_serverXtypesQuoted 6 lines · Jan Beulich
Quoted 6 lines
docs/designs/hvmmem_ioreq_server.md
Quoted 6 lines
Quoted 1 line · On 26.02.16 at 07:59, <[email protected]> wrote:
docs/designs/hvmmem_ioreq_server.md new file +5
-0+Proposal +======== + +Because the number of spare types available in the P2M type-space is +currently very limited it is proposed thatHVMMEM\_mmio\_write\_dm be
Quoted 1 line
Quoted 1 line
Quoted 1 line
+replaced by a single new type HVMMEM\_ioreq\_server. In future, if
the
Quoted 1 line
Quoted 1 line
Quoted 1 line
+P2M type-space is increased, this can be renamed to
HVMMEM\_ioreq\_server0
Quoted 1 line
Quoted 1 line
Quoted 1 line
+and new HVMMEM\_ioreq\_server1, HVMMEM\_ioreq\_server2, etc.
types
Quoted 3 lines
Quoted 3 lines
docs/designs/hvmmem_ioreq_server.md
Quoted 3 lines
docs/designs/hvmmem_ioreq_server.md new file +3
-0+can be added. + +Accesses to a page of type HVMMEM\_ioreq\_serverX should be thesame as
Quoted 1 line
Quoted 1 line
Quoted 1 line
+HVMMEM\_ram\_rw until the type is _claimed_ by an IOREQ server.
Furthermore
Quoted 2 lines
Quoted 2 lines
Sorry, do you mean even when a gfn is set to
HVMMEM_ioreq_serverXtype,
Quoted 2 lines
Quoted 2 lines
its access rights in P2M still remains unchanged? So the new hypercall pair, HVMOP_[un]map_mem_type_to_ioreq_server, are also
responsible for
Quoted 6 lines
Quoted 6 lines
the PTE updates on the access bits?
If it is true, I'm afraid this would be time consuming, because the map/unmap will have to traverse all P2M structures to detect the PTEs with
HVMMEM_ioreq_serverXflag set. Yet in XenGT, setting this flag is triggered dynamically with the construction/destruction of shadowPPGTT.
Quoted 8 lines
Quoted 2 lines
But I'm not sure to which degree the performance casualties will be, with frequent EPT table walk and EPT tlb flush.
No walking of EPT trees will be necessary in that case, just like it already has been made unnecessary for other changes resulting in various PTE attributes needing re-calculation. We'll only need to extend the
p2m_memory_type_changed()mechanism to cover changes like this one.Quoted 4 lines
So you mean when the access bits are to be updated, we can leverage something like
p2m_memory_type_changed(which I guess only deals with memory types, not access bits)to avoid the walking of EPT trees? I'll need to study this part.
Quoted 5 lines
No, the P2M is walked when the map/unmap hypercall is issued but, in the XenGT use-case, that hypercall is issued once at start of day and - if everything is working as it I believe it should - there won't actually be any pages of type
HVMMEM_ioreq_serverat that point, so no EPT flush is required.Quoted 1 line
Anyway, thanks for your advice. :)
I will post an implementation hopefully in the next few days once I've proved it works in my XenGT rig.
Great. Looking forward to this implementation, and thanks for your help. :)
B.R.
Yu
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 72 lines
-----Original Message-----
From: Yu, Zhang [mailto:[email protected]]
Sent: 26 February 2016 06:59
To: Paul Durrant; [email protected]
Subject: Re: [Xen-devel] [PATCH] docs/design: introduceHVMMEM_ioreq_serverXtypesHi Paul,
Thanks a lot for your help on this! And below are my questions.
Quoted 11 lines · Paul Durrant
This patch adds a new 'designs' subdirectory under docs as a repository for this and future design proposals.
Signed-off-by Paul Durrant <[email protected]>---
For convenience this document can also be viewed in PDF at:
http://xenbits.xen.org/people/pauldu/hvmmem_ioreq_server.pdf
--- docs/designs/hvmmem_ioreq_server.md | 63+++++++++++++++++++++++++++++++++++++
Review
Quoted 4 lines
1 file changed, 63 insertions(+)create mode 100755
docs/designs/hvmmem_ioreq_server.md(quoted diff) +0
-0
b/docs/designs/hvmmem_ioreq_server.mddocs/designs/hvmmem_ioreq_server.md line 8
Quoted 13 lines
new file mode 100755
index 0000000..47fa715docs/designs/hvmmem_ioreq_server.md new file +8
-0@@ -0,0 +1,63 @@ +HVMMEM\_ioreq\_serverX +---------------------- + +Background +========== + +The concept of the IOREQ server was introduced to allow multiple distinct +device emulators to a single VM. The XenGT project uses an IOREQ serverto
docs/designs/hvmmem_ioreq_server.md
Quoted 6 lines
docs/designs/hvmmem_ioreq_server.md new file +6
-0+provide mediated pass-through of Intel GPUs to guests and, as part of the +mediation, needs to intercept accesses to GPU page-tables (or GTTs) that +reside in guest RAM. + +The current implementation of this sets the type of GTT pages to type +HVMMEM\_mmio\_write\_dm, which causes Xen to emulate writes tosuch pages,
docs/designs/hvmmem_ioreq_server.md line 16
Quoted 2 lines
docs/designs/hvmmem_ioreq_server.md new file +2
-0+and then maps the guest physical addresses of those pages to the XenGT +IOREQ server using the HVMOP\_map\_io\_range\_to\_ioreq\_serverhypercall.
docs/designs/hvmmem_ioreq_server.md
Quoted 8 lines
docs/designs/hvmmem_ioreq_server.md new file +8
-0+However, because the number of GTTs is potentially large, using this +approach does not scale well. + +Proposal +======== + +Because the number of spare types available in the P2M type-space is +currently very limited it is proposed that HVMMEM\_mmio\_write\_dmbe
docs/designs/hvmmem_ioreq_server.md line 26
Quoted 2 lines
docs/designs/hvmmem_ioreq_server.md new file +2
-0+replaced by a single new type HVMMEM\_ioreq\_server. In future, if the +P2M type-space is increased, this can be renamed toHVMMEM\_ioreq\_server0
docs/designs/hvmmem_ioreq_server.md line 27
Quoted 1 line
docs/designs/hvmmem_ioreq_server.md new file +1
-0+and new HVMMEM\_ioreq\_server1, HVMMEM\_ioreq\_server2, etc.types
docs/designs/hvmmem_ioreq_server.md
Quoted 3 lines
docs/designs/hvmmem_ioreq_server.md new file +3
-0+can be added. + +Accesses to a page of type HVMMEM\_ioreq\_serverX should be thesame as
docs/designs/hvmmem_ioreq_server.md line 31
Quoted 1 line
docs/designs/hvmmem_ioreq_server.md new file +1
-0+HVMMEM\_ram\_rw until the type is _claimed_ by an IOREQ server.
Quoted 8 lines
Furthermore
Sorry, do you mean even when a gfn is set to
HVMMEM_ioreq_serverXtype,
its access rights in P2M still remains unchanged? So the new hypercall pair, HVMOP_[un]map_mem_type_to_ioreq_server, are also responsible for
the PTE updates on the access bits?
Yes, the access bits would not change *on existing* pages of this type until the type is claimed.
Quoted 7 lines
If it is true, I'm afraid this would be time consuming, because the map/unmap will have to traverse all P2M structures to detect the PTEs with
HVMMEM_ioreq_serverXflag set. Yet in XenGT, setting this flag is triggered dynamically with the construction/destruction of shadow PPGTT. But I'm not sure to which degree the performance casualties will be, with frequent EPT table walk and EPT tlb flush.
I don't see the concern. I am assuming XenGT would claim the type at start of day and then just to HVMOP_set_mem_type operations on PPGTT pages as necessary, which would not require p2m traversal (since that hypercall takes the gfn as an arg) and the EPT flush requirements are no different to setting the mmio_write_dm type in the current implementation.
Quoted 11 lines
If it is not, I guess we can(e.g. when trying to WP a gfn):
1> useHVMOP_set_mem_typeto set theHVMMEM_ioreq_serverXflag, which
for the write protected case works the same asHVMMEM_mmio_write_dm; If successful, accesses to a page of typeHVMMEM_ioreq_serverXshould trigger the ioreq server selection path, but will be discarded. 2> afterHVMOP_map_mem_type_to_ioreq_serveris called, all accesses to this pages of typeHVMMEM_ioreq_serverXwould be forwarded to a specified ioreq server.
Quoted 4 lines
As to XenGT backend device model, we only need to use the map hypercall once when trying to contruct the first shadow PPGTT, and use the unmap hypercall when a VM is going to be torn down.
Yes, that's correct. A single claim at start of day and a single 'unclaim' at end of day. In between the current HVMOP_set_mem_type is pretty much as before (just with the new type name) and there is no longer a need for the hypercall to map the range to the ioreq server.
Paul
Quoted 4 lines
Any suggestions? :)
Thanks
Yu
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Thanks, Paul.
Quoted 84 lines · Paul Durrant
Quoted 72 lines
-----Original Message-----
From: Yu, Zhang [mailto:[email protected]]
Sent: 26 February 2016 06:59
To: Paul Durrant; [email protected]
Subject: Re: [Xen-devel] [PATCH] docs/design: introduceHVMMEM_ioreq_serverXtypesHi Paul,
Thanks a lot for your help on this! And below are my questions.
Quoted 11 lines · Paul Durrant
This patch adds a new 'designs' subdirectory under docs as a repository for this and future design proposals.
Signed-off-by Paul Durrant <[email protected]>---
For convenience this document can also be viewed in PDF at:
http://xenbits.xen.org/people/pauldu/hvmmem_ioreq_server.pdf
--- docs/designs/hvmmem_ioreq_server.md | 63+++++++++++++++++++++++++++++++++++++
Review
Quoted 4 lines
1 file changed, 63 insertions(+)create mode 100755
docs/designs/hvmmem_ioreq_server.md(quoted diff) +0
-0
b/docs/designs/hvmmem_ioreq_server.mddocs/designs/hvmmem_ioreq_server.md line 8
Quoted 13 lines
new file mode 100755
index 0000000..47fa715docs/designs/hvmmem_ioreq_server.md new file +8
-0@@ -0,0 +1,63 @@ +HVMMEM\_ioreq\_serverX +---------------------- + +Background +========== + +The concept of the IOREQ server was introduced to allow multiple distinct +device emulators to a single VM. The XenGT project uses an IOREQ serverto
docs/designs/hvmmem_ioreq_server.md
Quoted 6 lines
docs/designs/hvmmem_ioreq_server.md new file +6
-0+provide mediated pass-through of Intel GPUs to guests and, as part of the +mediation, needs to intercept accesses to GPU page-tables (or GTTs) that +reside in guest RAM. + +The current implementation of this sets the type of GTT pages to type +HVMMEM\_mmio\_write\_dm, which causes Xen to emulate writes tosuch pages,
docs/designs/hvmmem_ioreq_server.md line 16
Quoted 2 lines
docs/designs/hvmmem_ioreq_server.md new file +2
-0+and then maps the guest physical addresses of those pages to the XenGT +IOREQ server using the HVMOP\_map\_io\_range\_to\_ioreq\_serverhypercall.
docs/designs/hvmmem_ioreq_server.md
Quoted 8 lines
docs/designs/hvmmem_ioreq_server.md new file +8
-0+However, because the number of GTTs is potentially large, using this +approach does not scale well. + +Proposal +======== + +Because the number of spare types available in the P2M type-space is +currently very limited it is proposed that HVMMEM\_mmio\_write\_dmbe
docs/designs/hvmmem_ioreq_server.md line 26
Quoted 2 lines
docs/designs/hvmmem_ioreq_server.md new file +2
-0+replaced by a single new type HVMMEM\_ioreq\_server. In future, if the +P2M type-space is increased, this can be renamed toHVMMEM\_ioreq\_server0
docs/designs/hvmmem_ioreq_server.md line 27
Quoted 1 line
docs/designs/hvmmem_ioreq_server.md new file +1
-0+and new HVMMEM\_ioreq\_server1, HVMMEM\_ioreq\_server2, etc.types
docs/designs/hvmmem_ioreq_server.md
Quoted 3 lines
docs/designs/hvmmem_ioreq_server.md new file +3
-0+can be added. + +Accesses to a page of type HVMMEM\_ioreq\_serverX should be thesame as
docs/designs/hvmmem_ioreq_server.md line 31
Quoted 1 line
docs/designs/hvmmem_ioreq_server.md new file +1
-0+HVMMEM\_ram\_rw until the type is _claimed_ by an IOREQ server.Quoted 8 lines
Furthermore
Sorry, do you mean even when a gfn is set to
HVMMEM_ioreq_serverXtype,
its access rights in P2M still remains unchanged? So the new hypercall pair, HVMOP_[un]map_mem_type_to_ioreq_server, are also responsible for
the PTE updates on the access bits?Yes, the access bits would not change *on existing* pages of this type until the type is claimed.
Quoted 1 line
Quoted 8 lines
Quoted 6 lines
If it is true, I'm afraid this would be time consuming, because the map/unmap will have to traverse all P2M structures to detect the PTEs with
HVMMEM_ioreq_serverXflag set. Yet in XenGT, setting this flag is triggered dynamically with the construction/destruction of shadow PPGTT. But I'm not sure to which degree the performance casualties will be, with frequent EPT table walk and EPT tlb flush.I don't see the concern. I am assuming XenGT would claim the type at start of day and then just to
HVMOP_set_mem_typeoperations on PPGTT pages as necessary, which would not require p2m traversal (since that hypercall takes the gfn as an arg) and the EPT flush requirements are no different to setting themmio_write_dmtype in the current implementation.
So this looks like my second interpretation, with step 1> and step 2> changed?
Quoted 12 lines
Quoted 12 lines
If it is not, I guess we can(e.g. when trying to WP a gfn):
1> useHVMOP_set_mem_typeto set theHVMMEM_ioreq_serverXflag, which
for the write protected case works the same asHVMMEM_mmio_write_dm; If successful, accesses to a page of typeHVMMEM_ioreq_serverXshould trigger the ioreq server selection path, but will be discarded. 2> afterHVMOP_map_mem_type_to_ioreq_serveris called, all accesses to this pages of typeHVMMEM_ioreq_serverXwould be forwarded to a specified ioreq server.
Quoted 9 lines
Quoted 4 lines
As to XenGT backend device model, we only need to use the map hypercall once when trying to contruct the first shadow PPGTT, and use the unmap hypercall when a VM is going to be torn down.
Yes, that's correct. A single claim at start of day and a single 'unclaim' at end of day. In between the current
HVMOP_set_mem_typeis pretty much as before (just with the new type name) and there is no longer a need for the hypercall to map the range to the ioreq server.Paul
B.R.
Yu
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel