Skip to contentSkip to conversation

x86/ioreq server: Introduce HVMMEM_ioreq_server mem type.

PATCH Superseded Yu Zhang 6 participants 35 messages Apr 25, 2016 – Apr 28, 2016

v3 of 12 Superseded Latest is v12 →

lore
Share & tools
lore

Yu Zhang

author
#0 lore raw

v3 cover x86/ioreq server: Introduce HVMMEM_ioreq_server mem type.

XenGT leverages ioreq server to track and forward the accesses to GPU I/O resources, e.g. the PPGTT(per-process graphic translation tables). Currently, ioreq server uses rangeset to track the BDF/ PIO/MMIO ranges to be emulated. To select an ioreq server, the rangeset is searched to see if the I/O range is recorded. However, number of ram pages to be tracked may exceed the upper limit of rangeset.

Previously, one solution was proposed to refactor the rangeset, and extend its upper limit. However, after 12 rounds discussion, we have decided to drop this approach due to security concerns. Now this new patch series introduces a new mem type, HVMMEM_ioreq_server, and added hvm operations to let one ioreq server to claim its ownership of ram pages with this type. Accesses to a page of this type will be handled by the specified ioreq server directly.

Yu Zhang (3):
x86/ioreq server(patch for 4.7): Rename p2m_mmio_write_dm to
p2m_ioreq_server.
x86/ioreq server: Add new functions to get/set memory types. x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to
an ioreq server.

 xen/arch/x86/hvm/emulate.c       |  32 +++-
 xen/arch/x86/hvm/hvm.c           | 347 +++++++++++++++++++++++++--------------
 xen/arch/x86/hvm/ioreq.c         |  41 +++++
 xen/arch/x86/mm/hap/nested_hap.c |   2 +-
 xen/arch/x86/mm/p2m-ept.c        |   7 +-
 xen/arch/x86/mm/p2m-pt.c         |  23 ++-
 xen/arch/x86/mm/p2m.c            |  70 ++++++++
 xen/arch/x86/mm/shadow/multi.c   |   3 +-
 xen/include/asm-x86/hvm/ioreq.h  |   2 +
 xen/include/asm-x86/p2m.h        |  32 +++-
 xen/include/public/hvm/hvm_op.h  |  39 ++++-
 11 files changed, 454 insertions(+), 144 deletions(-)
Signature · 7 lines
1.9.1


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
author
#1 lore raw

PATCH v3 1/3 x86/ioreq server(patch for 4.7): Rename p2m_mmio_write_dm to p2m_ioreq_server.

Previously p2m type p2m_mmio_write_dm was introduced for write- protected memory pages whose write operations are supposed to be forwarded to and emulated by an ioreq server. Yet limitations of rangeset restrict the number of guest pages to be write-protected.

This patch replaces the p2m type p2m_mmio_write_dm with a new name:
p2m_ioreq_server, which means this p2m type can be claimed by one ioreq server, instead of being tracked inside the rangeset of ioreq server. Patches following up will add the related hvmop handling code which map/unmap type p2m_ioreq_server to/from an ioreq server.

changes in v3:
- According to Jan & George's comments, keep HVMMEM_mmio_write_dm for old xen interface versions, and replace it with HVMMEM_unused for xen interfaces newer than 4.7.0; For p2m_ioreq_server, a new enum - HVMMEM_ioreq_server is introduced for the get/set mem type interfaces;
- Add George's Reviewed-by and Acked-by from Tim & Andrew.

changes in v2:
- According to George Dunlap's comments, only rename the p2m type, with no behavior changes.

---
 xen/arch/x86/hvm/hvm.c          | 14 ++++++++------
 xen/arch/x86/mm/p2m-ept.c       |  2 +-
 xen/arch/x86/mm/p2m-pt.c        |  2 +-
 xen/arch/x86/mm/shadow/multi.c  |  2 +-
 xen/include/asm-x86/p2m.h       |  4 ++--
 xen/include/public/hvm/hvm_op.h |  8 +++++++-
 6 files changed, 20 insertions(+), 12 deletions(-)
xen/arch/x86/hvm/hvm.c +8 -6
index f24126d..874cb0f 100644
@@ -1857,7 +1857,7 @@ int hvm_hap_nested_page_fault(paddr_t gpa, unsigned long gla,
      */
     if ( (p2mt == p2m_mmio_dm) || 
          (npfec.write_access &&
-          (p2m_is_discard_write(p2mt) || (p2mt == p2m_mmio_write_dm))) )
+          (p2m_is_discard_write(p2mt) || (p2mt == p2m_ioreq_server))) )
     {
         __put_gfn(p2m, gfn);
         if ( ap2m_active )
@@ -5499,8 +5499,8 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg)
             get_gfn_query_unlocked(d, a.pfn, &t);
             if ( p2m_is_mmio(t) )
                 a.mem_type =  HVMMEM_mmio_dm;
-            else if ( t == p2m_mmio_write_dm )
-                a.mem_type = HVMMEM_mmio_write_dm;
+            else if ( t == p2m_ioreq_server )
+                a.mem_type = HVMMEM_ioreq_server;
             else if ( p2m_is_readonly(t) )
                 a.mem_type =  HVMMEM_ram_ro;
             else if ( p2m_is_ram(t) )
@@ -5531,7 +5531,8 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg)
             [HVMMEM_ram_rw]  = p2m_ram_rw,
             [HVMMEM_ram_ro]  = p2m_ram_ro,
             [HVMMEM_mmio_dm] = p2m_mmio_dm,
-            [HVMMEM_mmio_write_dm] = p2m_mmio_write_dm
+            [HVMMEM_unused] = p2m_invalid,
+            [HVMMEM_ioreq_server] = p2m_ioreq_server
         };
 
         if ( copy_from_guest(&a, arg, 1) )
@@ -5555,7 +5556,8 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg)
              ((a.first_pfn + a.nr - 1) > domain_get_maximum_gpfn(d)) )
             goto setmemtype_fail;
             
-        if ( a.hvmmem_type >= ARRAY_SIZE(memtype) )
+        if ( a.hvmmem_type >= ARRAY_SIZE(memtype) ||
+             unlikely(a.hvmmem_type == HVMMEM_unused) )
             goto setmemtype_fail;
 
         while ( a.nr > start_iter )
@@ -5579,7 +5581,7 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg)
             }
             if ( !p2m_is_ram(t) &&
                  (!p2m_is_hole(t) || a.hvmmem_type != HVMMEM_mmio_dm) &&
-                 (t != p2m_mmio_write_dm || a.hvmmem_type != HVMMEM_ram_rw) )
+                 (t != p2m_ioreq_server || a.hvmmem_type != HVMMEM_ram_rw) )
             {
                 put_gfn(d, pfn);
                 goto setmemtype_fail;
xen/arch/x86/mm/p2m-ept.c +1 -1
index 3cb6868..380ec25 100644
@@ -171,7 +171,7 @@ static void ept_p2m_type_to_flags(struct p2m_domain *p2m, ept_entry_t *entry,
             entry->a = entry->d = !!cpu_has_vmx_ept_ad;
             break;
         case p2m_grant_map_ro:
-        case p2m_mmio_write_dm:
+        case p2m_ioreq_server:
             entry->r = 1;
             entry->w = entry->x = 0;
             entry->a = !!cpu_has_vmx_ept_ad;
xen/arch/x86/mm/p2m-pt.c +1 -1
index 3d80612..eabd2e3 100644
@@ -94,7 +94,7 @@ static unsigned long p2m_type_to_flags(p2m_type_t t, mfn_t mfn,
     default:
         return flags | _PAGE_NX_BIT;
     case p2m_grant_map_ro:
-    case p2m_mmio_write_dm:
+    case p2m_ioreq_server:
         return flags | P2M_BASE_FLAGS | _PAGE_NX_BIT;
     case p2m_ram_ro:
     case p2m_ram_logdirty:
xen/arch/x86/mm/shadow/multi.c +1 -1
index e5c8499..c81302a 100644
@@ -3225,7 +3225,7 @@ static int sh_page_fault(struct vcpu *v,
 
     /* Need to hand off device-model MMIO to the device model */
     if ( p2mt == p2m_mmio_dm
-         || (p2mt == p2m_mmio_write_dm && ft == ft_demand_write) )
+         || (p2mt == p2m_ioreq_server && ft == ft_demand_write) )
     {
         gpa = guest_walk_to_gpa(&gw);
         goto mmio;
xen/include/asm-x86/p2m.h +2 -2
index 5392eb0..ee2ea9c 100644
@@ -71,7 +71,7 @@ typedef enum {
     p2m_ram_shared = 12,          /* Shared or sharable memory */
     p2m_ram_broken = 13,          /* Broken page, access cause domain crash */
     p2m_map_foreign  = 14,        /* ram pages from foreign domain */
-    p2m_mmio_write_dm = 15,       /* Read-only; writes go to the device model */
+    p2m_ioreq_server = 15,
 } p2m_type_t;
 
 /* Modifiers to the query */
@@ -112,7 +112,7 @@ typedef unsigned int p2m_query_t;
                       | p2m_to_mask(p2m_ram_ro)         \
                       | p2m_to_mask(p2m_grant_map_ro)   \
                       | p2m_to_mask(p2m_ram_shared)     \
-                      | p2m_to_mask(p2m_mmio_write_dm))
+                      | p2m_to_mask(p2m_ioreq_server))
 
 /* Write-discard types, which should discard the write operations */
 #define P2M_DISCARD_WRITE_TYPES (p2m_to_mask(p2m_ram_ro)     \
xen/include/public/hvm/hvm_op.h +7 -1
index 1606185..b3e45cf 100644
@@ -83,7 +83,13 @@ typedef enum {
     HVMMEM_ram_rw,             /* Normal read/write guest RAM */
     HVMMEM_ram_ro,             /* Read-only; writes are discarded */
     HVMMEM_mmio_dm,            /* Reads and write go to the device model */
-    HVMMEM_mmio_write_dm       /* Read-only; writes go to the device model */
+#if __XEN_INTERFACE_VERSION__ < 0x00040700
+    HVMMEM_mmio_write_dm,      /* Read-only; writes go to the device model */
+#else
+    HVMMEM_unused,             /* Placeholder; setting memory to this type
+                                  will fail for code after 4.7.0 */
+#endif
+    HVMMEM_ioreq_server
 } hvmmem_type_t;
 
 /* Following tools-only interfaces may change in future. */
Signature · 7 lines
1.9.1


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Reviewed-by on v3 1/3
#2 lore raw

Re: [PATCH v3 1/3] x86/ioreq server(patch for 4.7): Rename p2m_mmio_write_dm to p2m_ioreq_server.

Quoted 24 lines
Quoted 1 line
Quoted 1 line · On 25.04.16 at 12:35, <[email protected]> wrote:

Previously p2m type p2m_mmio_write_dm was introduced for write- protected memory pages whose write operations are supposed to be forwarded to and emulated by an ioreq server. Yet limitations of rangeset restrict the number of guest pages to be write-protected.

This patch replaces the p2m type p2m_mmio_write_dm with a new name:
p2m_ioreq_server, which means this p2m type can be claimed by one ioreq server, instead of being tracked inside the rangeset of ioreq server. Patches following up will add the related hvmop handling code which map/unmap type p2m_ioreq_server to/from an ioreq server.

changes in v3:
- According to Jan & George's comments, keep HVMMEM_mmio_write_dm for old xen interface versions, and replace it with HVMMEM_unused for xen interfaces newer than 4.7.0; For p2m_ioreq_server, a new enum - HVMMEM_ioreq_server is introduced for the get/set mem type interfaces;
- Add George's Reviewed-by and Acked-by from Tim & Andrew.

changes in v2:
- According to George Dunlap's comments, only rename the p2m type, with no behavior changes.

Quoted 5 lines

I hope the other three tags above are still being considered applicable by their originators.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#3 lore raw

Re: [PATCH v3 1/3] x86/ioreq server(patch for 4.7): Rename p2m_mmio_write_dm to p2m_ioreq_server.

Quoted 30 lines · Jan Beulich
Quoted 24 lines
Quoted 1 line
Quoted 1 line · On 25.04.16 at 12:35, <[email protected]> wrote:

Previously p2m type p2m_mmio_write_dm was introduced for write- protected memory pages whose write operations are supposed to be forwarded to and emulated by an ioreq server. Yet limitations of rangeset restrict the number of guest pages to be write-protected.

This patch replaces the p2m type p2m_mmio_write_dm with a new name:
p2m_ioreq_server, which means this p2m type can be claimed by one ioreq server, instead of being tracked inside the rangeset of ioreq server. Patches following up will add the related hvmop handling code which map/unmap type p2m_ioreq_server to/from an ioreq server.

changes in v3:
- According to Jan & George's comments, keep HVMMEM_mmio_write_dm for old xen interface versions, and replace it with HVMMEM_unused for xen interfaces newer than 4.7.0; For p2m_ioreq_server, a new enum - HVMMEM_ioreq_server is introduced for the get/set mem type interfaces;
- Add George's Reviewed-by and Acked-by from Tim & Andrew.

changes in v2:
- According to George Dunlap's comments, only rename the p2m type, with no behavior changes.

Quoted 5 lines
Quoted 5 lines

I hope the other three tags above are still being considered applicable by their originators.

Subject to confirmation from the originators:

Quoted 2 lines

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#4 lore raw

Re: [PATCH v3 1/3] x86/ioreq server(patch for 4.7): Rename p2m_mmio_write_dm to p2m_ioreq_server.

In reply to Yu Zhang
Quoted 11 lines · Yu Zhang

Previously p2m type p2m_mmio_write_dm was introduced for write- protected memory pages whose write operations are supposed to be forwarded to and emulated by an ioreq server. Yet limitations of rangeset restrict the number of guest pages to be write-protected.

This patch replaces the p2m type p2m_mmio_write_dm with a new name:
p2m_ioreq_server, which means this p2m type can be claimed by one ioreq server, instead of being tracked inside the rangeset of ioreq server. Patches following up will add the related hvmop handling code which map/unmap type p2m_ioreq_server to/from an ioreq server.

Quoted 7 lines

changes in v3:
- According to Jan & George's comments, keep HVMMEM_mmio_write_dm for old xen interface versions, and replace it with HVMMEM_unused for xen interfaces newer than 4.7.0; For p2m_ioreq_server, a new enum - HVMMEM_ioreq_server is introduced for the get/set mem type interfaces;
- Add George's Reviewed-by and Acked-by from Tim & Andrew.

Unfortunately these rather contradict each other -- I consider Reviewed-by to only stick if the code I've specified hasn't changed (or has only changed trivially).

Also...

Quoted 146 lines

changes in v2:
- According to George Dunlap's comments, only rename the p2m type, with no behavior changes.

---
 xen/arch/x86/hvm/hvm.c          | 14 ++++++++------
 xen/arch/x86/mm/p2m-ept.c       |  2 +-
 xen/arch/x86/mm/p2m-pt.c        |  2 +-
 xen/arch/x86/mm/shadow/multi.c  |  2 +-
 xen/include/asm-x86/p2m.h       |  4 ++--
 xen/include/public/hvm/hvm_op.h |  8 +++++++-
 6 files changed, 20 insertions(+), 12 deletions(-)
xen/arch/x86/hvm/hvm.c +8 -6
index f24126d..874cb0f 100644
@@ -1857,7 +1857,7 @@ int hvm_hap_nested_page_fault(paddr_t gpa, unsigned long gla,
      */
     if ( (p2mt == p2m_mmio_dm) ||
          (npfec.write_access &&
-          (p2m_is_discard_write(p2mt) || (p2mt == p2m_mmio_write_dm))) )
+          (p2m_is_discard_write(p2mt) || (p2mt == p2m_ioreq_server))) )
     {
         __put_gfn(p2m, gfn);
         if ( ap2m_active )
@@ -5499,8 +5499,8 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg)
             get_gfn_query_unlocked(d, a.pfn, &t);
             if ( p2m_is_mmio(t) )
                 a.mem_type =  HVMMEM_mmio_dm;
-            else if ( t == p2m_mmio_write_dm )
-                a.mem_type = HVMMEM_mmio_write_dm;
+            else if ( t == p2m_ioreq_server )
+                a.mem_type = HVMMEM_ioreq_server;
             else if ( p2m_is_readonly(t) )
                 a.mem_type =  HVMMEM_ram_ro;
             else if ( p2m_is_ram(t) )
@@ -5531,7 +5531,8 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg)
             [HVMMEM_ram_rw]  = p2m_ram_rw,
             [HVMMEM_ram_ro]  = p2m_ram_ro,
             [HVMMEM_mmio_dm] = p2m_mmio_dm,
-            [HVMMEM_mmio_write_dm] = p2m_mmio_write_dm
+            [HVMMEM_unused] = p2m_invalid,
+            [HVMMEM_ioreq_server] = p2m_ioreq_server
         };
 
         if ( copy_from_guest(&a, arg, 1) )
@@ -5555,7 +5556,8 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg)
              ((a.first_pfn + a.nr - 1) > domain_get_maximum_gpfn(d)) )
             goto setmemtype_fail;
 
-        if ( a.hvmmem_type >= ARRAY_SIZE(memtype) )
+        if ( a.hvmmem_type >= ARRAY_SIZE(memtype) ||
+             unlikely(a.hvmmem_type == HVMMEM_unused) )
             goto setmemtype_fail;
 
         while ( a.nr > start_iter )
@@ -5579,7 +5581,7 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg)
             }
             if ( !p2m_is_ram(t) &&
                  (!p2m_is_hole(t) || a.hvmmem_type != HVMMEM_mmio_dm) &&
-                 (t != p2m_mmio_write_dm || a.hvmmem_type != HVMMEM_ram_rw) )
+                 (t != p2m_ioreq_server || a.hvmmem_type != HVMMEM_ram_rw) )
             {
                 put_gfn(d, pfn);
                 goto setmemtype_fail;
xen/arch/x86/mm/p2m-ept.c +1 -1
index 3cb6868..380ec25 100644
@@ -171,7 +171,7 @@ static void ept_p2m_type_to_flags(struct p2m_domain *p2m, ept_entry_t *entry,
             entry->a = entry->d = !!cpu_has_vmx_ept_ad;
             break;
         case p2m_grant_map_ro:
-        case p2m_mmio_write_dm:
+        case p2m_ioreq_server:
             entry->r = 1;
             entry->w = entry->x = 0;
             entry->a = !!cpu_has_vmx_ept_ad;
xen/arch/x86/mm/p2m-pt.c +1 -1
index 3d80612..eabd2e3 100644
@@ -94,7 +94,7 @@ static unsigned long p2m_type_to_flags(p2m_type_t t, mfn_t mfn,
     default:
         return flags | _PAGE_NX_BIT;
     case p2m_grant_map_ro:
-    case p2m_mmio_write_dm:
+    case p2m_ioreq_server:
         return flags | P2M_BASE_FLAGS | _PAGE_NX_BIT;
     case p2m_ram_ro:
     case p2m_ram_logdirty:
xen/arch/x86/mm/shadow/multi.c +1 -1
index e5c8499..c81302a 100644
@@ -3225,7 +3225,7 @@ static int sh_page_fault(struct vcpu *v,
 
     /* Need to hand off device-model MMIO to the device model */
     if ( p2mt == p2m_mmio_dm
-         || (p2mt == p2m_mmio_write_dm && ft == ft_demand_write) )
+         || (p2mt == p2m_ioreq_server && ft == ft_demand_write) )
     {
         gpa = guest_walk_to_gpa(&gw);
         goto mmio;
xen/include/asm-x86/p2m.h +2 -2
index 5392eb0..ee2ea9c 100644
@@ -71,7 +71,7 @@ typedef enum {
     p2m_ram_shared = 12,          /* Shared or sharable memory */
     p2m_ram_broken = 13,          /* Broken page, access cause domain crash */
     p2m_map_foreign  = 14,        /* ram pages from foreign domain */
-    p2m_mmio_write_dm = 15,       /* Read-only; writes go to the device model */
+    p2m_ioreq_server = 15,
 } p2m_type_t;
 
 /* Modifiers to the query */
@@ -112,7 +112,7 @@ typedef unsigned int p2m_query_t;
                       | p2m_to_mask(p2m_ram_ro)         \
                       | p2m_to_mask(p2m_grant_map_ro)   \
                       | p2m_to_mask(p2m_ram_shared)     \
-                      | p2m_to_mask(p2m_mmio_write_dm))
+                      | p2m_to_mask(p2m_ioreq_server))
 
 /* Write-discard types, which should discard the write operations */
 #define P2M_DISCARD_WRITE_TYPES (p2m_to_mask(p2m_ram_ro)     \
xen/include/public/hvm/hvm_op.h +0 -0
index 1606185..b3e45cf 100644
@@ -83,7 +83,13 @@ typedef enum {
     HVMMEM_ram_rw,             /* Normal read/write guest RAM */

xen/include/public/hvm/hvm_op.h typedef enum { · line 92

Quoted 10 lines
xen/include/public/hvm/hvm_op.h +7 -1
     HVMMEM_ram_ro,             /* Read-only; writes are discarded */
     HVMMEM_mmio_dm,            /* Reads and write go to the device model */
-    HVMMEM_mmio_write_dm       /* Read-only; writes go to the device model */
+#if __XEN_INTERFACE_VERSION__ < 0x00040700
+    HVMMEM_mmio_write_dm,      /* Read-only; writes go to the device model */
+#else
+    HVMMEM_unused,             /* Placeholder; setting memory to this type
+                                  will fail for code after 4.7.0 */
+#endif
+    HVMMEM_ioreq_server

Also, I don't think we've had a convincing argument for why this patch needs to be in 4.7. The p2m name changes are internal only, and so don't need to be made at all; and the old functionality will work as well as it ever did. Furthermore, the whole reason we're in this situation is that we checked in a publicly-visible change to the interface before it was properly ready; I think we should avoid making the same mistake this time.

So personally I'd just leave this patch entirely for 4.8; but if Paul and/or Jan have strong opinions, then I would say check in only a patch to do the #if/#else/#endif, and leave both the p2m type changes and the new HVMMEM_ioreq_server enum for when the 4.8 development window opens.

-George

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#5 lore raw

Re: [PATCH v3 1/3] x86/ioreq server(patch for 4.7): Rename p2m_mmio_write_dm to p2m_ioreq_server.

Quoted 220 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of George Dunlap
Sent: 25 April 2016 14:39
To: Yu Zhang
Cc: [email protected]; Kevin Tian; Keir (Xen.org); Jun Nakajima; Andrew Cooper; Tim (Xen.org); Paul Durrant; Lv, Zhiyuan; Jan Beulich; Wei Liu
Subject: Re: [Xen-devel] [PATCH v3 1/3] x86/ioreq server(patch for 4.7):
Rename p2m_mmio_write_dm to p2m_ioreq_server.

Quoted 5 lines · Yu Zhang

Previously p2m type p2m_mmio_write_dm was introduced for write- protected memory pages whose write operations are supposed to be forwarded to and emulated by an ioreq server. Yet limitations of rangeset restrict the number of guest pages to be write-protected.

Quoted 8 lines

This patch replaces the p2m type p2m_mmio_write_dm with a new name:
p2m_ioreq_server, which means this p2m type can be claimed by one ioreq server, instead of being tracked inside the rangeset of ioreq server. Patches following up will add the related hvmop handling code which map/unmap type p2m_ioreq_server to/from an ioreq server.

changes in v3:
- According to Jan & George's comments, keep

HVMMEM_mmio_write_dm

Quoted 5 lines

for old xen interface versions, and replace it with HVMMEM_unused for xen interfaces newer than 4.7.0; For p2m_ioreq_server, a new enum - HVMMEM_ioreq_server is introduced for the get/set mem type interfaces;
- Add George's Reviewed-by and Acked-by from Tim & Andrew.

Unfortunately these rather contradict each other -- I consider Reviewed-by to only stick if the code I've specified hasn't changed (or has only changed trivially).

Also...

xen/arch/x86/hvm/hvm.c int hvm_hap_nested_page_fault(paddr_t gpa,

Quoted 31 lines

changes in v2:
- According to George Dunlap's comments, only rename the p2m type, with no behavior changes.

---
 xen/arch/x86/hvm/hvm.c          | 14 ++++++++------
 xen/arch/x86/mm/p2m-ept.c       |  2 +-
 xen/arch/x86/mm/p2m-pt.c        |  2 +-
 xen/arch/x86/mm/shadow/multi.c  |  2 +-
 xen/include/asm-x86/p2m.h       |  4 ++--
 xen/include/public/hvm/hvm_op.h |  8 +++++++-
 6 files changed, 20 insertions(+), 12 deletions(-)
xen/arch/x86/hvm/hvm.c +0 -0
index f24126d..874cb0f 100644
@@ -1857,7 +1857,7 @@ int hvm_hap_nested_page_fault(paddr_t gpa,

unsigned long gla,

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,

Quoted 9 lines
xen/arch/x86/hvm/hvm.c +1 -1
      */
     if ( (p2mt == p2m_mmio_dm) ||
          (npfec.write_access &&
-          (p2m_is_discard_write(p2mt) || (p2mt == p2m_mmio_write_dm))) )
+          (p2m_is_discard_write(p2mt) || (p2mt == p2m_ioreq_server))) )
     {
         __put_gfn(p2m, gfn);
         if ( ap2m_active )
@@ -5499,8 +5499,8 @@ long do_hvm_op(unsigned long op,

XEN_GUEST_HANDLE_PARAM(void) arg)

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,

Quoted 11 lines
xen/arch/x86/hvm/hvm.c +2 -2
             get_gfn_query_unlocked(d, a.pfn, &t);
             if ( p2m_is_mmio(t) )
                 a.mem_type =  HVMMEM_mmio_dm;
-            else if ( t == p2m_mmio_write_dm )
-                a.mem_type = HVMMEM_mmio_write_dm;
+            else if ( t == p2m_ioreq_server )
+                a.mem_type = HVMMEM_ioreq_server;
             else if ( p2m_is_readonly(t) )
                 a.mem_type =  HVMMEM_ram_ro;
             else if ( p2m_is_ram(t) )
@@ -5531,7 +5531,8 @@ long do_hvm_op(unsigned long op,

XEN_GUEST_HANDLE_PARAM(void) arg)

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,

Quoted 10 lines
xen/arch/x86/hvm/hvm.c +2 -1
             [HVMMEM_ram_rw]  = p2m_ram_rw,
             [HVMMEM_ram_ro]  = p2m_ram_ro,
             [HVMMEM_mmio_dm] = p2m_mmio_dm,
-            [HVMMEM_mmio_write_dm] = p2m_mmio_write_dm
+            [HVMMEM_unused] = p2m_invalid,
+            [HVMMEM_ioreq_server] = p2m_ioreq_server
         };
 
         if ( copy_from_guest(&a, arg, 1) )
@@ -5555,7 +5556,8 @@ long do_hvm_op(unsigned long op,

XEN_GUEST_HANDLE_PARAM(void) arg)

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,

Quoted 10 lines
xen/arch/x86/hvm/hvm.c +2 -1
              ((a.first_pfn + a.nr - 1) > domain_get_maximum_gpfn(d)) )
             goto setmemtype_fail;
 
-        if ( a.hvmmem_type >= ARRAY_SIZE(memtype) )
+        if ( a.hvmmem_type >= ARRAY_SIZE(memtype) ||
+             unlikely(a.hvmmem_type == HVMMEM_unused) )
             goto setmemtype_fail;
 
         while ( a.nr > start_iter )
@@ -5579,7 +5581,7 @@ long do_hvm_op(unsigned long op,

XEN_GUEST_HANDLE_PARAM(void) arg)

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg)

Quoted 3 lines
xen/arch/x86/hvm/hvm.c +0 -0
             }
             if ( !p2m_is_ram(t) &&
                  (!p2m_is_hole(t) || a.hvmmem_type != HVMMEM_mmio_dm)

&&

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op, · line 5582

Quoted 1 line
xen/arch/x86/hvm/hvm.c +0 -1
-                 (t != p2m_mmio_write_dm || a.hvmmem_type !=

HVMMEM_ram_rw) )

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op, · line 5584

Quoted 1 line
xen/arch/x86/hvm/hvm.c +1 -0
+                 (t != p2m_ioreq_server || a.hvmmem_type !=

HVMMEM_ram_rw) )

xen/arch/x86/mm/p2m-ept.c static void ept_p2m_type_to_flags(struct

Quoted 8 lines
xen/arch/x86/hvm/hvm.c +0 -0
             {
                 put_gfn(d, pfn);
                 goto setmemtype_fail;
xen/arch/x86/mm/p2m-ept.c +0 -0
index 3cb6868..380ec25 100644
@@ -171,7 +171,7 @@ static void ept_p2m_type_to_flags(struct

p2m_domain *p2m, ept_entry_t *entry,

xen/arch/x86/mm/p2m-pt.c static unsigned long p2m_type_to_flags(p2m_type_t

Quoted 13 lines
xen/arch/x86/mm/p2m-ept.c +1 -1
             entry->a = entry->d = !!cpu_has_vmx_ept_ad;
             break;
         case p2m_grant_map_ro:
-        case p2m_mmio_write_dm:
+        case p2m_ioreq_server:
             entry->r = 1;
             entry->w = entry->x = 0;
             entry->a = !!cpu_has_vmx_ept_ad;
xen/arch/x86/mm/p2m-pt.c +0 -0
index 3d80612..eabd2e3 100644
@@ -94,7 +94,7 @@ static unsigned long p2m_type_to_flags(p2m_type_t

t, mfn_t mfn,

Review

Quoted 9 lines
xen/arch/x86/mm/p2m-pt.c +1 -1
     default:
         return flags | _PAGE_NX_BIT;
     case p2m_grant_map_ro:
-    case p2m_mmio_write_dm:
+    case p2m_ioreq_server:
         return flags | P2M_BASE_FLAGS | _PAGE_NX_BIT;
     case p2m_ram_ro:
     case p2m_ram_logdirty:
(quoted diff) +0 -0

b/xen/arch/x86/mm/shadow/multi.c

Quoted 17 lines

index e5c8499..c81302a 100644

xen/arch/x86/mm/shadow/multi.c +1 -1
@@ -3225,7 +3225,7 @@ static int sh_page_fault(struct vcpu *v,
 
     /* Need to hand off device-model MMIO to the device model */
     if ( p2mt == p2m_mmio_dm
-         || (p2mt == p2m_mmio_write_dm && ft == ft_demand_write) )
+         || (p2mt == p2m_ioreq_server && ft == ft_demand_write) )
     {
         gpa = guest_walk_to_gpa(&gw);
         goto mmio;
xen/include/asm-x86/p2m.h +0 -0
index 5392eb0..ee2ea9c 100644

xen/include/asm-x86/p2m.h typedef enum { · line 72

Quoted 2 lines
xen/include/asm-x86/p2m.h +0 -0
@@ -71,7 +71,7 @@ typedef enum {
     p2m_ram_shared = 12,          /* Shared or sharable memory */
     p2m_ram_broken = 13,          /* Broken page, access cause domain crash

*/

xen/include/asm-x86/p2m.h typedef enum { · line 74

Quoted 2 lines
xen/include/asm-x86/p2m.h +0 -1
     p2m_map_foreign  = 14,        /* ram pages from foreign domain */
-    p2m_mmio_write_dm = 15,       /* Read-only; writes go to the device

model */

Review

Quoted 14 lines
xen/include/asm-x86/p2m.h +2 -1
+    p2m_ioreq_server = 15,
 } p2m_type_t;
 
 /* Modifiers to the query */
@@ -112,7 +112,7 @@ typedef unsigned int p2m_query_t;
                       | p2m_to_mask(p2m_ram_ro)         \
                       | p2m_to_mask(p2m_grant_map_ro)   \
                       | p2m_to_mask(p2m_ram_shared)     \
-                      | p2m_to_mask(p2m_mmio_write_dm))
+                      | p2m_to_mask(p2m_ioreq_server))
 
 /* Write-discard types, which should discard the write operations */
 #define P2M_DISCARD_WRITE_TYPES (p2m_to_mask(p2m_ram_ro)     \
(quoted diff) +0 -0

b/xen/include/public/hvm/hvm_op.h

xen/include/public/hvm/hvm_op.h typedef enum { · line 85

Quoted 7 lines

index 1606185..b3e45cf 100644

xen/include/public/hvm/hvm_op.h +0 -0
@@ -83,7 +83,13 @@ typedef enum {
     HVMMEM_ram_rw,             /* Normal read/write guest RAM */
     HVMMEM_ram_ro,             /* Read-only; writes are discarded */
     HVMMEM_mmio_dm,            /* Reads and write go to the device model

*/

xen/include/public/hvm/hvm_op.h typedef enum { · line 86

Quoted 1 line
xen/include/public/hvm/hvm_op.h +0 -1
-    HVMMEM_mmio_write_dm       /* Read-only; writes go to the device

model */

xen/include/public/hvm/hvm_op.h typedef enum { · line 87

Quoted 2 lines
xen/include/public/hvm/hvm_op.h +2 -0
+#if __XEN_INTERFACE_VERSION__ < 0x00040700
+    HVMMEM_mmio_write_dm,      /* Read-only; writes go to the device

model */

xen/include/public/hvm/hvm_op.h typedef enum { · line 92

Quoted 5 lines
xen/include/public/hvm/hvm_op.h +5 -0
+#else
+    HVMMEM_unused,             /* Placeholder; setting memory to this type
+                                  will fail for code after 4.7.0 */
+#endif
+    HVMMEM_ioreq_server

Also, I don't think we've had a convincing argument for why this patch needs to be in 4.7. The p2m name changes are internal only, and so don't need to be made at all; and the old functionality will work as well as it ever did. Furthermore, the whole reason we're in this situation is that we checked in a publicly-visible change to the interface before it was properly ready; I think we should avoid making the same mistake this time.

Quoted 6 lines

So personally I'd just leave this patch entirely for 4.8; but if Paul and/or Jan have strong opinions, then I would say check in only a patch to do the #if/#else/#endif, and leave both the p2m type changes and the new HVMMEM_ioreq_server enum for when the 4.8 development window opens.

If the whole series is going in then I think this patch is ok. If this the only patch that is going in for 4.7 then I thing we need the patch to hvm_op.h to deprecate the old type and that's it. We definitely should not introduce an implementation of the type HVMMEM_ioreq_server that has the same hardcoded semantics as the old type and then change it. The p2m type changes are also wrong. That type needs to be left alone, presumably, so that anything using HVMMEM_mmio_write_dm and compiled to the old interface version continues to function. I think HVMMEM_ioreq_server needs to map to a new p2m type which should be introduced in patch #3.

Paul

Quoted 1 line

-George

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#6 lore raw

Re: [PATCH v3 1/3] x86/ioreq server(patch for 4.7): Rename p2m_mmio_write_dm to p2m_ioreq_server.

Quoted 227 lines · Paul Durrant
Quoted 220 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of George Dunlap
Sent: 25 April 2016 14:39
To: Yu Zhang
Cc: [email protected]; Kevin Tian; Keir (Xen.org); Jun Nakajima; Andrew Cooper; Tim (Xen.org); Paul Durrant; Lv, Zhiyuan; Jan Beulich; Wei Liu
Subject: Re: [Xen-devel] [PATCH v3 1/3] x86/ioreq server(patch for 4.7):
Rename p2m_mmio_write_dm to p2m_ioreq_server.

Quoted 5 lines · Yu Zhang

Previously p2m type p2m_mmio_write_dm was introduced for write- protected memory pages whose write operations are supposed to be forwarded to and emulated by an ioreq server. Yet limitations of rangeset restrict the number of guest pages to be write-protected.

Quoted 8 lines

This patch replaces the p2m type p2m_mmio_write_dm with a new name:
p2m_ioreq_server, which means this p2m type can be claimed by one ioreq server, instead of being tracked inside the rangeset of ioreq server. Patches following up will add the related hvmop handling code which map/unmap type p2m_ioreq_server to/from an ioreq server.

changes in v3:
- According to Jan & George's comments, keep

HVMMEM_mmio_write_dm

Quoted 5 lines

for old xen interface versions, and replace it with HVMMEM_unused for xen interfaces newer than 4.7.0; For p2m_ioreq_server, a new enum - HVMMEM_ioreq_server is introduced for the get/set mem type interfaces;
- Add George's Reviewed-by and Acked-by from Tim & Andrew.

Unfortunately these rather contradict each other -- I consider Reviewed-by to only stick if the code I've specified hasn't changed (or has only changed trivially).

Also...

xen/arch/x86/hvm/hvm.c int hvm_hap_nested_page_fault(paddr_t gpa,

Quoted 31 lines

changes in v2:
- According to George Dunlap's comments, only rename the p2m type, with no behavior changes.

---
 xen/arch/x86/hvm/hvm.c          | 14 ++++++++------
 xen/arch/x86/mm/p2m-ept.c       |  2 +-
 xen/arch/x86/mm/p2m-pt.c        |  2 +-
 xen/arch/x86/mm/shadow/multi.c  |  2 +-
 xen/include/asm-x86/p2m.h       |  4 ++--
 xen/include/public/hvm/hvm_op.h |  8 +++++++-
 6 files changed, 20 insertions(+), 12 deletions(-)
xen/arch/x86/hvm/hvm.c +0 -0
index f24126d..874cb0f 100644
@@ -1857,7 +1857,7 @@ int hvm_hap_nested_page_fault(paddr_t gpa,

unsigned long gla,

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,

Quoted 9 lines
xen/arch/x86/hvm/hvm.c +1 -1
      */
     if ( (p2mt == p2m_mmio_dm) ||
          (npfec.write_access &&
-          (p2m_is_discard_write(p2mt) || (p2mt == p2m_mmio_write_dm))) )
+          (p2m_is_discard_write(p2mt) || (p2mt == p2m_ioreq_server))) )
     {
         __put_gfn(p2m, gfn);
         if ( ap2m_active )
@@ -5499,8 +5499,8 @@ long do_hvm_op(unsigned long op,

XEN_GUEST_HANDLE_PARAM(void) arg)

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,

Quoted 11 lines
xen/arch/x86/hvm/hvm.c +2 -2
             get_gfn_query_unlocked(d, a.pfn, &t);
             if ( p2m_is_mmio(t) )
                 a.mem_type =  HVMMEM_mmio_dm;
-            else if ( t == p2m_mmio_write_dm )
-                a.mem_type = HVMMEM_mmio_write_dm;
+            else if ( t == p2m_ioreq_server )
+                a.mem_type = HVMMEM_ioreq_server;
             else if ( p2m_is_readonly(t) )
                 a.mem_type =  HVMMEM_ram_ro;
             else if ( p2m_is_ram(t) )
@@ -5531,7 +5531,8 @@ long do_hvm_op(unsigned long op,

XEN_GUEST_HANDLE_PARAM(void) arg)

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,

Quoted 10 lines
xen/arch/x86/hvm/hvm.c +2 -1
             [HVMMEM_ram_rw]  = p2m_ram_rw,
             [HVMMEM_ram_ro]  = p2m_ram_ro,
             [HVMMEM_mmio_dm] = p2m_mmio_dm,
-            [HVMMEM_mmio_write_dm] = p2m_mmio_write_dm
+            [HVMMEM_unused] = p2m_invalid,
+            [HVMMEM_ioreq_server] = p2m_ioreq_server
         };
 
         if ( copy_from_guest(&a, arg, 1) )
@@ -5555,7 +5556,8 @@ long do_hvm_op(unsigned long op,

XEN_GUEST_HANDLE_PARAM(void) arg)

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,

Quoted 10 lines
xen/arch/x86/hvm/hvm.c +2 -1
              ((a.first_pfn + a.nr - 1) > domain_get_maximum_gpfn(d)) )
             goto setmemtype_fail;
 
-        if ( a.hvmmem_type >= ARRAY_SIZE(memtype) )
+        if ( a.hvmmem_type >= ARRAY_SIZE(memtype) ||
+             unlikely(a.hvmmem_type == HVMMEM_unused) )
             goto setmemtype_fail;
 
         while ( a.nr > start_iter )
@@ -5579,7 +5581,7 @@ long do_hvm_op(unsigned long op,

XEN_GUEST_HANDLE_PARAM(void) arg)

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg)

Quoted 3 lines
xen/arch/x86/hvm/hvm.c +0 -0
             }
             if ( !p2m_is_ram(t) &&
                  (!p2m_is_hole(t) || a.hvmmem_type != HVMMEM_mmio_dm)

&&

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op, · line 5582

Quoted 1 line
xen/arch/x86/hvm/hvm.c +0 -1
-                 (t != p2m_mmio_write_dm || a.hvmmem_type !=

HVMMEM_ram_rw) )

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op, · line 5584

Quoted 1 line
xen/arch/x86/hvm/hvm.c +1 -0
+                 (t != p2m_ioreq_server || a.hvmmem_type !=

HVMMEM_ram_rw) )

xen/arch/x86/mm/p2m-ept.c static void ept_p2m_type_to_flags(struct

Quoted 8 lines
xen/arch/x86/hvm/hvm.c +0 -0
             {
                 put_gfn(d, pfn);
                 goto setmemtype_fail;
xen/arch/x86/mm/p2m-ept.c +0 -0
index 3cb6868..380ec25 100644
@@ -171,7 +171,7 @@ static void ept_p2m_type_to_flags(struct

p2m_domain *p2m, ept_entry_t *entry,

xen/arch/x86/mm/p2m-pt.c static unsigned long p2m_type_to_flags(p2m_type_t

Quoted 13 lines
xen/arch/x86/mm/p2m-ept.c +1 -1
             entry->a = entry->d = !!cpu_has_vmx_ept_ad;
             break;
         case p2m_grant_map_ro:
-        case p2m_mmio_write_dm:
+        case p2m_ioreq_server:
             entry->r = 1;
             entry->w = entry->x = 0;
             entry->a = !!cpu_has_vmx_ept_ad;
xen/arch/x86/mm/p2m-pt.c +0 -0
index 3d80612..eabd2e3 100644
@@ -94,7 +94,7 @@ static unsigned long p2m_type_to_flags(p2m_type_t

t, mfn_t mfn,

Review

Quoted 9 lines
xen/arch/x86/mm/p2m-pt.c +1 -1
     default:
         return flags | _PAGE_NX_BIT;
     case p2m_grant_map_ro:
-    case p2m_mmio_write_dm:
+    case p2m_ioreq_server:
         return flags | P2M_BASE_FLAGS | _PAGE_NX_BIT;
     case p2m_ram_ro:
     case p2m_ram_logdirty:
(quoted diff) +0 -0

b/xen/arch/x86/mm/shadow/multi.c

Quoted 17 lines

index e5c8499..c81302a 100644

xen/arch/x86/mm/shadow/multi.c +1 -1
@@ -3225,7 +3225,7 @@ static int sh_page_fault(struct vcpu *v,
 
     /* Need to hand off device-model MMIO to the device model */
     if ( p2mt == p2m_mmio_dm
-         || (p2mt == p2m_mmio_write_dm && ft == ft_demand_write) )
+         || (p2mt == p2m_ioreq_server && ft == ft_demand_write) )
     {
         gpa = guest_walk_to_gpa(&gw);
         goto mmio;
xen/include/asm-x86/p2m.h +0 -0
index 5392eb0..ee2ea9c 100644

xen/include/asm-x86/p2m.h typedef enum { · line 72

Quoted 2 lines
xen/include/asm-x86/p2m.h +0 -0
@@ -71,7 +71,7 @@ typedef enum {
     p2m_ram_shared = 12,          /* Shared or sharable memory */
     p2m_ram_broken = 13,          /* Broken page, access cause domain crash

*/

xen/include/asm-x86/p2m.h typedef enum { · line 74

Quoted 2 lines
xen/include/asm-x86/p2m.h +0 -1
     p2m_map_foreign  = 14,        /* ram pages from foreign domain */
-    p2m_mmio_write_dm = 15,       /* Read-only; writes go to the device

model */

Review

Quoted 14 lines
xen/include/asm-x86/p2m.h +2 -1
+    p2m_ioreq_server = 15,
 } p2m_type_t;
 
 /* Modifiers to the query */
@@ -112,7 +112,7 @@ typedef unsigned int p2m_query_t;
                       | p2m_to_mask(p2m_ram_ro)         \
                       | p2m_to_mask(p2m_grant_map_ro)   \
                       | p2m_to_mask(p2m_ram_shared)     \
-                      | p2m_to_mask(p2m_mmio_write_dm))
+                      | p2m_to_mask(p2m_ioreq_server))
 
 /* Write-discard types, which should discard the write operations */
 #define P2M_DISCARD_WRITE_TYPES (p2m_to_mask(p2m_ram_ro)     \
(quoted diff) +0 -0

b/xen/include/public/hvm/hvm_op.h

xen/include/public/hvm/hvm_op.h typedef enum { · line 85

Quoted 7 lines

index 1606185..b3e45cf 100644

xen/include/public/hvm/hvm_op.h +0 -0
@@ -83,7 +83,13 @@ typedef enum {
     HVMMEM_ram_rw,             /* Normal read/write guest RAM */
     HVMMEM_ram_ro,             /* Read-only; writes are discarded */
     HVMMEM_mmio_dm,            /* Reads and write go to the device model

*/

xen/include/public/hvm/hvm_op.h typedef enum { · line 86

Quoted 1 line
xen/include/public/hvm/hvm_op.h +0 -1
-    HVMMEM_mmio_write_dm       /* Read-only; writes go to the device

model */

xen/include/public/hvm/hvm_op.h typedef enum { · line 87

Quoted 2 lines
xen/include/public/hvm/hvm_op.h +2 -0
+#if __XEN_INTERFACE_VERSION__ < 0x00040700
+    HVMMEM_mmio_write_dm,      /* Read-only; writes go to the device

model */

xen/include/public/hvm/hvm_op.h typedef enum { · line 92

Quoted 5 lines
xen/include/public/hvm/hvm_op.h +5 -0
+#else
+    HVMMEM_unused,             /* Placeholder; setting memory to this type
+                                  will fail for code after 4.7.0 */
+#endif
+    HVMMEM_ioreq_server

Also, I don't think we've had a convincing argument for why this patch needs to be in 4.7. The p2m name changes are internal only, and so don't need to be made at all; and the old functionality will work as well as it ever did. Furthermore, the whole reason we're in this situation is that we checked in a publicly-visible change to the interface before it was properly ready; I think we should avoid making the same mistake this time.

Quoted 6 lines

So personally I'd just leave this patch entirely for 4.8; but if Paul and/or Jan have strong opinions, then I would say check in only a patch to do the #if/#else/#endif, and leave both the p2m type changes and the new HVMMEM_ioreq_server enum for when the 4.8 development window opens.

Quoted 2 lines

If the whole series is going in then I think this patch is ok. If this the only patch that is going in for 4.7 then I thing we need the patch to hvm_op.h to deprecate the old type and that's it. We definitely should not introduce an implementation of the type HVMMEM_ioreq_server that has the same hardcoded semantics as the old type and then change it. The p2m type changes are also wrong. That type needs to be left alone, presumably, so that anything using HVMMEM_mmio_write_dm and compiled to the old interface version continues to function. I think HVMMEM_ioreq_server needs to map to a new p2m type which should be introduced in patch #3.

Well yes, if the whole series is going in the patch is OK; but I assumed that since it's a new feature that missed the hard deadline we were at this point only talking about how to fix up the interface for the 4.7 release.

I think for 4.8 it should return -EINVAL until someone complains that it's not working, but that's something we can discuss when the development window opens.

Thanks
-George

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#7 lore raw

Re: [PATCH v3 1/3] x86/ioreq server(patch for 4.7): Rename p2m_mmio_write_dm to p2m_ioreq_server.

In reply to Paul Durrant
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 25.04.16 at 16:01, <[email protected]> wrote:

The p2m type changes are also wrong. That type needs to be left alone, presumably, so that anything using HVMMEM_mmio_write_dm and compiled to the old interface version continues to function. I think HVMMEM_ioreq_server needs to map to a new p2m type which should be introduced in patch #3.

I don't understand this part: I thought it was agreed that the old p2m type needs to go away (not the least because we're tight on these), and use of the old HVMMEM_* type needs to result in errors.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#8 lore raw

Re: [PATCH v3 1/3] x86/ioreq server(patch for 4.7): Rename p2m_mmio_write_dm to p2m_ioreq_server.

Quoted 12 lines

-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: 25 April 2016 15:16
To: Paul Durrant
Cc: Andrew Cooper; George Dunlap; Wei Liu; Jun Nakajima; Kevin Tian; Zhiyuan Lv; Yu Zhang; [email protected]; Keir (Xen.org); Tim (Xen.org)
Subject: RE: [Xen-devel] [PATCH v3 1/3] x86/ioreq server(patch for 4.7):
Rename p2m_mmio_write_dm to p2m_ioreq_server.

Quoted 3 lines
Quoted 1 line
Quoted 1 line · On 25.04.16 at 16:01, <[email protected]> wrote:

The p2m type changes are also wrong. That type needs to be left alone, presumably, so that anything using HVMMEM_mmio_write_dm and

Quoted 9 lines

compiled to the

Quoted 2 lines

old interface version continues to function. I think HVMMEM_ioreq_server needs to map to a new p2m type which should be introduced in patch #3.

I don't understand this part: I thought it was agreed that the old p2m type needs to go away (not the least because we're tight on these), and use of the old HVMMEM_* type needs to result in errors.

I may have misunderstood. I thought we'd back-tracked on that because there's a concern that we also need to keep anything compiled against the old header working. If not then this patch should also remove that p2m type, not rename it.

Paul

Quoted 1 line

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#9 lore raw

Re: [PATCH v3 1/3] x86/ioreq server(patch for 4.7): Rename p2m_mmio_write_dm to p2m_ioreq_server.

Quoted 16 lines · Paul Durrant
Quoted 16 lines

-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: 25 April 2016 15:16
To: Paul Durrant
Cc: Andrew Cooper; George Dunlap; Wei Liu; Jun Nakajima; Kevin Tian; Zhiyuan Lv; Yu Zhang; [email protected]; Keir (Xen.org); Tim (Xen.org)
Subject: RE: [Xen-devel] [PATCH v3 1/3] x86/ioreq server(patch for 4.7):
Rename p2m_mmio_write_dm to p2m_ioreq_server.

Quoted 3 lines
Quoted 1 line
Quoted 1 line · On 25.04.16 at 16:01, <[email protected]> wrote:

The p2m type changes are also wrong. That type needs to be left alone, presumably, so that anything using HVMMEM_mmio_write_dm and

compiled to the

Quoted 2 lines

old interface version continues to function. I think HVMMEM_ioreq_server needs to map to a new p2m type which should be introduced in patch #3.

Quoted 7 lines
Quoted 5 lines

I don't understand this part: I thought it was agreed that the old p2m type needs to go away (not the least because we're tight on these), and use of the old HVMMEM_* type needs to result in errors.

I may have misunderstood. I thought we'd back-tracked on that because there's a concern that we also need to keep anything compiled against the old header working. If not then this patch should also remove that p2m type, not rename it.

You mean remove the old HVMMEM type?

There are two issues:
1. Whether old code should continue to compile
2. How old code should act on new hypervisors

I think we've determined that we definitely cannot allow code compiled against old hypervisors to accidentally use a different p2m type; so we certainly need to "burn" an enum here.

I'd personally prefer we just straight-up rename it to HVMMEM_unused, so nobody continues to think that the HVMMEM_mmio_write_dm functionality might still actually work; I think Jan thinks that's not allowed.

Honestly I don't see the point of letting it compile and then return -EINVAL when we run it. If people complain that it doesn't work anymore we should either make it compile *and* maintain the functionality, or say "Sorry, just use an older version" and make it neither compile nor maintain the functionality.

But I sort of assumed this discussion on what support looked like had already been had and Jan was just enforcing it.

(Maybe we should have had a talk about this in person at the Hackathon...)

-George

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#10 lore raw

Re: [PATCH v3 1/3] x86/ioreq server(patch for 4.7): Rename p2m_mmio_write_dm to p2m_ioreq_server.

Quoted 62 lines

-----Original Message-----
From: George Dunlap
Sent: 25 April 2016 15:28
To: Paul Durrant
Cc: Jan Beulich; Kevin Tian; Wei Liu; Andrew Cooper; Tim (Xen.org); xen- [email protected]; Yu Zhang; Zhiyuan Lv; Jun Nakajima; Keir (Xen.org)
Subject: Re: [Xen-devel] [PATCH v3 1/3] x86/ioreq server(patch for 4.7):
Rename p2m_mmio_write_dm to p2m_ioreq_server.

Quoted 6 lines · Paul Durrant
Quoted 6 lines

-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: 25 April 2016 15:16
To: Paul Durrant
Cc: Andrew Cooper; George Dunlap; Wei Liu; Jun Nakajima; Kevin Tian; Zhiyuan Lv; Yu Zhang; [email protected]; Keir (Xen.org); Tim

(Xen.org)

Quoted 8 lines
Quoted 8 lines

Subject: RE: [Xen-devel] [PATCH v3 1/3] x86/ioreq server(patch for 4.7):
Rename p2m_mmio_write_dm to p2m_ioreq_server.

Quoted 3 lines
Quoted 1 line
Quoted 1 line · On 25.04.16 at 16:01, <[email protected]> wrote:

The p2m type changes are also wrong. That type needs to be left alone, presumably, so that anything using HVMMEM_mmio_write_dm and

compiled to the

Quoted 1 line

old interface version continues to function. I think

HVMMEM_ioreq_server

Quoted 1 line
Quoted 1 line
Quoted 1 line

needs to map to a new p2m type which should be introduced in patch

#3.

Quoted 8 lines
Quoted 6 lines

I don't understand this part: I thought it was agreed that the old p2m type needs to go away (not the least because we're tight on these), and use of the old HVMMEM_* type needs to result in errors.

I may have misunderstood. I thought we'd back-tracked on that because

there's a concern that we also need to keep anything compiled against the old header working. If not then this patch should also remove that p2m type, not rename it.

You mean remove the old HVMMEM type?

There are two issues:
1. Whether old code should continue to compile
2. How old code should act on new hypervisors

I think we've determined that we definitely cannot allow code compiled against old hypervisors to accidentally use a different p2m type; so we certainly need to "burn" an enum here.

I'd personally prefer we just straight-up rename it to HVMMEM_unused, so nobody continues to think that the HVMMEM_mmio_write_dm functionality might still actually work; I think Jan thinks that's not allowed.

Honestly I don't see the point of letting it compile and then return -EINVAL when we run it. If people complain that it doesn't work anymore we should either make it compile *and* maintain the functionality, or say "Sorry, just use an older version" and make it neither compile nor maintain the functionality.

Quoted 5 lines

But I sort of assumed this discussion on what support looked like had already been had and Jan was just enforcing it.

(Maybe we should have had a talk about this in person at the Hackathon...)

I'm now confused as to what was agreed, if anything.

The fact of the matter is though that the old type escaped into the wild. I wanted it to go away but because it escaped I guess that may just not be possible.

Paul

Quoted 1 line

-George

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

author
#11 lore raw

Re: [PATCH v3 1/3] x86/ioreq server(patch for 4.7): Rename p2m_mmio_write_dm to p2m_ioreq_server.

In reply to Paul Durrant
Quoted 227 lines · Paul Durrant
Quoted 220 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of George Dunlap
Sent: 25 April 2016 14:39
To: Yu Zhang
Cc: [email protected]; Kevin Tian; Keir (Xen.org); Jun Nakajima; Andrew Cooper; Tim (Xen.org); Paul Durrant; Lv, Zhiyuan; Jan Beulich; Wei Liu
Subject: Re: [Xen-devel] [PATCH v3 1/3] x86/ioreq server(patch for 4.7):
Rename p2m_mmio_write_dm to p2m_ioreq_server.

Quoted 5 lines · Yu Zhang

Previously p2m type p2m_mmio_write_dm was introduced for write- protected memory pages whose write operations are supposed to be forwarded to and emulated by an ioreq server. Yet limitations of rangeset restrict the number of guest pages to be write-protected.

Quoted 8 lines

This patch replaces the p2m type p2m_mmio_write_dm with a new name:
p2m_ioreq_server, which means this p2m type can be claimed by one ioreq server, instead of being tracked inside the rangeset of ioreq server. Patches following up will add the related hvmop handling code which map/unmap type p2m_ioreq_server to/from an ioreq server.

changes in v3:
- According to Jan & George's comments, keep

HVMMEM_mmio_write_dm

Quoted 5 lines

for old xen interface versions, and replace it with HVMMEM_unused for xen interfaces newer than 4.7.0; For p2m_ioreq_server, a new enum - HVMMEM_ioreq_server is introduced for the get/set mem type interfaces;
- Add George's Reviewed-by and Acked-by from Tim & Andrew.

Unfortunately these rather contradict each other -- I consider Reviewed-by to only stick if the code I've specified hasn't changed (or has only changed trivially).

Also...

xen/arch/x86/hvm/hvm.c int hvm_hap_nested_page_fault(paddr_t gpa,

Quoted 31 lines

changes in v2:
- According to George Dunlap's comments, only rename the p2m type, with no behavior changes.

---
 xen/arch/x86/hvm/hvm.c          | 14 ++++++++------
 xen/arch/x86/mm/p2m-ept.c       |  2 +-
 xen/arch/x86/mm/p2m-pt.c        |  2 +-
 xen/arch/x86/mm/shadow/multi.c  |  2 +-
 xen/include/asm-x86/p2m.h       |  4 ++--
 xen/include/public/hvm/hvm_op.h |  8 +++++++-
 6 files changed, 20 insertions(+), 12 deletions(-)
xen/arch/x86/hvm/hvm.c +0 -0
index f24126d..874cb0f 100644
@@ -1857,7 +1857,7 @@ int hvm_hap_nested_page_fault(paddr_t gpa,

unsigned long gla,

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,

Quoted 9 lines
xen/arch/x86/hvm/hvm.c +1 -1
      */
     if ( (p2mt == p2m_mmio_dm) ||
          (npfec.write_access &&
-          (p2m_is_discard_write(p2mt) || (p2mt == p2m_mmio_write_dm))) )
+          (p2m_is_discard_write(p2mt) || (p2mt == p2m_ioreq_server))) )
     {
         __put_gfn(p2m, gfn);
         if ( ap2m_active )
@@ -5499,8 +5499,8 @@ long do_hvm_op(unsigned long op,

XEN_GUEST_HANDLE_PARAM(void) arg)

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,

Quoted 11 lines
xen/arch/x86/hvm/hvm.c +2 -2
             get_gfn_query_unlocked(d, a.pfn, &t);
             if ( p2m_is_mmio(t) )
                 a.mem_type =  HVMMEM_mmio_dm;
-            else if ( t == p2m_mmio_write_dm )
-                a.mem_type = HVMMEM_mmio_write_dm;
+            else if ( t == p2m_ioreq_server )
+                a.mem_type = HVMMEM_ioreq_server;
             else if ( p2m_is_readonly(t) )
                 a.mem_type =  HVMMEM_ram_ro;
             else if ( p2m_is_ram(t) )
@@ -5531,7 +5531,8 @@ long do_hvm_op(unsigned long op,

XEN_GUEST_HANDLE_PARAM(void) arg)

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,

Quoted 10 lines
xen/arch/x86/hvm/hvm.c +2 -1
             [HVMMEM_ram_rw]  = p2m_ram_rw,
             [HVMMEM_ram_ro]  = p2m_ram_ro,
             [HVMMEM_mmio_dm] = p2m_mmio_dm,
-            [HVMMEM_mmio_write_dm] = p2m_mmio_write_dm
+            [HVMMEM_unused] = p2m_invalid,
+            [HVMMEM_ioreq_server] = p2m_ioreq_server
         };
 
         if ( copy_from_guest(&a, arg, 1) )
@@ -5555,7 +5556,8 @@ long do_hvm_op(unsigned long op,

XEN_GUEST_HANDLE_PARAM(void) arg)

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,

Quoted 10 lines
xen/arch/x86/hvm/hvm.c +2 -1
              ((a.first_pfn + a.nr - 1) > domain_get_maximum_gpfn(d)) )
             goto setmemtype_fail;
 
-        if ( a.hvmmem_type >= ARRAY_SIZE(memtype) )
+        if ( a.hvmmem_type >= ARRAY_SIZE(memtype) ||
+             unlikely(a.hvmmem_type == HVMMEM_unused) )
             goto setmemtype_fail;
 
         while ( a.nr > start_iter )
@@ -5579,7 +5581,7 @@ long do_hvm_op(unsigned long op,

XEN_GUEST_HANDLE_PARAM(void) arg)

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg)

Quoted 3 lines
xen/arch/x86/hvm/hvm.c +0 -0
             }
             if ( !p2m_is_ram(t) &&
                  (!p2m_is_hole(t) || a.hvmmem_type != HVMMEM_mmio_dm)

&&

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op, · line 5582

Quoted 1 line
xen/arch/x86/hvm/hvm.c +0 -1
-                 (t != p2m_mmio_write_dm || a.hvmmem_type !=

HVMMEM_ram_rw) )

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op, · line 5584

Quoted 1 line
xen/arch/x86/hvm/hvm.c +1 -0
+                 (t != p2m_ioreq_server || a.hvmmem_type !=

HVMMEM_ram_rw) )

xen/arch/x86/mm/p2m-ept.c static void ept_p2m_type_to_flags(struct

Quoted 8 lines
xen/arch/x86/hvm/hvm.c +0 -0
             {
                 put_gfn(d, pfn);
                 goto setmemtype_fail;
xen/arch/x86/mm/p2m-ept.c +0 -0
index 3cb6868..380ec25 100644
@@ -171,7 +171,7 @@ static void ept_p2m_type_to_flags(struct

p2m_domain *p2m, ept_entry_t *entry,

xen/arch/x86/mm/p2m-pt.c static unsigned long p2m_type_to_flags(p2m_type_t

Quoted 13 lines
xen/arch/x86/mm/p2m-ept.c +1 -1
             entry->a = entry->d = !!cpu_has_vmx_ept_ad;
             break;
         case p2m_grant_map_ro:
-        case p2m_mmio_write_dm:
+        case p2m_ioreq_server:
             entry->r = 1;
             entry->w = entry->x = 0;
             entry->a = !!cpu_has_vmx_ept_ad;
xen/arch/x86/mm/p2m-pt.c +0 -0
index 3d80612..eabd2e3 100644
@@ -94,7 +94,7 @@ static unsigned long p2m_type_to_flags(p2m_type_t

t, mfn_t mfn,

Review

Quoted 9 lines
xen/arch/x86/mm/p2m-pt.c +1 -1
     default:
         return flags | _PAGE_NX_BIT;
     case p2m_grant_map_ro:
-    case p2m_mmio_write_dm:
+    case p2m_ioreq_server:
         return flags | P2M_BASE_FLAGS | _PAGE_NX_BIT;
     case p2m_ram_ro:
     case p2m_ram_logdirty:
(quoted diff) +0 -0

b/xen/arch/x86/mm/shadow/multi.c

Quoted 17 lines

index e5c8499..c81302a 100644

xen/arch/x86/mm/shadow/multi.c +1 -1
@@ -3225,7 +3225,7 @@ static int sh_page_fault(struct vcpu *v,
 
     /* Need to hand off device-model MMIO to the device model */
     if ( p2mt == p2m_mmio_dm
-         || (p2mt == p2m_mmio_write_dm && ft == ft_demand_write) )
+         || (p2mt == p2m_ioreq_server && ft == ft_demand_write) )
     {
         gpa = guest_walk_to_gpa(&gw);
         goto mmio;
xen/include/asm-x86/p2m.h +0 -0
index 5392eb0..ee2ea9c 100644

xen/include/asm-x86/p2m.h typedef enum { · line 72

Quoted 2 lines
xen/include/asm-x86/p2m.h +0 -0
@@ -71,7 +71,7 @@ typedef enum {
     p2m_ram_shared = 12,          /* Shared or sharable memory */
     p2m_ram_broken = 13,          /* Broken page, access cause domain crash

*/

xen/include/asm-x86/p2m.h typedef enum { · line 74

Quoted 2 lines
xen/include/asm-x86/p2m.h +0 -1
     p2m_map_foreign  = 14,        /* ram pages from foreign domain */
-    p2m_mmio_write_dm = 15,       /* Read-only; writes go to the device

model */

Review

Quoted 14 lines
xen/include/asm-x86/p2m.h +2 -1
+    p2m_ioreq_server = 15,
 } p2m_type_t;
 
 /* Modifiers to the query */
@@ -112,7 +112,7 @@ typedef unsigned int p2m_query_t;
                       | p2m_to_mask(p2m_ram_ro)         \
                       | p2m_to_mask(p2m_grant_map_ro)   \
                       | p2m_to_mask(p2m_ram_shared)     \
-                      | p2m_to_mask(p2m_mmio_write_dm))
+                      | p2m_to_mask(p2m_ioreq_server))
 
 /* Write-discard types, which should discard the write operations */
 #define P2M_DISCARD_WRITE_TYPES (p2m_to_mask(p2m_ram_ro)     \
(quoted diff) +0 -0

b/xen/include/public/hvm/hvm_op.h

xen/include/public/hvm/hvm_op.h typedef enum { · line 85

Quoted 7 lines

index 1606185..b3e45cf 100644

xen/include/public/hvm/hvm_op.h +0 -0
@@ -83,7 +83,13 @@ typedef enum {
     HVMMEM_ram_rw,             /* Normal read/write guest RAM */
     HVMMEM_ram_ro,             /* Read-only; writes are discarded */
     HVMMEM_mmio_dm,            /* Reads and write go to the device model

*/

xen/include/public/hvm/hvm_op.h typedef enum { · line 86

Quoted 1 line
xen/include/public/hvm/hvm_op.h +0 -1
-    HVMMEM_mmio_write_dm       /* Read-only; writes go to the device

model */

xen/include/public/hvm/hvm_op.h typedef enum { · line 87

Quoted 2 lines
xen/include/public/hvm/hvm_op.h +2 -0
+#if __XEN_INTERFACE_VERSION__ < 0x00040700
+    HVMMEM_mmio_write_dm,      /* Read-only; writes go to the device

model */

xen/include/public/hvm/hvm_op.h typedef enum { · line 92

Quoted 5 lines
xen/include/public/hvm/hvm_op.h +5 -0
+#else
+    HVMMEM_unused,             /* Placeholder; setting memory to this type
+                                  will fail for code after 4.7.0 */
+#endif
+    HVMMEM_ioreq_server

Also, I don't think we've had a convincing argument for why this patch needs to be in 4.7. The p2m name changes are internal only, and so don't need to be made at all; and the old functionality will work as well as it ever did. Furthermore, the whole reason we're in this situation is that we checked in a publicly-visible change to the interface before it was properly ready; I think we should avoid making the same mistake this time.

Quoted 6 lines

So personally I'd just leave this patch entirely for 4.8; but if Paul and/or Jan have strong opinions, then I would say check in only a patch to do the #if/#else/#endif, and leave both the p2m type changes and the new HVMMEM_ioreq_server enum for when the 4.8 development window opens.

Quoted 3 lines

If the whole series is going in then I think this patch is ok. If this the only patch that is going in for 4.7 then I thing we need the patch to hvm_op.h to deprecate the old type and that's it. We definitely should not introduce an implementation of the type HVMMEM_ioreq_server that has the same hardcoded semantics as the old type and then change it. The p2m type changes are also wrong. That type needs to be left alone, presumably, so that anything using HVMMEM_mmio_write_dm and compiled to the old interface version continues to function. I think HVMMEM_ioreq_server needs to map to a new p2m type which should be introduced in patch #3.

Sorry, I'm also confused now. :(

Do we really want to introduce a new p2m type? Why? My understanding of the previous agreement is that:
1> We need the interface to work on old hypervisor for HVMMEM_mmio_write_dm;
2> We need the interface to return -EINVAL for new hypervisor for HVMMEM_mmio_write_dm;
3> We need the new type HVMMEM_ioreq_server to work on new hypervisor;

Did I miss something? Or I totally misunderstood?

B.R.
Yu

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#12 lore raw

Re: [PATCH v3 1/3] x86/ioreq server(patch for 4.7): Rename p2m_mmio_write_dm to p2m_ioreq_server.

Quoted 274 lines

-----Original Message-----
From: Yu, Zhang [mailto:[email protected]]
Sent: 25 April 2016 16:22
To: Paul Durrant; George Dunlap
Cc: [email protected]; Kevin Tian; Keir (Xen.org); Jun Nakajima; Andrew Cooper; Tim (Xen.org); Lv, Zhiyuan; Jan Beulich; Wei Liu
Subject: Re: [Xen-devel] [PATCH v3 1/3] x86/ioreq server(patch for 4.7):
Rename p2m_mmio_write_dm to p2m_ioreq_server.

Quoted 7 lines · Paul Durrant
Quoted 7 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of George Dunlap
Sent: 25 April 2016 14:39
To: Yu Zhang
Cc: [email protected]; Kevin Tian; Keir (Xen.org); Jun Nakajima; Andrew Cooper; Tim (Xen.org); Paul Durrant; Lv, Zhiyuan; Jan Beulich; Wei

Liu

Quoted 4 lines
Quoted 4 lines

Subject: Re: [Xen-devel] [PATCH v3 1/3] x86/ioreq server(patch for 4.7):
Rename p2m_mmio_write_dm to p2m_ioreq_server.

On Mon, Apr 25, 2016 at 11:35 AM, Yu Zhang

<[email protected]>

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines · wrote:

Previously p2m type p2m_mmio_write_dm was introduced for write- protected memory pages whose write operations are supposed to be forwarded to and emulated by an ioreq server. Yet limitations of rangeset restrict the number of guest pages to be write-protected.

This patch replaces the p2m type p2m_mmio_write_dm with a new

name:

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

p2m_ioreq_server, which means this p2m type can be claimed by one ioreq server, instead of being tracked inside the rangeset of ioreq server. Patches following up will add the related hvmop handling code which map/unmap type p2m_ioreq_server to/from an ioreq

server.

Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

changes in v3:
- According to Jan & George's comments, keep

HVMMEM_mmio_write_dm

Quoted 3 lines

for old xen interface versions, and replace it with HVMMEM_unused for xen interfaces newer than 4.7.0; For p2m_ioreq_server, a new enum - HVMMEM_ioreq_server is introduced for the get/set mem

type

Quoted 41 lines
Quoted 41 lines
Quoted 2 lines
    interfaces;

- Add George's Reviewed-by and Acked-by from Tim & Andrew.

Unfortunately these rather contradict each other -- I consider Reviewed-by to only stick if the code I've specified hasn't changed (or has only changed trivially).

Also...

xen/arch/x86/hvm/hvm.c int hvm_hap_nested_page_fault(paddr_t gpa,

Quoted 31 lines

changes in v2:
- According to George Dunlap's comments, only rename the p2m type, with no behavior changes.

---
 xen/arch/x86/hvm/hvm.c          | 14 ++++++++------
 xen/arch/x86/mm/p2m-ept.c       |  2 +-
 xen/arch/x86/mm/p2m-pt.c        |  2 +-
 xen/arch/x86/mm/shadow/multi.c  |  2 +-
 xen/include/asm-x86/p2m.h       |  4 ++--
 xen/include/public/hvm/hvm_op.h |  8 +++++++-
 6 files changed, 20 insertions(+), 12 deletions(-)
xen/arch/x86/hvm/hvm.c +0 -0
index f24126d..874cb0f 100644
@@ -1857,7 +1857,7 @@ int hvm_hap_nested_page_fault(paddr_t gpa,

unsigned long gla,

Quoted 4 lines
Quoted 4 lines

xen/arch/x86/hvm/hvm.c int hvm_hap_nested_page_fault(paddr_t gpa, unsigned long gla,

Quoted 4 lines
xen/arch/x86/hvm/hvm.c +0 -1
      */
     if ( (p2mt == p2m_mmio_dm) ||
          (npfec.write_access &&
-          (p2m_is_discard_write(p2mt) || (p2mt ==

p2m_mmio_write_dm))) )

Quoted 44 lines
Quoted 44 lines

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,

Quoted 5 lines
xen/arch/x86/hvm/hvm.c +1 -0
+          (p2m_is_discard_write(p2mt) || (p2mt == p2m_ioreq_server))) )
     {
         __put_gfn(p2m, gfn);
         if ( ap2m_active )
@@ -5499,8 +5499,8 @@ long do_hvm_op(unsigned long op,

XEN_GUEST_HANDLE_PARAM(void) arg)

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,

Quoted 11 lines
xen/arch/x86/hvm/hvm.c +2 -2
             get_gfn_query_unlocked(d, a.pfn, &t);
             if ( p2m_is_mmio(t) )
                 a.mem_type =  HVMMEM_mmio_dm;
-            else if ( t == p2m_mmio_write_dm )
-                a.mem_type = HVMMEM_mmio_write_dm;
+            else if ( t == p2m_ioreq_server )
+                a.mem_type = HVMMEM_ioreq_server;
             else if ( p2m_is_readonly(t) )
                 a.mem_type =  HVMMEM_ram_ro;
             else if ( p2m_is_ram(t) )
@@ -5531,7 +5531,8 @@ long do_hvm_op(unsigned long op,

XEN_GUEST_HANDLE_PARAM(void) arg)

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,

Quoted 10 lines
xen/arch/x86/hvm/hvm.c +2 -1
             [HVMMEM_ram_rw]  = p2m_ram_rw,
             [HVMMEM_ram_ro]  = p2m_ram_ro,
             [HVMMEM_mmio_dm] = p2m_mmio_dm,
-            [HVMMEM_mmio_write_dm] = p2m_mmio_write_dm
+            [HVMMEM_unused] = p2m_invalid,
+            [HVMMEM_ioreq_server] = p2m_ioreq_server
         };
 
         if ( copy_from_guest(&a, arg, 1) )
@@ -5555,7 +5556,8 @@ long do_hvm_op(unsigned long op,

XEN_GUEST_HANDLE_PARAM(void) arg)

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,

Quoted 10 lines
xen/arch/x86/hvm/hvm.c +2 -1
              ((a.first_pfn + a.nr - 1) > domain_get_maximum_gpfn(d)) )
             goto setmemtype_fail;
 
-        if ( a.hvmmem_type >= ARRAY_SIZE(memtype) )
+        if ( a.hvmmem_type >= ARRAY_SIZE(memtype) ||
+             unlikely(a.hvmmem_type == HVMMEM_unused) )
             goto setmemtype_fail;
 
         while ( a.nr > start_iter )
@@ -5579,7 +5581,7 @@ long do_hvm_op(unsigned long op,

XEN_GUEST_HANDLE_PARAM(void) arg)

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg)

Quoted 3 lines
xen/arch/x86/hvm/hvm.c +0 -0
             }
             if ( !p2m_is_ram(t) &&
                  (!p2m_is_hole(t) || a.hvmmem_type != HVMMEM_mmio_dm)

&&

Quoted 8 lines
Quoted 8 lines

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op, · line 5582

Quoted 1 line
xen/arch/x86/hvm/hvm.c +0 -1
-                 (t != p2m_mmio_write_dm || a.hvmmem_type !=

HVMMEM_ram_rw) )

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op, · line 5584

Quoted 1 line
xen/arch/x86/hvm/hvm.c +1 -0
+                 (t != p2m_ioreq_server || a.hvmmem_type !=

HVMMEM_ram_rw) )

xen/arch/x86/mm/p2m-

Quoted 4 lines
xen/arch/x86/hvm/hvm.c +0 -0
             {
                 put_gfn(d, pfn);
                 goto setmemtype_fail;
xen/arch/x86/mm/p2m- renamed from xen/arch/x86/mm/p2m-ept.c +0 -0

ept.c

Quoted 5 lines
Quoted 5 lines

xen/arch/x86/mm/p2m-ept.c static void ept_p2m_type_to_flags(struct

Quoted 4 lines

index 3cb6868..380ec25 100644

xen/arch/x86/mm/p2m-ept.c +0 -0
@@ -171,7 +171,7 @@ static void ept_p2m_type_to_flags(struct

p2m_domain *p2m, ept_entry_t *entry,

Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
xen/arch/x86/mm/p2m-ept.c +1 -1
             entry->a = entry->d = !!cpu_has_vmx_ept_ad;
             break;
         case p2m_grant_map_ro:
-        case p2m_mmio_write_dm:
+        case p2m_ioreq_server:
Quoted 8 lines

xen/arch/x86/mm/p2m-pt.c static unsigned long

Quoted 8 lines
xen/arch/x86/mm/p2m-ept.c +0 -0
             entry->r = 1;
             entry->w = entry->x = 0;
             entry->a = !!cpu_has_vmx_ept_ad;
xen/arch/x86/mm/p2m-pt.c +0 -0
index 3d80612..eabd2e3 100644
@@ -94,7 +94,7 @@ static unsigned long

p2m_type_to_flags(p2m_type_t

Quoted 16 lines
Quoted 16 lines

t, mfn_t mfn,

Review

Quoted 9 lines
xen/arch/x86/mm/p2m-pt.c +1 -1
     default:
         return flags | _PAGE_NX_BIT;
     case p2m_grant_map_ro:
-    case p2m_mmio_write_dm:
+    case p2m_ioreq_server:
         return flags | P2M_BASE_FLAGS | _PAGE_NX_BIT;
     case p2m_ram_ro:
     case p2m_ram_logdirty:
(quoted diff) +0 -0

b/xen/arch/x86/mm/shadow/multi.c

Quoted 5 lines

index e5c8499..c81302a 100644

xen/arch/x86/mm/shadow/multi.c +0 -0
@@ -3225,7 +3225,7 @@ static int sh_page_fault(struct vcpu *v,
 
Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
xen/arch/x86/mm/shadow/multi.c +1 -1
     /* Need to hand off device-model MMIO to the device model */
     if ( p2mt == p2m_mmio_dm
-         || (p2mt == p2m_mmio_write_dm && ft == ft_demand_write) )
+         || (p2mt == p2m_ioreq_server && ft == ft_demand_write) )
     {
         gpa = guest_walk_to_gpa(&gw);
Quoted 8 lines

xen/include/asm-x86/p2m.h typedef enum { · line 72

Quoted 8 lines
xen/arch/x86/mm/shadow/multi.c +0 -0
         goto mmio;
xen/include/asm-x86/p2m.h +0 -0
index 5392eb0..ee2ea9c 100644
@@ -71,7 +71,7 @@ typedef enum {
     p2m_ram_shared = 12,          /* Shared or sharable memory */
     p2m_ram_broken = 13,          /* Broken page, access cause domain

crash

Quoted 19 lines
Quoted 19 lines

*/

xen/include/asm-x86/p2m.h typedef enum { · line 74

Quoted 2 lines
xen/include/asm-x86/p2m.h +0 -1
     p2m_map_foreign  = 14,        /* ram pages from foreign domain */
-    p2m_mmio_write_dm = 15,       /* Read-only; writes go to the device

model */

Review

Quoted 14 lines
xen/include/asm-x86/p2m.h +2 -1
+    p2m_ioreq_server = 15,
 } p2m_type_t;
 
 /* Modifiers to the query */
@@ -112,7 +112,7 @@ typedef unsigned int p2m_query_t;
                       | p2m_to_mask(p2m_ram_ro)         \
                       | p2m_to_mask(p2m_grant_map_ro)   \
                       | p2m_to_mask(p2m_ram_shared)     \
-                      | p2m_to_mask(p2m_mmio_write_dm))
+                      | p2m_to_mask(p2m_ioreq_server))
 
 /* Write-discard types, which should discard the write operations */
 #define P2M_DISCARD_WRITE_TYPES (p2m_to_mask(p2m_ram_ro)     \
(quoted diff) +0 -0

b/xen/include/public/hvm/hvm_op.h

Quoted 7 lines
Quoted 7 lines

xen/include/public/hvm/hvm_op.h typedef enum { · line 85

Quoted 7 lines

index 1606185..b3e45cf 100644

xen/include/public/hvm/hvm_op.h +0 -0
@@ -83,7 +83,13 @@ typedef enum {
     HVMMEM_ram_rw,             /* Normal read/write guest RAM */
     HVMMEM_ram_ro,             /* Read-only; writes are discarded */
     HVMMEM_mmio_dm,            /* Reads and write go to the device

model

Quoted 8 lines
Quoted 8 lines

*/

xen/include/public/hvm/hvm_op.h typedef enum { · line 86

Quoted 1 line
xen/include/public/hvm/hvm_op.h +0 -1
-    HVMMEM_mmio_write_dm       /* Read-only; writes go to the device

model */

xen/include/public/hvm/hvm_op.h typedef enum { · line 87

Quoted 2 lines
xen/include/public/hvm/hvm_op.h +2 -0
+#if __XEN_INTERFACE_VERSION__ < 0x00040700
+    HVMMEM_mmio_write_dm,      /* Read-only; writes go to the device

model */

Quoted 2 lines
xen/include/public/hvm/hvm_op.h +2 -0
+#else
+    HVMMEM_unused,             /* Placeholder; setting memory to this

type

Quoted 12 lines
Quoted 12 lines

xen/include/public/hvm/hvm_op.h typedef enum { · line 92

Quoted 3 lines
xen/include/public/hvm/hvm_op.h +3 -0
+                                  will fail for code after 4.7.0 */
+#endif
+    HVMMEM_ioreq_server

Also, I don't think we've had a convincing argument for why this patch needs to be in 4.7. The p2m name changes are internal only, and so don't need to be made at all; and the old functionality will work as well as it ever did. Furthermore, the whole reason we're in this situation is that we checked in a publicly-visible change to the interface before it was properly ready; I think we should avoid making the same mistake this time.

Quoted 4 lines
Quoted 4 lines

So personally I'd just leave this patch entirely for 4.8; but if Paul and/or Jan have strong opinions, then I would say check in only a patch to do the #if/#else/#endif, and leave both the p2m type changes and the new HVMMEM_ioreq_server enum for when the 4.8

development

Quoted 4 lines
Quoted 2 lines

window opens.

If the whole series is going in then I think this patch is ok. If this the only

patch that is going in for 4.7 then I thing we need the patch to hvm_op.h to deprecate the old type and that's it. We definitely should not introduce an implementation of the type HVMMEM_ioreq_server that has the same hardcoded semantics as the old type and then change it.

Quoted 1 line

The p2m type changes are also wrong. That type needs to be left alone,

presumably, so that anything using HVMMEM_mmio_write_dm and compiled to the old interface version continues to function. I think HVMMEM_ioreq_server needs to map to a new p2m type which should be introduced in patch #3.

Quoted 1 line

Sorry, I'm also confused now. :(

Do we really want to introduce a new p2m type? Why? My understanding of the previous agreement is that:
1> We need the interface to work on old hypervisor for HVMMEM_mmio_write_dm;
2> We need the interface to return -EINVAL for new hypervisor for HVMMEM_mmio_write_dm;
3> We need the new type HVMMEM_ioreq_server to work on new hypervisor;

Quoted 2 lines

Did I miss something? Or I totally misunderstood?

I don't know. I'm confused too. What we definitely don't want to do is add a new HVMMEM type and have it map to the old behaviour, otherwise we're no better off.

The question I'm not clear on the answer to is what happens to old code:

Should it continue to compile? If so, should it continue to run.

Paul

Quoted 2 lines

B.R.
Yu

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#13 lore raw

Re: [PATCH v3 1/3] x86/ioreq server(patch for 4.7): Rename p2m_mmio_write_dm to p2m_ioreq_server.

Quoted 279 lines
Quoted 244 lines
Quoted 1 line · On 25.04.16 at 17:29, <[email protected]> wrote:

-----Original Message-----
From: Yu, Zhang [mailto:[email protected]]
Sent: 25 April 2016 16:22
To: Paul Durrant; George Dunlap
Cc: [email protected]; Kevin Tian; Keir (Xen.org); Jun Nakajima; Andrew Cooper; Tim (Xen.org); Lv, Zhiyuan; Jan Beulich; Wei Liu
Subject: Re: [Xen-devel] [PATCH v3 1/3] x86/ioreq server(patch for 4.7):
Rename p2m_mmio_write_dm to p2m_ioreq_server.

Quoted 7 lines · Paul Durrant
Quoted 7 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of George Dunlap
Sent: 25 April 2016 14:39
To: Yu Zhang
Cc: [email protected]; Kevin Tian; Keir (Xen.org); Jun Nakajima; Andrew Cooper; Tim (Xen.org); Paul Durrant; Lv, Zhiyuan; Jan Beulich; Wei

Liu

Quoted 4 lines
Quoted 4 lines

Subject: Re: [Xen-devel] [PATCH v3 1/3] x86/ioreq server(patch for 4.7):
Rename p2m_mmio_write_dm to p2m_ioreq_server.

On Mon, Apr 25, 2016 at 11:35 AM, Yu Zhang

<[email protected]>

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines · wrote:

Previously p2m type p2m_mmio_write_dm was introduced for write- protected memory pages whose write operations are supposed to be forwarded to and emulated by an ioreq server. Yet limitations of rangeset restrict the number of guest pages to be write-protected.

This patch replaces the p2m type p2m_mmio_write_dm with a new

name:

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

p2m_ioreq_server, which means this p2m type can be claimed by one ioreq server, instead of being tracked inside the rangeset of ioreq server. Patches following up will add the related hvmop handling code which map/unmap type p2m_ioreq_server to/from an ioreq

server.

Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

changes in v3:
- According to Jan & George's comments, keep

HVMMEM_mmio_write_dm

Quoted 3 lines

for old xen interface versions, and replace it with HVMMEM_unused for xen interfaces newer than 4.7.0; For p2m_ioreq_server, a new enum - HVMMEM_ioreq_server is introduced for the get/set mem

type

Quoted 41 lines
Quoted 41 lines
Quoted 2 lines
    interfaces;

- Add George's Reviewed-by and Acked-by from Tim & Andrew.

Unfortunately these rather contradict each other -- I consider Reviewed-by to only stick if the code I've specified hasn't changed (or has only changed trivially).

Also...

xen/arch/x86/hvm/hvm.c int hvm_hap_nested_page_fault(paddr_t gpa,

Quoted 31 lines

changes in v2:
- According to George Dunlap's comments, only rename the p2m type, with no behavior changes.

---
 xen/arch/x86/hvm/hvm.c          | 14 ++++++++------
 xen/arch/x86/mm/p2m-ept.c       |  2 +-
 xen/arch/x86/mm/p2m-pt.c        |  2 +-
 xen/arch/x86/mm/shadow/multi.c  |  2 +-
 xen/include/asm-x86/p2m.h       |  4 ++--
 xen/include/public/hvm/hvm_op.h |  8 +++++++-
 6 files changed, 20 insertions(+), 12 deletions(-)
xen/arch/x86/hvm/hvm.c +0 -0
index f24126d..874cb0f 100644
@@ -1857,7 +1857,7 @@ int hvm_hap_nested_page_fault(paddr_t gpa,

unsigned long gla,

Quoted 4 lines
Quoted 4 lines

xen/arch/x86/hvm/hvm.c int hvm_hap_nested_page_fault(paddr_t gpa, unsigned long gla,

Quoted 4 lines
xen/arch/x86/hvm/hvm.c +0 -1
      */
     if ( (p2mt == p2m_mmio_dm) ||
          (npfec.write_access &&
-          (p2m_is_discard_write(p2mt) || (p2mt ==

p2m_mmio_write_dm))) )

Quoted 44 lines
Quoted 44 lines

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,

Quoted 5 lines
xen/arch/x86/hvm/hvm.c +1 -0
+          (p2m_is_discard_write(p2mt) || (p2mt == p2m_ioreq_server))) )
     {
         __put_gfn(p2m, gfn);
         if ( ap2m_active )
@@ -5499,8 +5499,8 @@ long do_hvm_op(unsigned long op,

XEN_GUEST_HANDLE_PARAM(void) arg)

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,

Quoted 11 lines
xen/arch/x86/hvm/hvm.c +2 -2
             get_gfn_query_unlocked(d, a.pfn, &t);
             if ( p2m_is_mmio(t) )
                 a.mem_type =  HVMMEM_mmio_dm;
-            else if ( t == p2m_mmio_write_dm )
-                a.mem_type = HVMMEM_mmio_write_dm;
+            else if ( t == p2m_ioreq_server )
+                a.mem_type = HVMMEM_ioreq_server;
             else if ( p2m_is_readonly(t) )
                 a.mem_type =  HVMMEM_ram_ro;
             else if ( p2m_is_ram(t) )
@@ -5531,7 +5531,8 @@ long do_hvm_op(unsigned long op,

XEN_GUEST_HANDLE_PARAM(void) arg)

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,

Quoted 10 lines
xen/arch/x86/hvm/hvm.c +2 -1
             [HVMMEM_ram_rw]  = p2m_ram_rw,
             [HVMMEM_ram_ro]  = p2m_ram_ro,
             [HVMMEM_mmio_dm] = p2m_mmio_dm,
-            [HVMMEM_mmio_write_dm] = p2m_mmio_write_dm
+            [HVMMEM_unused] = p2m_invalid,
+            [HVMMEM_ioreq_server] = p2m_ioreq_server
         };
 
         if ( copy_from_guest(&a, arg, 1) )
@@ -5555,7 +5556,8 @@ long do_hvm_op(unsigned long op,

XEN_GUEST_HANDLE_PARAM(void) arg)

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,

Quoted 10 lines
xen/arch/x86/hvm/hvm.c +2 -1
              ((a.first_pfn + a.nr - 1) > domain_get_maximum_gpfn(d)) )
             goto setmemtype_fail;
 
-        if ( a.hvmmem_type >= ARRAY_SIZE(memtype) )
+        if ( a.hvmmem_type >= ARRAY_SIZE(memtype) ||
+             unlikely(a.hvmmem_type == HVMMEM_unused) )
             goto setmemtype_fail;
 
         while ( a.nr > start_iter )
@@ -5579,7 +5581,7 @@ long do_hvm_op(unsigned long op,

XEN_GUEST_HANDLE_PARAM(void) arg)

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg)

Quoted 3 lines
xen/arch/x86/hvm/hvm.c +0 -0
             }
             if ( !p2m_is_ram(t) &&
                  (!p2m_is_hole(t) || a.hvmmem_type != HVMMEM_mmio_dm)

&&

Quoted 8 lines
Quoted 8 lines

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op, · line 5582

Quoted 1 line
xen/arch/x86/hvm/hvm.c +0 -1
-                 (t != p2m_mmio_write_dm || a.hvmmem_type !=

HVMMEM_ram_rw) )

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op, · line 5584

Quoted 1 line
xen/arch/x86/hvm/hvm.c +1 -0
+                 (t != p2m_ioreq_server || a.hvmmem_type !=

HVMMEM_ram_rw) )

xen/arch/x86/mm/p2m-

Quoted 4 lines
xen/arch/x86/hvm/hvm.c +0 -0
             {
                 put_gfn(d, pfn);
                 goto setmemtype_fail;
xen/arch/x86/mm/p2m- renamed from xen/arch/x86/mm/p2m-ept.c +0 -0

ept.c

Quoted 5 lines
Quoted 5 lines

xen/arch/x86/mm/p2m-ept.c static void ept_p2m_type_to_flags(struct

Quoted 4 lines

index 3cb6868..380ec25 100644

xen/arch/x86/mm/p2m-ept.c +0 -0
@@ -171,7 +171,7 @@ static void ept_p2m_type_to_flags(struct

p2m_domain *p2m, ept_entry_t *entry,

Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
xen/arch/x86/mm/p2m-ept.c +1 -1
             entry->a = entry->d = !!cpu_has_vmx_ept_ad;
             break;
         case p2m_grant_map_ro:
-        case p2m_mmio_write_dm:
+        case p2m_ioreq_server:
Quoted 8 lines

xen/arch/x86/mm/p2m-pt.c static unsigned long

Quoted 8 lines
xen/arch/x86/mm/p2m-ept.c +0 -0
             entry->r = 1;
             entry->w = entry->x = 0;
             entry->a = !!cpu_has_vmx_ept_ad;
xen/arch/x86/mm/p2m-pt.c +0 -0
index 3d80612..eabd2e3 100644
@@ -94,7 +94,7 @@ static unsigned long

p2m_type_to_flags(p2m_type_t

Quoted 16 lines
Quoted 16 lines

t, mfn_t mfn,

Review

Quoted 9 lines
xen/arch/x86/mm/p2m-pt.c +1 -1
     default:
         return flags | _PAGE_NX_BIT;
     case p2m_grant_map_ro:
-    case p2m_mmio_write_dm:
+    case p2m_ioreq_server:
         return flags | P2M_BASE_FLAGS | _PAGE_NX_BIT;
     case p2m_ram_ro:
     case p2m_ram_logdirty:
(quoted diff) +0 -0

b/xen/arch/x86/mm/shadow/multi.c

Quoted 5 lines

index e5c8499..c81302a 100644

xen/arch/x86/mm/shadow/multi.c +0 -0
@@ -3225,7 +3225,7 @@ static int sh_page_fault(struct vcpu *v,
 
Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
xen/arch/x86/mm/shadow/multi.c +1 -1
     /* Need to hand off device-model MMIO to the device model */
     if ( p2mt == p2m_mmio_dm
-         || (p2mt == p2m_mmio_write_dm && ft == ft_demand_write) )
+         || (p2mt == p2m_ioreq_server && ft == ft_demand_write) )
     {
         gpa = guest_walk_to_gpa(&gw);
Quoted 8 lines

xen/include/asm-x86/p2m.h typedef enum { · line 72

Quoted 8 lines
xen/arch/x86/mm/shadow/multi.c +0 -0
         goto mmio;
xen/include/asm-x86/p2m.h +0 -0
index 5392eb0..ee2ea9c 100644
@@ -71,7 +71,7 @@ typedef enum {
     p2m_ram_shared = 12,          /* Shared or sharable memory */
     p2m_ram_broken = 13,          /* Broken page, access cause domain

crash

Quoted 19 lines
Quoted 19 lines

*/

xen/include/asm-x86/p2m.h typedef enum { · line 74

Quoted 2 lines
xen/include/asm-x86/p2m.h +0 -1
     p2m_map_foreign  = 14,        /* ram pages from foreign domain */
-    p2m_mmio_write_dm = 15,       /* Read-only; writes go to the device

model */

Review

Quoted 14 lines
xen/include/asm-x86/p2m.h +2 -1
+    p2m_ioreq_server = 15,
 } p2m_type_t;
 
 /* Modifiers to the query */
@@ -112,7 +112,7 @@ typedef unsigned int p2m_query_t;
                       | p2m_to_mask(p2m_ram_ro)         \
                       | p2m_to_mask(p2m_grant_map_ro)   \
                       | p2m_to_mask(p2m_ram_shared)     \
-                      | p2m_to_mask(p2m_mmio_write_dm))
+                      | p2m_to_mask(p2m_ioreq_server))
 
 /* Write-discard types, which should discard the write operations */
 #define P2M_DISCARD_WRITE_TYPES (p2m_to_mask(p2m_ram_ro)     \
(quoted diff) +0 -0

b/xen/include/public/hvm/hvm_op.h

Quoted 7 lines
Quoted 7 lines

xen/include/public/hvm/hvm_op.h typedef enum { · line 85

Quoted 7 lines

index 1606185..b3e45cf 100644

xen/include/public/hvm/hvm_op.h +0 -0
@@ -83,7 +83,13 @@ typedef enum {
     HVMMEM_ram_rw,             /* Normal read/write guest RAM */
     HVMMEM_ram_ro,             /* Read-only; writes are discarded */
     HVMMEM_mmio_dm,            /* Reads and write go to the device

model

Quoted 8 lines
Quoted 8 lines

*/

xen/include/public/hvm/hvm_op.h typedef enum { · line 86

Quoted 1 line
xen/include/public/hvm/hvm_op.h +0 -1
-    HVMMEM_mmio_write_dm       /* Read-only; writes go to the device

model */

xen/include/public/hvm/hvm_op.h typedef enum { · line 87

Quoted 2 lines
xen/include/public/hvm/hvm_op.h +2 -0
+#if __XEN_INTERFACE_VERSION__ < 0x00040700
+    HVMMEM_mmio_write_dm,      /* Read-only; writes go to the device

model */

Quoted 2 lines
xen/include/public/hvm/hvm_op.h +2 -0
+#else
+    HVMMEM_unused,             /* Placeholder; setting memory to this

type

Quoted 12 lines
Quoted 12 lines

xen/include/public/hvm/hvm_op.h typedef enum { · line 92

Quoted 3 lines
xen/include/public/hvm/hvm_op.h +3 -0
+                                  will fail for code after 4.7.0 */
+#endif
+    HVMMEM_ioreq_server

Also, I don't think we've had a convincing argument for why this patch needs to be in 4.7. The p2m name changes are internal only, and so don't need to be made at all; and the old functionality will work as well as it ever did. Furthermore, the whole reason we're in this situation is that we checked in a publicly-visible change to the interface before it was properly ready; I think we should avoid making the same mistake this time.

Quoted 9 lines
Quoted 4 lines
Quoted 4 lines

So personally I'd just leave this patch entirely for 4.8; but if Paul and/or Jan have strong opinions, then I would say check in only a patch to do the #if/#else/#endif, and leave both the p2m type changes and the new HVMMEM_ioreq_server enum for when the 4.8

development

Quoted 4 lines
Quoted 2 lines

window opens.

If the whole series is going in then I think this patch is ok. If this the

only

Quoted 22 lines

patch that is going in for 4.7 then I thing we need the patch to hvm_op.h to deprecate the old type and that's it. We definitely should not introduce an implementation of the type HVMMEM_ioreq_server that has the same hardcoded semantics as the old type and then change it.

Quoted 1 line

The p2m type changes are also wrong. That type needs to be left alone,

presumably, so that anything using HVMMEM_mmio_write_dm and compiled to the old interface version continues to function. I think HVMMEM_ioreq_server needs to map to a new p2m type which should be introduced in patch #3.

Quoted 1 line

Sorry, I'm also confused now. :(

Do we really want to introduce a new p2m type? Why? My understanding of the previous agreement is that:
1> We need the interface to work on old hypervisor for HVMMEM_mmio_write_dm;
2> We need the interface to return -EINVAL for new hypervisor for HVMMEM_mmio_write_dm;
3> We need the new type HVMMEM_ioreq_server to work on new hypervisor;

Quoted 2 lines

Did I miss something? Or I totally misunderstood?

Quoted 7 lines

I don't know. I'm confused too. What we definitely don't want to do is add a new HVMMEM type and have it map to the old behaviour, otherwise we're no better off.

The question I'm not clear on the answer to is what happens to old code:

Should it continue to compile? If so, should it continue to run.

We only need to be concerned about the "get type" functionality, as that's the only thing an arbitrary guest can use. If the hypercall simply never returns the old type, then old code will still work (it'll just have some dead code on new Xen), and hence it compiling against the older interface is fine (and, from general considerations, a requirement).

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

author
#14 lore raw

Re: [PATCH v3 1/3] x86/ioreq server(patch for 4.7): Rename p2m_mmio_write_dm to p2m_ioreq_server.

Quoted 285 lines · Jan Beulich
Quoted 285 lines
Quoted 244 lines
Quoted 1 line · On 25.04.16 at 17:29, <[email protected]> wrote:

-----Original Message-----
From: Yu, Zhang [mailto:[email protected]]
Sent: 25 April 2016 16:22
To: Paul Durrant; George Dunlap
Cc: [email protected]; Kevin Tian; Keir (Xen.org); Jun Nakajima; Andrew Cooper; Tim (Xen.org); Lv, Zhiyuan; Jan Beulich; Wei Liu
Subject: Re: [Xen-devel] [PATCH v3 1/3] x86/ioreq server(patch for 4.7):
Rename p2m_mmio_write_dm to p2m_ioreq_server.

Quoted 7 lines · Paul Durrant
Quoted 7 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of George Dunlap
Sent: 25 April 2016 14:39
To: Yu Zhang
Cc: [email protected]; Kevin Tian; Keir (Xen.org); Jun Nakajima; Andrew Cooper; Tim (Xen.org); Paul Durrant; Lv, Zhiyuan; Jan Beulich; Wei

Liu

Quoted 4 lines
Quoted 4 lines

Subject: Re: [Xen-devel] [PATCH v3 1/3] x86/ioreq server(patch for 4.7):
Rename p2m_mmio_write_dm to p2m_ioreq_server.

On Mon, Apr 25, 2016 at 11:35 AM, Yu Zhang

<[email protected]>

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines · wrote:

Previously p2m type p2m_mmio_write_dm was introduced for write- protected memory pages whose write operations are supposed to be forwarded to and emulated by an ioreq server. Yet limitations of rangeset restrict the number of guest pages to be write-protected.

This patch replaces the p2m type p2m_mmio_write_dm with a new

name:

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

p2m_ioreq_server, which means this p2m type can be claimed by one ioreq server, instead of being tracked inside the rangeset of ioreq server. Patches following up will add the related hvmop handling code which map/unmap type p2m_ioreq_server to/from an ioreq

server.

Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

changes in v3:
- According to Jan & George's comments, keep

HVMMEM_mmio_write_dm

Quoted 3 lines

for old xen interface versions, and replace it with HVMMEM_unused for xen interfaces newer than 4.7.0; For p2m_ioreq_server, a new enum - HVMMEM_ioreq_server is introduced for the get/set mem

type

Quoted 41 lines
Quoted 41 lines
Quoted 2 lines
    interfaces;

- Add George's Reviewed-by and Acked-by from Tim & Andrew.

Unfortunately these rather contradict each other -- I consider Reviewed-by to only stick if the code I've specified hasn't changed (or has only changed trivially).

Also...

xen/arch/x86/hvm/hvm.c int hvm_hap_nested_page_fault(paddr_t gpa,

Quoted 31 lines

changes in v2:
- According to George Dunlap's comments, only rename the p2m type, with no behavior changes.

---
 xen/arch/x86/hvm/hvm.c          | 14 ++++++++------
 xen/arch/x86/mm/p2m-ept.c       |  2 +-
 xen/arch/x86/mm/p2m-pt.c        |  2 +-
 xen/arch/x86/mm/shadow/multi.c  |  2 +-
 xen/include/asm-x86/p2m.h       |  4 ++--
 xen/include/public/hvm/hvm_op.h |  8 +++++++-
 6 files changed, 20 insertions(+), 12 deletions(-)
xen/arch/x86/hvm/hvm.c +0 -0
index f24126d..874cb0f 100644
@@ -1857,7 +1857,7 @@ int hvm_hap_nested_page_fault(paddr_t gpa,

unsigned long gla,

Quoted 4 lines
Quoted 4 lines

xen/arch/x86/hvm/hvm.c int hvm_hap_nested_page_fault(paddr_t gpa, unsigned long gla,

Quoted 4 lines
xen/arch/x86/hvm/hvm.c +0 -1
      */
     if ( (p2mt == p2m_mmio_dm) ||
          (npfec.write_access &&
-          (p2m_is_discard_write(p2mt) || (p2mt ==

p2m_mmio_write_dm))) )

Quoted 44 lines
Quoted 44 lines

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,

Quoted 5 lines
xen/arch/x86/hvm/hvm.c +1 -0
+          (p2m_is_discard_write(p2mt) || (p2mt == p2m_ioreq_server))) )
     {
         __put_gfn(p2m, gfn);
         if ( ap2m_active )
@@ -5499,8 +5499,8 @@ long do_hvm_op(unsigned long op,

XEN_GUEST_HANDLE_PARAM(void) arg)

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,

Quoted 11 lines
xen/arch/x86/hvm/hvm.c +2 -2
             get_gfn_query_unlocked(d, a.pfn, &t);
             if ( p2m_is_mmio(t) )
                 a.mem_type =  HVMMEM_mmio_dm;
-            else if ( t == p2m_mmio_write_dm )
-                a.mem_type = HVMMEM_mmio_write_dm;
+            else if ( t == p2m_ioreq_server )
+                a.mem_type = HVMMEM_ioreq_server;
             else if ( p2m_is_readonly(t) )
                 a.mem_type =  HVMMEM_ram_ro;
             else if ( p2m_is_ram(t) )
@@ -5531,7 +5531,8 @@ long do_hvm_op(unsigned long op,

XEN_GUEST_HANDLE_PARAM(void) arg)

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,

Quoted 10 lines
xen/arch/x86/hvm/hvm.c +2 -1
             [HVMMEM_ram_rw]  = p2m_ram_rw,
             [HVMMEM_ram_ro]  = p2m_ram_ro,
             [HVMMEM_mmio_dm] = p2m_mmio_dm,
-            [HVMMEM_mmio_write_dm] = p2m_mmio_write_dm
+            [HVMMEM_unused] = p2m_invalid,
+            [HVMMEM_ioreq_server] = p2m_ioreq_server
         };
 
         if ( copy_from_guest(&a, arg, 1) )
@@ -5555,7 +5556,8 @@ long do_hvm_op(unsigned long op,

XEN_GUEST_HANDLE_PARAM(void) arg)

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,

Quoted 10 lines
xen/arch/x86/hvm/hvm.c +2 -1
              ((a.first_pfn + a.nr - 1) > domain_get_maximum_gpfn(d)) )
             goto setmemtype_fail;
 
-        if ( a.hvmmem_type >= ARRAY_SIZE(memtype) )
+        if ( a.hvmmem_type >= ARRAY_SIZE(memtype) ||
+             unlikely(a.hvmmem_type == HVMMEM_unused) )
             goto setmemtype_fail;
 
         while ( a.nr > start_iter )
@@ -5579,7 +5581,7 @@ long do_hvm_op(unsigned long op,

XEN_GUEST_HANDLE_PARAM(void) arg)

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg)

Quoted 3 lines
xen/arch/x86/hvm/hvm.c +0 -0
             }
             if ( !p2m_is_ram(t) &&
                  (!p2m_is_hole(t) || a.hvmmem_type != HVMMEM_mmio_dm)

&&

Quoted 8 lines
Quoted 8 lines

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op, · line 5582

Quoted 1 line
xen/arch/x86/hvm/hvm.c +0 -1
-                 (t != p2m_mmio_write_dm || a.hvmmem_type !=

HVMMEM_ram_rw) )

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op, · line 5584

Quoted 1 line
xen/arch/x86/hvm/hvm.c +1 -0
+                 (t != p2m_ioreq_server || a.hvmmem_type !=

HVMMEM_ram_rw) )

xen/arch/x86/mm/p2m-

Quoted 4 lines
xen/arch/x86/hvm/hvm.c +0 -0
             {
                 put_gfn(d, pfn);
                 goto setmemtype_fail;
xen/arch/x86/mm/p2m- renamed from xen/arch/x86/mm/p2m-ept.c +0 -0

ept.c

Quoted 5 lines
Quoted 5 lines

xen/arch/x86/mm/p2m-ept.c static void ept_p2m_type_to_flags(struct

Quoted 4 lines

index 3cb6868..380ec25 100644

xen/arch/x86/mm/p2m-ept.c +0 -0
@@ -171,7 +171,7 @@ static void ept_p2m_type_to_flags(struct

p2m_domain *p2m, ept_entry_t *entry,

Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
xen/arch/x86/mm/p2m-ept.c +1 -1
             entry->a = entry->d = !!cpu_has_vmx_ept_ad;
             break;
         case p2m_grant_map_ro:
-        case p2m_mmio_write_dm:
+        case p2m_ioreq_server:
Quoted 8 lines

xen/arch/x86/mm/p2m-pt.c static unsigned long

Quoted 8 lines
xen/arch/x86/mm/p2m-ept.c +0 -0
             entry->r = 1;
             entry->w = entry->x = 0;
             entry->a = !!cpu_has_vmx_ept_ad;
xen/arch/x86/mm/p2m-pt.c +0 -0
index 3d80612..eabd2e3 100644
@@ -94,7 +94,7 @@ static unsigned long

p2m_type_to_flags(p2m_type_t

Quoted 16 lines
Quoted 16 lines

t, mfn_t mfn,

Review

Quoted 9 lines
xen/arch/x86/mm/p2m-pt.c +1 -1
     default:
         return flags | _PAGE_NX_BIT;
     case p2m_grant_map_ro:
-    case p2m_mmio_write_dm:
+    case p2m_ioreq_server:
         return flags | P2M_BASE_FLAGS | _PAGE_NX_BIT;
     case p2m_ram_ro:
     case p2m_ram_logdirty:
(quoted diff) +0 -0

b/xen/arch/x86/mm/shadow/multi.c

Quoted 5 lines

index e5c8499..c81302a 100644

xen/arch/x86/mm/shadow/multi.c +0 -0
@@ -3225,7 +3225,7 @@ static int sh_page_fault(struct vcpu *v,
 
Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
xen/arch/x86/mm/shadow/multi.c +1 -1
     /* Need to hand off device-model MMIO to the device model */
     if ( p2mt == p2m_mmio_dm
-         || (p2mt == p2m_mmio_write_dm && ft == ft_demand_write) )
+         || (p2mt == p2m_ioreq_server && ft == ft_demand_write) )
     {
         gpa = guest_walk_to_gpa(&gw);
Quoted 8 lines

xen/include/asm-x86/p2m.h typedef enum { · line 72

Quoted 8 lines
xen/arch/x86/mm/shadow/multi.c +0 -0
         goto mmio;
xen/include/asm-x86/p2m.h +0 -0
index 5392eb0..ee2ea9c 100644
@@ -71,7 +71,7 @@ typedef enum {
     p2m_ram_shared = 12,          /* Shared or sharable memory */
     p2m_ram_broken = 13,          /* Broken page, access cause domain

crash

Quoted 19 lines
Quoted 19 lines

*/

xen/include/asm-x86/p2m.h typedef enum { · line 74

Quoted 2 lines
xen/include/asm-x86/p2m.h +0 -1
     p2m_map_foreign  = 14,        /* ram pages from foreign domain */
-    p2m_mmio_write_dm = 15,       /* Read-only; writes go to the device

model */

Review

Quoted 14 lines
xen/include/asm-x86/p2m.h +2 -1
+    p2m_ioreq_server = 15,
 } p2m_type_t;
 
 /* Modifiers to the query */
@@ -112,7 +112,7 @@ typedef unsigned int p2m_query_t;
                       | p2m_to_mask(p2m_ram_ro)         \
                       | p2m_to_mask(p2m_grant_map_ro)   \
                       | p2m_to_mask(p2m_ram_shared)     \
-                      | p2m_to_mask(p2m_mmio_write_dm))
+                      | p2m_to_mask(p2m_ioreq_server))
 
 /* Write-discard types, which should discard the write operations */
 #define P2M_DISCARD_WRITE_TYPES (p2m_to_mask(p2m_ram_ro)     \
(quoted diff) +0 -0

b/xen/include/public/hvm/hvm_op.h

Quoted 7 lines
Quoted 7 lines

xen/include/public/hvm/hvm_op.h typedef enum { · line 85

Quoted 7 lines

index 1606185..b3e45cf 100644

xen/include/public/hvm/hvm_op.h +0 -0
@@ -83,7 +83,13 @@ typedef enum {
     HVMMEM_ram_rw,             /* Normal read/write guest RAM */
     HVMMEM_ram_ro,             /* Read-only; writes are discarded */
     HVMMEM_mmio_dm,            /* Reads and write go to the device

model

Quoted 8 lines
Quoted 8 lines

*/

xen/include/public/hvm/hvm_op.h typedef enum { · line 86

Quoted 1 line
xen/include/public/hvm/hvm_op.h +0 -1
-    HVMMEM_mmio_write_dm       /* Read-only; writes go to the device

model */

xen/include/public/hvm/hvm_op.h typedef enum { · line 87

Quoted 2 lines
xen/include/public/hvm/hvm_op.h +2 -0
+#if __XEN_INTERFACE_VERSION__ < 0x00040700
+    HVMMEM_mmio_write_dm,      /* Read-only; writes go to the device

model */

Quoted 2 lines
xen/include/public/hvm/hvm_op.h +2 -0
+#else
+    HVMMEM_unused,             /* Placeholder; setting memory to this

type

Quoted 12 lines
Quoted 12 lines

xen/include/public/hvm/hvm_op.h typedef enum { · line 92

Quoted 3 lines
xen/include/public/hvm/hvm_op.h +3 -0
+                                  will fail for code after 4.7.0 */
+#endif
+    HVMMEM_ioreq_server

Also, I don't think we've had a convincing argument for why this patch needs to be in 4.7. The p2m name changes are internal only, and so don't need to be made at all; and the old functionality will work as well as it ever did. Furthermore, the whole reason we're in this situation is that we checked in a publicly-visible change to the interface before it was properly ready; I think we should avoid making the same mistake this time.

Quoted 9 lines
Quoted 4 lines
Quoted 4 lines

So personally I'd just leave this patch entirely for 4.8; but if Paul and/or Jan have strong opinions, then I would say check in only a patch to do the #if/#else/#endif, and leave both the p2m type changes and the new HVMMEM_ioreq_server enum for when the 4.8

development

Quoted 4 lines
Quoted 2 lines

window opens.

If the whole series is going in then I think this patch is ok. If this the

only

Quoted 22 lines

patch that is going in for 4.7 then I thing we need the patch to hvm_op.h to deprecate the old type and that's it. We definitely should not introduce an implementation of the type HVMMEM_ioreq_server that has the same hardcoded semantics as the old type and then change it.

Quoted 1 line

The p2m type changes are also wrong. That type needs to be left alone,

presumably, so that anything using HVMMEM_mmio_write_dm and compiled to the old interface version continues to function. I think HVMMEM_ioreq_server needs to map to a new p2m type which should be introduced in patch #3.

Quoted 1 line

Sorry, I'm also confused now. :(

Do we really want to introduce a new p2m type? Why? My understanding of the previous agreement is that:
1> We need the interface to work on old hypervisor for HVMMEM_mmio_write_dm;
2> We need the interface to return -EINVAL for new hypervisor for HVMMEM_mmio_write_dm;
3> We need the new type HVMMEM_ioreq_server to work on new hypervisor;

Quoted 2 lines

Did I miss something? Or I totally misunderstood?

I don't know. I'm confused too. What we definitely don't want to do is add a new HVMMEM type and have it map to the old behaviour, otherwise we're no better off.

The question I'm not clear on the answer to is what happens to old code:

Quoted 9 lines
Quoted 1 line

Should it continue to compile? If so, should it continue to run.

We only need to be concerned about the "get type" functionality, as that's the only thing an arbitrary guest can use. If the hypercall simply never returns the old type, then old code will still work (it'll just have some dead code on new Xen), and hence it compiling against the older interface is fine (and, from general considerations, a requirement).

Thanks Jan. And I think the answer is yes. The new hypervisor will only return HVMMEM_ioreq_server, which is a different value now.

Quoted 2 lines

Jan

Yu

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#15 lore raw

Re: [PATCH v3 1/3] x86/ioreq server(patch for 4.7): Rename p2m_mmio_write_dm to p2m_ioreq_server.

Quoted 320 lines · Zhang
Quoted 307 lines · Jan Beulich
Quoted 307 lines
Quoted 262 lines
Quoted 1 line · On 25.04.16 at 17:29, <[email protected]> wrote:

-----Original Message-----
From: Yu, Zhang [mailto:[email protected]]
Sent: 25 April 2016 16:22
To: Paul Durrant; George Dunlap
Cc: [email protected]; Kevin Tian; Keir (Xen.org); Jun Nakajima; Andrew Cooper; Tim (Xen.org); Lv, Zhiyuan; Jan Beulich; Wei Liu
Subject: Re: [Xen-devel] [PATCH v3 1/3] x86/ioreq server(patch for 4.7):
Rename p2m_mmio_write_dm to p2m_ioreq_server.

Quoted 9 lines · Paul Durrant
Quoted 9 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of George Dunlap
Sent: 25 April 2016 14:39
To: Yu Zhang
Cc: [email protected]; Kevin Tian; Keir (Xen.org); Jun Nakajima;
Andrew Cooper; Tim (Xen.org); Paul Durrant; Lv, Zhiyuan; Jan Beulich; Wei

Liu

Quoted 5 lines
Quoted 5 lines

Subject: Re: [Xen-devel] [PATCH v3 1/3] x86/ioreq server(patch for 4.7):
Rename p2m_mmio_write_dm to p2m_ioreq_server.

On Mon, Apr 25, 2016 at 11:35 AM, Yu Zhang

<[email protected]>

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines · wrote:

Previously p2m type p2m_mmio_write_dm was introduced for write- protected memory pages whose write operations are supposed to be forwarded to and emulated by an ioreq server. Yet limitations of rangeset restrict the number of guest pages to be write-protected.

This patch replaces the p2m type p2m_mmio_write_dm with a new

name:

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

p2m_ioreq_server, which means this p2m type can be claimed by one ioreq server, instead of being tracked inside the rangeset of ioreq server. Patches following up will add the related hvmop handling code which map/unmap type p2m_ioreq_server to/from an ioreq

server.

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines

changes in v3:
- According to Jan & George's comments, keep

HVMMEM_mmio_write_dm

Quoted 4 lines

for old xen interface versions, and replace it with
HVMMEM_unused
for xen interfaces newer than 4.7.0; For p2m_ioreq_server, a new enum - HVMMEM_ioreq_server is introduced for the get/set mem

type

Quoted 41 lines
Quoted 41 lines
Quoted 2 lines
    interfaces;

- Add George's Reviewed-by and Acked-by from Tim & Andrew.

Unfortunately these rather contradict each other -- I consider Reviewed-by to only stick if the code I've specified hasn't changed (or has only changed trivially).

Also...

xen/arch/x86/hvm/hvm.c int hvm_hap_nested_page_fault(paddr_t gpa,

Quoted 31 lines

changes in v2:
- According to George Dunlap's comments, only rename the p2m type, with no behavior changes.

---
 xen/arch/x86/hvm/hvm.c          | 14 ++++++++------
 xen/arch/x86/mm/p2m-ept.c       |  2 +-
 xen/arch/x86/mm/p2m-pt.c        |  2 +-
 xen/arch/x86/mm/shadow/multi.c  |  2 +-
 xen/include/asm-x86/p2m.h       |  4 ++--
 xen/include/public/hvm/hvm_op.h |  8 +++++++-
 6 files changed, 20 insertions(+), 12 deletions(-)
xen/arch/x86/hvm/hvm.c +0 -0
index f24126d..874cb0f 100644
@@ -1857,7 +1857,7 @@ int hvm_hap_nested_page_fault(paddr_t gpa,

unsigned long gla,

Quoted 4 lines
Quoted 4 lines

xen/arch/x86/hvm/hvm.c int hvm_hap_nested_page_fault(paddr_t gpa, · line 1860

Quoted 4 lines
xen/arch/x86/hvm/hvm.c +0 -1
      */
     if ( (p2mt == p2m_mmio_dm) ||
          (npfec.write_access &&
-          (p2m_is_discard_write(p2mt) || (p2mt ==

p2m_mmio_write_dm))) )

Quoted 47 lines
Quoted 47 lines

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,

Quoted 6 lines
xen/arch/x86/hvm/hvm.c +1 -0
+          (p2m_is_discard_write(p2mt) || (p2mt ==
 p2m_ioreq_server))) )
     {
         __put_gfn(p2m, gfn);

if ( ap2m_active )

xen/arch/x86/hvm/hvm.c +0 -0
@@ -5499,8 +5499,8 @@ long do_hvm_op(unsigned long op,

XEN_GUEST_HANDLE_PARAM(void) arg)

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,

Quoted 11 lines
xen/arch/x86/hvm/hvm.c +2 -2
             get_gfn_query_unlocked(d, a.pfn, &t);
             if ( p2m_is_mmio(t) )
                 a.mem_type =  HVMMEM_mmio_dm;
-            else if ( t == p2m_mmio_write_dm )
-                a.mem_type = HVMMEM_mmio_write_dm;
+            else if ( t == p2m_ioreq_server )
+                a.mem_type = HVMMEM_ioreq_server;
             else if ( p2m_is_readonly(t) )
                 a.mem_type =  HVMMEM_ram_ro;
             else if ( p2m_is_ram(t) )
@@ -5531,7 +5531,8 @@ long do_hvm_op(unsigned long op,

XEN_GUEST_HANDLE_PARAM(void) arg)

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,

Quoted 10 lines
xen/arch/x86/hvm/hvm.c +2 -1
             [HVMMEM_ram_rw]  = p2m_ram_rw,
             [HVMMEM_ram_ro]  = p2m_ram_ro,
             [HVMMEM_mmio_dm] = p2m_mmio_dm,
-            [HVMMEM_mmio_write_dm] = p2m_mmio_write_dm
+            [HVMMEM_unused] = p2m_invalid,
+            [HVMMEM_ioreq_server] = p2m_ioreq_server
         };
 
         if ( copy_from_guest(&a, arg, 1) )
@@ -5555,7 +5556,8 @@ long do_hvm_op(unsigned long op,

XEN_GUEST_HANDLE_PARAM(void) arg)

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,

Quoted 11 lines
xen/arch/x86/hvm/hvm.c +2 -1
              ((a.first_pfn + a.nr - 1) >
 domain_get_maximum_gpfn(d)) )
             goto setmemtype_fail;
 
-        if ( a.hvmmem_type >= ARRAY_SIZE(memtype) )
+        if ( a.hvmmem_type >= ARRAY_SIZE(memtype) ||
+             unlikely(a.hvmmem_type == HVMMEM_unused) )
             goto setmemtype_fail;
 

while ( a.nr > start_iter )

xen/arch/x86/hvm/hvm.c +0 -0
@@ -5579,7 +5581,7 @@ long do_hvm_op(unsigned long op,

XEN_GUEST_HANDLE_PARAM(void) arg)

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op, · line 5584

Quoted 4 lines
xen/arch/x86/hvm/hvm.c +0 -0
             }
             if ( !p2m_is_ram(t) &&
                  (!p2m_is_hole(t) || a.hvmmem_type !=
 HVMMEM_mmio_dm)

&&

Quoted 8 lines
Quoted 8 lines

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op, · line 5583

Quoted 1 line
xen/arch/x86/hvm/hvm.c +0 -1
-                 (t != p2m_mmio_write_dm || a.hvmmem_type !=

HVMMEM_ram_rw) )

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op, · line 5585

Quoted 1 line
xen/arch/x86/hvm/hvm.c +1 -0
+                 (t != p2m_ioreq_server || a.hvmmem_type !=

HVMMEM_ram_rw) )

xen/arch/x86/mm/p2m-

Quoted 4 lines
xen/arch/x86/hvm/hvm.c +0 -0
             {
                 put_gfn(d, pfn);
                 goto setmemtype_fail;
xen/arch/x86/mm/p2m- renamed from xen/arch/x86/mm/p2m-ept.c +0 -0

ept.c

Quoted 5 lines
Quoted 5 lines

xen/arch/x86/mm/p2m-ept.c static void ept_p2m_type_to_flags(struct

Quoted 4 lines

index 3cb6868..380ec25 100644

xen/arch/x86/mm/p2m-ept.c +0 -0
@@ -171,7 +171,7 @@ static void ept_p2m_type_to_flags(struct

p2m_domain *p2m, ept_entry_t *entry,

Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
xen/arch/x86/mm/p2m-ept.c +1 -1
             entry->a = entry->d = !!cpu_has_vmx_ept_ad;
             break;
         case p2m_grant_map_ro:
-        case p2m_mmio_write_dm:
+        case p2m_ioreq_server:
Quoted 8 lines

xen/arch/x86/mm/p2m-pt.c static unsigned long

Quoted 8 lines
xen/arch/x86/mm/p2m-ept.c +0 -0
             entry->r = 1;
             entry->w = entry->x = 0;
             entry->a = !!cpu_has_vmx_ept_ad;
xen/arch/x86/mm/p2m-pt.c +0 -0
index 3d80612..eabd2e3 100644
@@ -94,7 +94,7 @@ static unsigned long

p2m_type_to_flags(p2m_type_t

Quoted 16 lines
Quoted 16 lines

t, mfn_t mfn,

Review

Quoted 9 lines
xen/arch/x86/mm/p2m-pt.c +1 -1
     default:
         return flags | _PAGE_NX_BIT;
     case p2m_grant_map_ro:
-    case p2m_mmio_write_dm:
+    case p2m_ioreq_server:
         return flags | P2M_BASE_FLAGS | _PAGE_NX_BIT;
     case p2m_ram_ro:
     case p2m_ram_logdirty:
(quoted diff) +0 -0

b/xen/arch/x86/mm/shadow/multi.c

Quoted 5 lines

index e5c8499..c81302a 100644

xen/arch/x86/mm/shadow/multi.c +0 -0
@@ -3225,7 +3225,7 @@ static int sh_page_fault(struct vcpu *v,
 
Quoted 15 lines
Quoted 7 lines
Quoted 7 lines
xen/arch/x86/mm/shadow/multi.c +1 -1
     /* Need to hand off device-model MMIO to the device model */
     if ( p2mt == p2m_mmio_dm
-         || (p2mt == p2m_mmio_write_dm && ft == ft_demand_write) )
+         || (p2mt == p2m_ioreq_server && ft == ft_demand_write) )
     {
         gpa = guest_walk_to_gpa(&gw);
         goto mmio;
Quoted 8 lines
Quoted 8 lines
xen/include/asm-x86/p2m.h +0 -0
index 5392eb0..ee2ea9c 100644
@@ -71,7 +71,7 @@ typedef enum {
     p2m_ram_shared = 12,          /* Shared or sharable memory */
     p2m_ram_broken = 13,          /* Broken page, access cause

domain

crash

Quoted 22 lines
Quoted 22 lines

*/

Quoted 4 lines

p2m_map_foreign = 14, /* ram pages from foreign
domain */
- p2m_mmio_write_dm = 15, /* Read-only; writes go to the
device

model */

Quoted 14 lines
xen/include/asm-x86/p2m.h +2 -1
+    p2m_ioreq_server = 15,
 } p2m_type_t;
 
 /* Modifiers to the query */
@@ -112,7 +112,7 @@ typedef unsigned int p2m_query_t;
                       | p2m_to_mask(p2m_ram_ro)         \
                       | p2m_to_mask(p2m_grant_map_ro)   \
                       | p2m_to_mask(p2m_ram_shared)     \
-                      | p2m_to_mask(p2m_mmio_write_dm))
+                      | p2m_to_mask(p2m_ioreq_server))
 
 /* Write-discard types, which should discard the write

operations */
#define P2M_DISCARD_WRITE_TYPES (p2m_to_mask(p2m_ram_ro) \

Review

Quoted 1 line
(quoted diff) +0 -0

b/xen/include/public/hvm/hvm_op.h

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

index 1606185..b3e45cf 100644

xen/include/public/hvm/hvm_op.h +0 -0
@@ -83,7 +83,13 @@ typedef enum {
     HVMMEM_ram_rw,             /* Normal read/write guest RAM */
     HVMMEM_ram_ro,             /* Read-only; writes are

discarded */
HVMMEM_mmio_dm, /* Reads and write go to the device

model

Quoted 11 lines
Quoted 11 lines

*/

Quoted 2 lines

- HVMMEM_mmio_write_dm /* Read-only; writes go to the
device

model */

Quoted 3 lines
xen/include/public/hvm/hvm_op.h +2 -0
+#if __XEN_INTERFACE_VERSION__ < 0x00040700
+    HVMMEM_mmio_write_dm,      /* Read-only; writes go to the

device

model */

Quoted 3 lines
xen/include/public/hvm/hvm_op.h +2 -0
+#else
+    HVMMEM_unused,             /* Placeholder; setting memory to

this

type

Quoted 14 lines
Quoted 14 lines

xen/include/public/hvm/hvm_op.h

Quoted 3 lines
xen/include/public/hvm/hvm_op.h +3 -0
+                                  will fail for code after 4.7.0 */
+#endif
+    HVMMEM_ioreq_server

Also, I don't think we've had a convincing argument for why this patch
needs to be in 4.7. The p2m name changes are internal only, and so don't need to be made at all; and the old functionality will work as well as it ever did. Furthermore, the whole reason we're in this situation is that we checked in a publicly-visible change to the interface before it was properly ready; I think we should avoid making
the same mistake this time.

Quoted 10 lines
Quoted 4 lines
Quoted 4 lines

So personally I'd just leave this patch entirely for 4.8; but if Paul and/or Jan have strong opinions, then I would say check in only a patch to do the #if/#else/#endif, and leave both the p2m type changes and the new HVMMEM_ioreq_server enum for when the 4.8

development

Quoted 5 lines
Quoted 2 lines

window opens.

If the whole series is going in then I think this patch is ok. If this the

only

Quoted 24 lines

patch that is going in for 4.7 then I thing we need the patch to hvm_op.h to
deprecate the old type and that's it. We definitely should not introduce an
implementation of the type HVMMEM_ioreq_server that has the same hardcoded semantics as the old type and then change it.

Quoted 1 line

The p2m type changes are also wrong. That type needs to be left alone,

presumably, so that anything using HVMMEM_mmio_write_dm and compiled to the old interface version continues to function. I think HVMMEM_ioreq_server needs to map to a new p2m type which should be introduced in patch #3.

Quoted 1 line

Sorry, I'm also confused now. :(

Do we really want to introduce a new p2m type? Why? My understanding of the previous agreement is that:
1> We need the interface to work on old hypervisor for HVMMEM_mmio_write_dm;
2> We need the interface to return -EINVAL for new hypervisor for HVMMEM_mmio_write_dm;
3> We need the new type HVMMEM_ioreq_server to work on new hypervisor;

Quoted 2 lines

Did I miss something? Or I totally misunderstood?

I don't know. I'm confused too. What we definitely don't want to do is add a
new HVMMEM type and have it map to the old behaviour, otherwise we're no better off.

The question I'm not clear on the answer to is what happens to old code:

Quoted 9 lines
Quoted 1 line

Should it continue to compile? If so, should it continue to run.

We only need to be concerned about the "get type" functionality, as that's the only thing an arbitrary guest can use. If the hypercall simply never returns the old type, then old code will still work (it'll just have some dead code on new Xen), and hence it compiling against the older interface is fine (and, from general considerations, a requirement).

Quoted 2 lines

Thanks Jan. And I think the answer is yes. The new hypervisor will only return HVMMEM_ioreq_server, which is a different value now.

Right -- but we can't check in this entire series for 4.7; however, Paul would like to make it clear that HVMMEM_mmio_write_dm is deprecated; so we need a patch which does the #ifdef/#else/#endif clause, and then everything else necessary to make sure that things compile properly either way, but no p2m changes or additional functionality.

-George

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

author
#16 lore raw

Re: [PATCH v3 1/3] x86/ioreq server(patch for 4.7): Rename p2m_mmio_write_dm to p2m_ioreq_server.

Quoted 321 lines · George Dunlap
Quoted 320 lines · Zhang
Quoted 316 lines · Jan Beulich
Quoted 300 lines
Quoted 262 lines
Quoted 1 line · On 25.04.16 at 17:29, <[email protected]> wrote:

-----Original Message-----
From: Yu, Zhang [mailto:[email protected]]
Sent: 25 April 2016 16:22
To: Paul Durrant; George Dunlap
Cc: [email protected]; Kevin Tian; Keir (Xen.org); Jun Nakajima; Andrew Cooper; Tim (Xen.org); Lv, Zhiyuan; Jan Beulich; Wei Liu
Subject: Re: [Xen-devel] [PATCH v3 1/3] x86/ioreq server(patch for 4.7):
Rename p2m_mmio_write_dm to p2m_ioreq_server.

Quoted 9 lines · Paul Durrant
Quoted 9 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of George Dunlap
Sent: 25 April 2016 14:39
To: Yu Zhang
Cc: [email protected]; Kevin Tian; Keir (Xen.org); Jun Nakajima;
Andrew Cooper; Tim (Xen.org); Paul Durrant; Lv, Zhiyuan; Jan Beulich; Wei

Liu

Quoted 5 lines
Quoted 5 lines

Subject: Re: [Xen-devel] [PATCH v3 1/3] x86/ioreq server(patch for 4.7):
Rename p2m_mmio_write_dm to p2m_ioreq_server.

On Mon, Apr 25, 2016 at 11:35 AM, Yu Zhang

<[email protected]>

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines · wrote:

Previously p2m type p2m_mmio_write_dm was introduced for write- protected memory pages whose write operations are supposed to be forwarded to and emulated by an ioreq server. Yet limitations of rangeset restrict the number of guest pages to be write-protected.

This patch replaces the p2m type p2m_mmio_write_dm with a new

name:

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

p2m_ioreq_server, which means this p2m type can be claimed by one ioreq server, instead of being tracked inside the rangeset of ioreq server. Patches following up will add the related hvmop handling code which map/unmap type p2m_ioreq_server to/from an ioreq

server.

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines

changes in v3:
- According to Jan & George's comments, keep

HVMMEM_mmio_write_dm

Quoted 4 lines

for old xen interface versions, and replace it with
HVMMEM_unused
for xen interfaces newer than 4.7.0; For p2m_ioreq_server, a new enum - HVMMEM_ioreq_server is introduced for the get/set mem

type

Quoted 41 lines
Quoted 41 lines
Quoted 2 lines
    interfaces;

- Add George's Reviewed-by and Acked-by from Tim & Andrew.

Unfortunately these rather contradict each other -- I consider Reviewed-by to only stick if the code I've specified hasn't changed (or has only changed trivially).

Also...

xen/arch/x86/hvm/hvm.c int hvm_hap_nested_page_fault(paddr_t gpa,

Quoted 31 lines

changes in v2:
- According to George Dunlap's comments, only rename the p2m type, with no behavior changes.

---
 xen/arch/x86/hvm/hvm.c          | 14 ++++++++------
 xen/arch/x86/mm/p2m-ept.c       |  2 +-
 xen/arch/x86/mm/p2m-pt.c        |  2 +-
 xen/arch/x86/mm/shadow/multi.c  |  2 +-
 xen/include/asm-x86/p2m.h       |  4 ++--
 xen/include/public/hvm/hvm_op.h |  8 +++++++-
 6 files changed, 20 insertions(+), 12 deletions(-)
xen/arch/x86/hvm/hvm.c +0 -0
index f24126d..874cb0f 100644
@@ -1857,7 +1857,7 @@ int hvm_hap_nested_page_fault(paddr_t gpa,

unsigned long gla,

Quoted 4 lines
Quoted 4 lines

xen/arch/x86/hvm/hvm.c int hvm_hap_nested_page_fault(paddr_t gpa, · line 1860

Quoted 4 lines
xen/arch/x86/hvm/hvm.c +0 -1
      */
     if ( (p2mt == p2m_mmio_dm) ||
          (npfec.write_access &&
-          (p2m_is_discard_write(p2mt) || (p2mt ==

p2m_mmio_write_dm))) )

Quoted 47 lines
Quoted 47 lines

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,

Quoted 6 lines
xen/arch/x86/hvm/hvm.c +1 -0
+          (p2m_is_discard_write(p2mt) || (p2mt ==
 p2m_ioreq_server))) )
     {
         __put_gfn(p2m, gfn);

if ( ap2m_active )

xen/arch/x86/hvm/hvm.c +0 -0
@@ -5499,8 +5499,8 @@ long do_hvm_op(unsigned long op,

XEN_GUEST_HANDLE_PARAM(void) arg)

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,

Quoted 11 lines
xen/arch/x86/hvm/hvm.c +2 -2
             get_gfn_query_unlocked(d, a.pfn, &t);
             if ( p2m_is_mmio(t) )
                 a.mem_type =  HVMMEM_mmio_dm;
-            else if ( t == p2m_mmio_write_dm )
-                a.mem_type = HVMMEM_mmio_write_dm;
+            else if ( t == p2m_ioreq_server )
+                a.mem_type = HVMMEM_ioreq_server;
             else if ( p2m_is_readonly(t) )
                 a.mem_type =  HVMMEM_ram_ro;
             else if ( p2m_is_ram(t) )
@@ -5531,7 +5531,8 @@ long do_hvm_op(unsigned long op,

XEN_GUEST_HANDLE_PARAM(void) arg)

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,

Quoted 10 lines
xen/arch/x86/hvm/hvm.c +2 -1
             [HVMMEM_ram_rw]  = p2m_ram_rw,
             [HVMMEM_ram_ro]  = p2m_ram_ro,
             [HVMMEM_mmio_dm] = p2m_mmio_dm,
-            [HVMMEM_mmio_write_dm] = p2m_mmio_write_dm
+            [HVMMEM_unused] = p2m_invalid,
+            [HVMMEM_ioreq_server] = p2m_ioreq_server
         };
 
         if ( copy_from_guest(&a, arg, 1) )
@@ -5555,7 +5556,8 @@ long do_hvm_op(unsigned long op,

XEN_GUEST_HANDLE_PARAM(void) arg)

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,

Quoted 11 lines
xen/arch/x86/hvm/hvm.c +2 -1
              ((a.first_pfn + a.nr - 1) >
 domain_get_maximum_gpfn(d)) )
             goto setmemtype_fail;
 
-        if ( a.hvmmem_type >= ARRAY_SIZE(memtype) )
+        if ( a.hvmmem_type >= ARRAY_SIZE(memtype) ||
+             unlikely(a.hvmmem_type == HVMMEM_unused) )
             goto setmemtype_fail;
 

while ( a.nr > start_iter )

xen/arch/x86/hvm/hvm.c +0 -0
@@ -5579,7 +5581,7 @@ long do_hvm_op(unsigned long op,

XEN_GUEST_HANDLE_PARAM(void) arg)

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op, · line 5584

Quoted 4 lines
xen/arch/x86/hvm/hvm.c +0 -0
             }
             if ( !p2m_is_ram(t) &&
                  (!p2m_is_hole(t) || a.hvmmem_type !=
 HVMMEM_mmio_dm)

&&

Quoted 8 lines
Quoted 8 lines

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op, · line 5583

Quoted 1 line
xen/arch/x86/hvm/hvm.c +0 -1
-                 (t != p2m_mmio_write_dm || a.hvmmem_type !=

HVMMEM_ram_rw) )

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op, · line 5585

Quoted 1 line
xen/arch/x86/hvm/hvm.c +1 -0
+                 (t != p2m_ioreq_server || a.hvmmem_type !=

HVMMEM_ram_rw) )

xen/arch/x86/mm/p2m-

Quoted 4 lines
xen/arch/x86/hvm/hvm.c +0 -0
             {
                 put_gfn(d, pfn);
                 goto setmemtype_fail;
xen/arch/x86/mm/p2m- renamed from xen/arch/x86/mm/p2m-ept.c +0 -0

ept.c

Quoted 5 lines
Quoted 5 lines

xen/arch/x86/mm/p2m-ept.c static void ept_p2m_type_to_flags(struct

Quoted 4 lines

index 3cb6868..380ec25 100644

xen/arch/x86/mm/p2m-ept.c +0 -0
@@ -171,7 +171,7 @@ static void ept_p2m_type_to_flags(struct

p2m_domain *p2m, ept_entry_t *entry,

Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
xen/arch/x86/mm/p2m-ept.c +1 -1
             entry->a = entry->d = !!cpu_has_vmx_ept_ad;
             break;
         case p2m_grant_map_ro:
-        case p2m_mmio_write_dm:
+        case p2m_ioreq_server:
Quoted 8 lines

xen/arch/x86/mm/p2m-pt.c static unsigned long

Quoted 8 lines
xen/arch/x86/mm/p2m-ept.c +0 -0
             entry->r = 1;
             entry->w = entry->x = 0;
             entry->a = !!cpu_has_vmx_ept_ad;
xen/arch/x86/mm/p2m-pt.c +0 -0
index 3d80612..eabd2e3 100644
@@ -94,7 +94,7 @@ static unsigned long

p2m_type_to_flags(p2m_type_t

Quoted 16 lines
Quoted 16 lines

t, mfn_t mfn,

Review

Quoted 9 lines
xen/arch/x86/mm/p2m-pt.c +1 -1
     default:
         return flags | _PAGE_NX_BIT;
     case p2m_grant_map_ro:
-    case p2m_mmio_write_dm:
+    case p2m_ioreq_server:
         return flags | P2M_BASE_FLAGS | _PAGE_NX_BIT;
     case p2m_ram_ro:
     case p2m_ram_logdirty:
(quoted diff) +0 -0

b/xen/arch/x86/mm/shadow/multi.c

Quoted 5 lines

index e5c8499..c81302a 100644

xen/arch/x86/mm/shadow/multi.c +0 -0
@@ -3225,7 +3225,7 @@ static int sh_page_fault(struct vcpu *v,
 
Quoted 15 lines
Quoted 7 lines
Quoted 7 lines
xen/arch/x86/mm/shadow/multi.c +1 -1
     /* Need to hand off device-model MMIO to the device model */
     if ( p2mt == p2m_mmio_dm
-         || (p2mt == p2m_mmio_write_dm && ft == ft_demand_write) )
+         || (p2mt == p2m_ioreq_server && ft == ft_demand_write) )
     {
         gpa = guest_walk_to_gpa(&gw);
         goto mmio;
Quoted 8 lines
Quoted 8 lines
xen/include/asm-x86/p2m.h +0 -0
index 5392eb0..ee2ea9c 100644
@@ -71,7 +71,7 @@ typedef enum {
     p2m_ram_shared = 12,          /* Shared or sharable memory */
     p2m_ram_broken = 13,          /* Broken page, access cause

domain

crash

Quoted 22 lines
Quoted 22 lines

*/

Quoted 4 lines

p2m_map_foreign = 14, /* ram pages from foreign
domain */
- p2m_mmio_write_dm = 15, /* Read-only; writes go to the
device

model */

Quoted 14 lines
xen/include/asm-x86/p2m.h +2 -1
+    p2m_ioreq_server = 15,
 } p2m_type_t;
 
 /* Modifiers to the query */
@@ -112,7 +112,7 @@ typedef unsigned int p2m_query_t;
                       | p2m_to_mask(p2m_ram_ro)         \
                       | p2m_to_mask(p2m_grant_map_ro)   \
                       | p2m_to_mask(p2m_ram_shared)     \
-                      | p2m_to_mask(p2m_mmio_write_dm))
+                      | p2m_to_mask(p2m_ioreq_server))
 
 /* Write-discard types, which should discard the write

operations */
#define P2M_DISCARD_WRITE_TYPES (p2m_to_mask(p2m_ram_ro) \

Review

Quoted 1 line
(quoted diff) +0 -0

b/xen/include/public/hvm/hvm_op.h

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

index 1606185..b3e45cf 100644

xen/include/public/hvm/hvm_op.h +0 -0
@@ -83,7 +83,13 @@ typedef enum {
     HVMMEM_ram_rw,             /* Normal read/write guest RAM */
     HVMMEM_ram_ro,             /* Read-only; writes are

discarded */
HVMMEM_mmio_dm, /* Reads and write go to the device

model

Quoted 11 lines
Quoted 11 lines

*/

Quoted 2 lines

- HVMMEM_mmio_write_dm /* Read-only; writes go to the
device

model */

Quoted 3 lines
xen/include/public/hvm/hvm_op.h +2 -0
+#if __XEN_INTERFACE_VERSION__ < 0x00040700
+    HVMMEM_mmio_write_dm,      /* Read-only; writes go to the

device

model */

Quoted 3 lines
xen/include/public/hvm/hvm_op.h +2 -0
+#else
+    HVMMEM_unused,             /* Placeholder; setting memory to

this

type

Quoted 14 lines
Quoted 14 lines

xen/include/public/hvm/hvm_op.h

Quoted 3 lines
xen/include/public/hvm/hvm_op.h +3 -0
+                                  will fail for code after 4.7.0 */
+#endif
+    HVMMEM_ioreq_server

Also, I don't think we've had a convincing argument for why this patch
needs to be in 4.7. The p2m name changes are internal only, and so don't need to be made at all; and the old functionality will work as well as it ever did. Furthermore, the whole reason we're in this situation is that we checked in a publicly-visible change to the interface before it was properly ready; I think we should avoid making
the same mistake this time.

Quoted 10 lines
Quoted 4 lines
Quoted 4 lines

So personally I'd just leave this patch entirely for 4.8; but if Paul and/or Jan have strong opinions, then I would say check in only a patch to do the #if/#else/#endif, and leave both the p2m type changes and the new HVMMEM_ioreq_server enum for when the 4.8

development

Quoted 5 lines
Quoted 2 lines

window opens.

If the whole series is going in then I think this patch is ok. If this the

only

Quoted 24 lines

patch that is going in for 4.7 then I thing we need the patch to hvm_op.h to
deprecate the old type and that's it. We definitely should not introduce an
implementation of the type HVMMEM_ioreq_server that has the same hardcoded semantics as the old type and then change it.

Quoted 1 line

The p2m type changes are also wrong. That type needs to be left alone,

presumably, so that anything using HVMMEM_mmio_write_dm and compiled to the old interface version continues to function. I think HVMMEM_ioreq_server needs to map to a new p2m type which should be introduced in patch #3.

Quoted 1 line

Sorry, I'm also confused now. :(

Do we really want to introduce a new p2m type? Why? My understanding of the previous agreement is that:
1> We need the interface to work on old hypervisor for HVMMEM_mmio_write_dm;
2> We need the interface to return -EINVAL for new hypervisor for HVMMEM_mmio_write_dm;
3> We need the new type HVMMEM_ioreq_server to work on new hypervisor;

Quoted 2 lines

Did I miss something? Or I totally misunderstood?

Quoted 8 lines

I don't know. I'm confused too. What we definitely don't want to do is add a
new HVMMEM type and have it map to the old behaviour, otherwise we're no better off.

The question I'm not clear on the answer to is what happens to old code:

Should it continue to compile? If so, should it continue to run.

We only need to be concerned about the "get type" functionality, as that's the only thing an arbitrary guest can use. If the hypercall simply never returns the old type, then old code will still work (it'll just have some dead code on new Xen), and hence it compiling against the older interface is fine (and, from general considerations, a requirement).

Quoted 9 lines
Quoted 2 lines

Thanks Jan. And I think the answer is yes. The new hypervisor will only return HVMMEM_ioreq_server, which is a different value now.

Right -- but we can't check in this entire series for 4.7; however, Paul would like to make it clear that HVMMEM_mmio_write_dm is deprecated; so we need a patch which does the #ifdef/#else/#endif clause, and then everything else necessary to make sure that things compile properly either way, but no p2m changes or additional functionality.

Thanks, George.
So what is it good for, with only the #ifdef/#els/#endif clause? It seems more reasonable to me that we hold all 3 patches till next version, and at that time the __XEN_INTERFACE_VERSION__ should be compared against 0x000408000 in the #ifdef I guess?

Yu

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#17 lore raw

Re: [PATCH v3 1/3] x86/ioreq server(patch for 4.7): Rename p2m_mmio_write_dm to p2m_ioreq_server.

In reply to George Dunlap
Quoted 350 lines

-----Original Message-----
From: George Dunlap [mailto:[email protected]]
Sent: 25 April 2016 17:16
To: Yu, Zhang; Jan Beulich; Paul Durrant
Cc: Andrew Cooper; Wei Liu; Jun Nakajima; Kevin Tian; Zhiyuan Lv; xen- [email protected]; Keir (Xen.org); Tim (Xen.org)
Subject: Re: [Xen-devel] [PATCH v3 1/3] x86/ioreq server(patch for 4.7):
Rename p2m_mmio_write_dm to p2m_ioreq_server.

Quoted 16 lines · Zhang
Quoted 13 lines · Jan Beulich
Quoted 13 lines
Quoted 13 lines
Quoted 1 line · On 25.04.16 at 17:29, <[email protected]> wrote:

-----Original Message-----
From: Yu, Zhang [mailto:[email protected]]
Sent: 25 April 2016 16:22
To: Paul Durrant; George Dunlap
Cc: [email protected]; Kevin Tian; Keir (Xen.org); Jun Nakajima; Andrew Cooper; Tim (Xen.org); Lv, Zhiyuan; Jan Beulich; Wei Liu
Subject: Re: [Xen-devel] [PATCH v3 1/3] x86/ioreq server(patch for 4.7):
Rename p2m_mmio_write_dm to p2m_ioreq_server.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines · Paul Durrant
Quoted 2 lines
Quoted 2 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf

Of

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 7 lines

George Dunlap
Sent: 25 April 2016 14:39
To: Yu Zhang
Cc: [email protected]; Kevin Tian; Keir (Xen.org); Jun Nakajima;
Andrew Cooper; Tim (Xen.org); Paul Durrant; Lv, Zhiyuan; Jan Beulich; Wei

Liu

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines

Subject: Re: [Xen-devel] [PATCH v3 1/3] x86/ioreq server(patch for 4.7):
Rename p2m_mmio_write_dm to p2m_ioreq_server.

On Mon, Apr 25, 2016 at 11:35 AM, Yu Zhang

<[email protected]>

Quoted 2 lines
Quoted 2 lines
Quoted 1 line · wrote:

Previously p2m type p2m_mmio_write_dm was introduced for

write-

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

protected memory pages whose write operations are supposed to

be

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

forwarded to and emulated by an ioreq server. Yet limitations of rangeset restrict the number of guest pages to be write-protected.

This patch replaces the p2m type p2m_mmio_write_dm with a new

name:

Quoted 1 line
Quoted 1 line
Quoted 1 line

p2m_ioreq_server, which means this p2m type can be claimed by

one

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

ioreq server, instead of being tracked inside the rangeset of ioreq server. Patches following up will add the related hvmop handling code which map/unmap type p2m_ioreq_server to/from an ioreq

server.

Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

changes in v3:
- According to Jan & George's comments, keep

HVMMEM_mmio_write_dm

Quoted 3 lines

for old xen interface versions, and replace it with
HVMMEM_unused
for xen interfaces newer than 4.7.0; For p2m_ioreq_server, a

new

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

enum - HVMMEM_ioreq_server is introduced for the get/set

mem

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

type

Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
    interfaces;

- Add George's Reviewed-by and Acked-by from Tim & Andrew.

Unfortunately these rather contradict each other -- I consider Reviewed-by to only stick if the code I've specified hasn't changed (or has only changed trivially).

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

Also...

Quoted 3 lines

changes in v2:
- According to George Dunlap's comments, only rename the p2m

type,

Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines

with no behavior changes.

---
 xen/arch/x86/hvm/hvm.c          | 14 ++++++++------
 xen/arch/x86/mm/p2m-ept.c       |  2 +-
 xen/arch/x86/mm/p2m-pt.c        |  2 +-
 xen/arch/x86/mm/shadow/multi.c  |  2 +-
 xen/include/asm-x86/p2m.h       |  4 ++--
 xen/include/public/hvm/hvm_op.h |  8 +++++++-
 6 files changed, 20 insertions(+), 12 deletions(-)
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

xen/arch/x86/hvm/hvm.c int hvm_hap_nested_page_fault(paddr_t

Quoted 5 lines
xen/arch/x86/hvm/hvm.c +0 -0
index f24126d..874cb0f 100644
@@ -1857,7 +1857,7 @@ int hvm_hap_nested_page_fault(paddr_t

gpa,

Quoted 53 lines
Quoted 53 lines
Quoted 53 lines
Quoted 53 lines
Quoted 5 lines
Quoted 5 lines

unsigned long gla,

Quoted 4 lines
xen/arch/x86/hvm/hvm.c +0 -1
      */
     if ( (p2mt == p2m_mmio_dm) ||
          (npfec.write_access &&
-          (p2m_is_discard_write(p2mt) || (p2mt ==

p2m_mmio_write_dm))) )

Quoted 47 lines
Quoted 47 lines

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,

Quoted 6 lines
xen/arch/x86/hvm/hvm.c +1 -0
+          (p2m_is_discard_write(p2mt) || (p2mt ==
 p2m_ioreq_server))) )
     {
         __put_gfn(p2m, gfn);

if ( ap2m_active )

xen/arch/x86/hvm/hvm.c +0 -0
@@ -5499,8 +5499,8 @@ long do_hvm_op(unsigned long op,

XEN_GUEST_HANDLE_PARAM(void) arg)

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,

Quoted 11 lines
xen/arch/x86/hvm/hvm.c +2 -2
             get_gfn_query_unlocked(d, a.pfn, &t);
             if ( p2m_is_mmio(t) )
                 a.mem_type =  HVMMEM_mmio_dm;
-            else if ( t == p2m_mmio_write_dm )
-                a.mem_type = HVMMEM_mmio_write_dm;
+            else if ( t == p2m_ioreq_server )
+                a.mem_type = HVMMEM_ioreq_server;
             else if ( p2m_is_readonly(t) )
                 a.mem_type =  HVMMEM_ram_ro;
             else if ( p2m_is_ram(t) )
@@ -5531,7 +5531,8 @@ long do_hvm_op(unsigned long op,

XEN_GUEST_HANDLE_PARAM(void) arg)

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,

Quoted 10 lines
xen/arch/x86/hvm/hvm.c +2 -1
             [HVMMEM_ram_rw]  = p2m_ram_rw,
             [HVMMEM_ram_ro]  = p2m_ram_ro,
             [HVMMEM_mmio_dm] = p2m_mmio_dm,
-            [HVMMEM_mmio_write_dm] = p2m_mmio_write_dm
+            [HVMMEM_unused] = p2m_invalid,
+            [HVMMEM_ioreq_server] = p2m_ioreq_server
         };
 
         if ( copy_from_guest(&a, arg, 1) )
@@ -5555,7 +5556,8 @@ long do_hvm_op(unsigned long op,

XEN_GUEST_HANDLE_PARAM(void) arg)

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,

Quoted 11 lines
xen/arch/x86/hvm/hvm.c +2 -1
              ((a.first_pfn + a.nr - 1) >
 domain_get_maximum_gpfn(d)) )
             goto setmemtype_fail;
 
-        if ( a.hvmmem_type >= ARRAY_SIZE(memtype) )
+        if ( a.hvmmem_type >= ARRAY_SIZE(memtype) ||
+             unlikely(a.hvmmem_type == HVMMEM_unused) )
             goto setmemtype_fail;
 

while ( a.nr > start_iter )

xen/arch/x86/hvm/hvm.c +0 -0
@@ -5579,7 +5581,7 @@ long do_hvm_op(unsigned long op,

XEN_GUEST_HANDLE_PARAM(void) arg)

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op, · line 5584

Quoted 4 lines
xen/arch/x86/hvm/hvm.c +0 -0
             }
             if ( !p2m_is_ram(t) &&
                  (!p2m_is_hole(t) || a.hvmmem_type !=
 HVMMEM_mmio_dm)

&&

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op, · line 5583

Quoted 1 line
xen/arch/x86/hvm/hvm.c +0 -1
-                 (t != p2m_mmio_write_dm || a.hvmmem_type !=

HVMMEM_ram_rw) )

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op, · line 5585

Quoted 1 line
xen/arch/x86/hvm/hvm.c +1 -0
+                 (t != p2m_ioreq_server || a.hvmmem_type !=

HVMMEM_ram_rw) )

Review

Quoted 4 lines
xen/arch/x86/hvm/hvm.c +0 -0
             {
                 put_gfn(d, pfn);
                 goto setmemtype_fail;
(quoted diff) +0 -0

b/xen/arch/x86/mm/p2m-

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

ept.c

Quoted 5 lines
Quoted 5 lines

xen/arch/x86/mm/p2m-ept.c static void ept_p2m_type_to_flags(struct

Quoted 4 lines

index 3cb6868..380ec25 100644

xen/arch/x86/mm/p2m-ept.c +0 -0
@@ -171,7 +171,7 @@ static void ept_p2m_type_to_flags(struct

p2m_domain *p2m, ept_entry_t *entry,

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

xen/arch/x86/mm/p2m-

Quoted 9 lines
xen/arch/x86/mm/p2m-ept.c +1 -1
             entry->a = entry->d = !!cpu_has_vmx_ept_ad;
             break;
         case p2m_grant_map_ro:
-        case p2m_mmio_write_dm:
+        case p2m_ioreq_server:
             entry->r = 1;
             entry->w = entry->x = 0;
             entry->a = !!cpu_has_vmx_ept_ad;
xen/arch/x86/mm/p2m- renamed from xen/arch/x86/mm/p2m-pt.c +0 -0

pt.c

Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 4 lines
Quoted 4 lines

xen/arch/x86/mm/p2m-pt.c static unsigned long

Quoted 4 lines

index 3d80612..eabd2e3 100644

xen/arch/x86/mm/p2m-pt.c +0 -0
@@ -94,7 +94,7 @@ static unsigned long

p2m_type_to_flags(p2m_type_t

Quoted 11 lines
Quoted 11 lines

t, mfn_t mfn,

Review

Quoted 9 lines
xen/arch/x86/mm/p2m-pt.c +1 -1
     default:
         return flags | _PAGE_NX_BIT;
     case p2m_grant_map_ro:
-    case p2m_mmio_write_dm:
+    case p2m_ioreq_server:
         return flags | P2M_BASE_FLAGS | _PAGE_NX_BIT;
     case p2m_ram_ro:
     case p2m_ram_logdirty:
(quoted diff) +0 -0

b/xen/arch/x86/mm/shadow/multi.c

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

xen/arch/x86/mm/shadow/multi.c static int sh_page_fault(struct vcpu *v, · line 3228

Quoted 8 lines

index e5c8499..c81302a 100644

xen/arch/x86/mm/shadow/multi.c +0 -1
@@ -3225,7 +3225,7 @@ static int sh_page_fault(struct vcpu *v,
 
     /* Need to hand off device-model MMIO to the device model */
     if ( p2mt == p2m_mmio_dm
-         || (p2mt == p2m_mmio_write_dm && ft ==

ft_demand_write) )

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

xen/include/asm-

Quoted 5 lines
xen/arch/x86/mm/shadow/multi.c +1 -0
+         || (p2mt == p2m_ioreq_server && ft == ft_demand_write) )
     {
         gpa = guest_walk_to_gpa(&gw);
         goto mmio;
xen/include/asm- renamed from xen/include/asm-x86/p2m.h +0 -0

x86/p2m.h

Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

index 5392eb0..ee2ea9c 100644

xen/include/asm-x86/p2m.h +0 -0
@@ -71,7 +71,7 @@ typedef enum {
     p2m_ram_shared = 12,          /* Shared or sharable memory */
     p2m_ram_broken = 13,          /* Broken page, access cause

domain

crash

Quoted 17 lines
Quoted 17 lines

*/

Quoted 4 lines

p2m_map_foreign = 14, /* ram pages from foreign
domain */
- p2m_mmio_write_dm = 15, /* Read-only; writes go to the
device

model */

Quoted 11 lines
xen/include/asm-x86/p2m.h +2 -1
+    p2m_ioreq_server = 15,
 } p2m_type_t;
 
 /* Modifiers to the query */
@@ -112,7 +112,7 @@ typedef unsigned int p2m_query_t;
                       | p2m_to_mask(p2m_ram_ro)         \
                       | p2m_to_mask(p2m_grant_map_ro)   \
                       | p2m_to_mask(p2m_ram_shared)     \
-                      | p2m_to_mask(p2m_mmio_write_dm))
+                      | p2m_to_mask(p2m_ioreq_server))
 
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
xen/include/asm-x86/p2m.h +0 -0
 /* Write-discard types, which should discard the write

operations */
#define P2M_DISCARD_WRITE_TYPES

(p2m_to_mask(p2m_ram_ro) \

Quoted 37 lines
Quoted 37 lines
Quoted 37 lines
Quoted 37 lines
Quoted 10 lines
Quoted 10 lines

Review

Quoted 1 line
(quoted diff) +0 -0

b/xen/include/public/hvm/hvm_op.h

Quoted 8 lines

index 1606185..b3e45cf 100644

xen/include/public/hvm/hvm_op.h +0 -0
@@ -83,7 +83,13 @@ typedef enum {
     HVMMEM_ram_rw,             /* Normal read/write guest RAM */
     HVMMEM_ram_ro,             /* Read-only; writes are

discarded */
HVMMEM_mmio_dm, /* Reads and write go to the device

model

Quoted 11 lines
Quoted 11 lines

*/

Quoted 2 lines

- HVMMEM_mmio_write_dm /* Read-only; writes go to the
device

model */

Quoted 3 lines
xen/include/public/hvm/hvm_op.h +2 -0
+#if __XEN_INTERFACE_VERSION__ < 0x00040700
+    HVMMEM_mmio_write_dm,      /* Read-only; writes go to the

device

model */

Quoted 3 lines
xen/include/public/hvm/hvm_op.h +2 -0
+#else
+    HVMMEM_unused,             /* Placeholder; setting memory to

this

type

Quoted 14 lines
Quoted 14 lines

xen/include/public/hvm/hvm_op.h

Quoted 3 lines
xen/include/public/hvm/hvm_op.h +3 -0
+                                  will fail for code after 4.7.0 */
+#endif
+    HVMMEM_ioreq_server

Also, I don't think we've had a convincing argument for why this patch
needs to be in 4.7. The p2m name changes are internal only, and so don't need to be made at all; and the old functionality will work as well as it ever did. Furthermore, the whole reason we're in this situation is that we checked in a publicly-visible change to the interface before it was properly ready; I think we should avoid making
the same mistake this time.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

So personally I'd just leave this patch entirely for 4.8; but if Paul and/or Jan have strong opinions, then I would say check in only a patch to do the #if/#else/#endif, and leave both the p2m type

changes

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
Quoted 1 line

and the new HVMMEM_ioreq_server enum for when the 4.8

development

Quoted 5 lines
Quoted 2 lines

window opens.

If the whole series is going in then I think this patch is ok. If this the

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

only

Quoted 7 lines

patch that is going in for 4.7 then I thing we need the patch to hvm_op.h to
deprecate the old type and that's it. We definitely should not introduce an
implementation of the type HVMMEM_ioreq_server that has the same hardcoded semantics as the old type and then change it.

Quoted 1 line

The p2m type changes are also wrong. That type needs to be left

alone,

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

presumably, so that anything using HVMMEM_mmio_write_dm and compiled to the old interface version continues to function. I think HVMMEM_ioreq_server needs to map to a new p2m type which

should be

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines

introduced in patch #3.

Quoted 1 line

Sorry, I'm also confused now. :(

Do we really want to introduce a new p2m type? Why? My understanding of the previous agreement is that:
1> We need the interface to work on old hypervisor for HVMMEM_mmio_write_dm;
2> We need the interface to return -EINVAL for new hypervisor for HVMMEM_mmio_write_dm;
3> We need the new type HVMMEM_ioreq_server to work on new hypervisor;

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines

Did I miss something? Or I totally misunderstood?

I don't know. I'm confused too. What we definitely don't want to do is add a
new HVMMEM type and have it map to the old behaviour, otherwise

we're no

Quoted 14 lines
Quoted 4 lines
Quoted 4 lines

better off.

The question I'm not clear on the answer to is what happens to old code:

Quoted 9 lines
Quoted 1 line

Should it continue to compile? If so, should it continue to run.

We only need to be concerned about the "get type" functionality, as that's the only thing an arbitrary guest can use. If the hypercall simply never returns the old type, then old code will still work (it'll just have some dead code on new Xen), and hence it compiling against the older interface is fine (and, from general considerations, a requirement).

Quoted 2 lines

Thanks Jan. And I think the answer is yes. The new hypervisor will only return HVMMEM_ioreq_server, which is a different value now.

Quoted 7 lines

Right -- but we can't check in this entire series for 4.7; however, Paul would like to make it clear that HVMMEM_mmio_write_dm is deprecated; so
we need a patch which does the #ifdef/#else/#endif clause, and then everything else necessary to make sure that things compile properly either way, but no p2m changes or additional functionality.

For clarity, do you expect any existing use of HVMMEM_mmio_write_dm to continue to *function*? I agree that things should continue to build, but if they don't need to function then the now redundant p2m type should be removed IMO and any attempt to set a page to HVMMEM_mmio_write_dm (or the new HVMMEM_unused) name should result in -EINVAL. What is your position on this?

Paul

Quoted 1 line

-George

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

author
#18 lore raw

Re: [PATCH v3 1/3] x86/ioreq server(patch for 4.7): Rename p2m_mmio_write_dm to p2m_ioreq_server.

Quoted 358 lines · Paul Durrant
Quoted 350 lines

-----Original Message-----
From: George Dunlap [mailto:[email protected]]
Sent: 25 April 2016 17:16
To: Yu, Zhang; Jan Beulich; Paul Durrant
Cc: Andrew Cooper; Wei Liu; Jun Nakajima; Kevin Tian; Zhiyuan Lv; xen- [email protected]; Keir (Xen.org); Tim (Xen.org)
Subject: Re: [Xen-devel] [PATCH v3 1/3] x86/ioreq server(patch for 4.7):
Rename p2m_mmio_write_dm to p2m_ioreq_server.

Quoted 16 lines · Zhang
Quoted 13 lines · Jan Beulich
Quoted 13 lines
Quoted 13 lines
Quoted 1 line · On 25.04.16 at 17:29, <[email protected]> wrote:

-----Original Message-----
From: Yu, Zhang [mailto:[email protected]]
Sent: 25 April 2016 16:22
To: Paul Durrant; George Dunlap
Cc: [email protected]; Kevin Tian; Keir (Xen.org); Jun Nakajima; Andrew Cooper; Tim (Xen.org); Lv, Zhiyuan; Jan Beulich; Wei Liu
Subject: Re: [Xen-devel] [PATCH v3 1/3] x86/ioreq server(patch for 4.7):
Rename p2m_mmio_write_dm to p2m_ioreq_server.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines · Paul Durrant
Quoted 2 lines
Quoted 2 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf

Of

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 7 lines

George Dunlap
Sent: 25 April 2016 14:39
To: Yu Zhang
Cc: [email protected]; Kevin Tian; Keir (Xen.org); Jun Nakajima;
Andrew Cooper; Tim (Xen.org); Paul Durrant; Lv, Zhiyuan; Jan Beulich; Wei

Liu

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines

Subject: Re: [Xen-devel] [PATCH v3 1/3] x86/ioreq server(patch for 4.7):
Rename p2m_mmio_write_dm to p2m_ioreq_server.

On Mon, Apr 25, 2016 at 11:35 AM, Yu Zhang

<[email protected]>

Quoted 2 lines
Quoted 2 lines
Quoted 1 line · wrote:

Previously p2m type p2m_mmio_write_dm was introduced for

write-

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

protected memory pages whose write operations are supposed to

be

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

forwarded to and emulated by an ioreq server. Yet limitations of rangeset restrict the number of guest pages to be write-protected.

This patch replaces the p2m type p2m_mmio_write_dm with a new

name:

Quoted 1 line
Quoted 1 line
Quoted 1 line

p2m_ioreq_server, which means this p2m type can be claimed by

one

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

ioreq server, instead of being tracked inside the rangeset of ioreq server. Patches following up will add the related hvmop handling code which map/unmap type p2m_ioreq_server to/from an ioreq

server.

Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

changes in v3:
- According to Jan & George's comments, keep

HVMMEM_mmio_write_dm

Quoted 3 lines

for old xen interface versions, and replace it with
HVMMEM_unused
for xen interfaces newer than 4.7.0; For p2m_ioreq_server, a

new

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

enum - HVMMEM_ioreq_server is introduced for the get/set

mem

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

type

Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
    interfaces;

- Add George's Reviewed-by and Acked-by from Tim & Andrew.

Unfortunately these rather contradict each other -- I consider Reviewed-by to only stick if the code I've specified hasn't changed (or has only changed trivially).

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

Also...

Quoted 3 lines

changes in v2:
- According to George Dunlap's comments, only rename the p2m

type,

Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines

with no behavior changes.

---
 xen/arch/x86/hvm/hvm.c          | 14 ++++++++------
 xen/arch/x86/mm/p2m-ept.c       |  2 +-
 xen/arch/x86/mm/p2m-pt.c        |  2 +-
 xen/arch/x86/mm/shadow/multi.c  |  2 +-
 xen/include/asm-x86/p2m.h       |  4 ++--
 xen/include/public/hvm/hvm_op.h |  8 +++++++-
 6 files changed, 20 insertions(+), 12 deletions(-)
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

xen/arch/x86/hvm/hvm.c int hvm_hap_nested_page_fault(paddr_t

Quoted 5 lines
xen/arch/x86/hvm/hvm.c +0 -0
index f24126d..874cb0f 100644
@@ -1857,7 +1857,7 @@ int hvm_hap_nested_page_fault(paddr_t

gpa,

Quoted 53 lines
Quoted 53 lines
Quoted 53 lines
Quoted 53 lines
Quoted 5 lines
Quoted 5 lines

unsigned long gla,

Quoted 4 lines
xen/arch/x86/hvm/hvm.c +0 -1
      */
     if ( (p2mt == p2m_mmio_dm) ||
          (npfec.write_access &&
-          (p2m_is_discard_write(p2mt) || (p2mt ==

p2m_mmio_write_dm))) )

Quoted 47 lines
Quoted 47 lines

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,

Quoted 6 lines
xen/arch/x86/hvm/hvm.c +1 -0
+          (p2m_is_discard_write(p2mt) || (p2mt ==
 p2m_ioreq_server))) )
     {
         __put_gfn(p2m, gfn);

if ( ap2m_active )

xen/arch/x86/hvm/hvm.c +0 -0
@@ -5499,8 +5499,8 @@ long do_hvm_op(unsigned long op,

XEN_GUEST_HANDLE_PARAM(void) arg)

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,

Quoted 11 lines
xen/arch/x86/hvm/hvm.c +2 -2
             get_gfn_query_unlocked(d, a.pfn, &t);
             if ( p2m_is_mmio(t) )
                 a.mem_type =  HVMMEM_mmio_dm;
-            else if ( t == p2m_mmio_write_dm )
-                a.mem_type = HVMMEM_mmio_write_dm;
+            else if ( t == p2m_ioreq_server )
+                a.mem_type = HVMMEM_ioreq_server;
             else if ( p2m_is_readonly(t) )
                 a.mem_type =  HVMMEM_ram_ro;
             else if ( p2m_is_ram(t) )
@@ -5531,7 +5531,8 @@ long do_hvm_op(unsigned long op,

XEN_GUEST_HANDLE_PARAM(void) arg)

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,

Quoted 10 lines
xen/arch/x86/hvm/hvm.c +2 -1
             [HVMMEM_ram_rw]  = p2m_ram_rw,
             [HVMMEM_ram_ro]  = p2m_ram_ro,
             [HVMMEM_mmio_dm] = p2m_mmio_dm,
-            [HVMMEM_mmio_write_dm] = p2m_mmio_write_dm
+            [HVMMEM_unused] = p2m_invalid,
+            [HVMMEM_ioreq_server] = p2m_ioreq_server
         };
 
         if ( copy_from_guest(&a, arg, 1) )
@@ -5555,7 +5556,8 @@ long do_hvm_op(unsigned long op,

XEN_GUEST_HANDLE_PARAM(void) arg)

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,

Quoted 11 lines
xen/arch/x86/hvm/hvm.c +2 -1
              ((a.first_pfn + a.nr - 1) >
 domain_get_maximum_gpfn(d)) )
             goto setmemtype_fail;
 
-        if ( a.hvmmem_type >= ARRAY_SIZE(memtype) )
+        if ( a.hvmmem_type >= ARRAY_SIZE(memtype) ||
+             unlikely(a.hvmmem_type == HVMMEM_unused) )
             goto setmemtype_fail;
 

while ( a.nr > start_iter )

xen/arch/x86/hvm/hvm.c +0 -0
@@ -5579,7 +5581,7 @@ long do_hvm_op(unsigned long op,

XEN_GUEST_HANDLE_PARAM(void) arg)

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op, · line 5584

Quoted 4 lines
xen/arch/x86/hvm/hvm.c +0 -0
             }
             if ( !p2m_is_ram(t) &&
                  (!p2m_is_hole(t) || a.hvmmem_type !=
 HVMMEM_mmio_dm)

&&

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op, · line 5583

Quoted 1 line
xen/arch/x86/hvm/hvm.c +0 -1
-                 (t != p2m_mmio_write_dm || a.hvmmem_type !=

HVMMEM_ram_rw) )

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op, · line 5585

Quoted 1 line
xen/arch/x86/hvm/hvm.c +1 -0
+                 (t != p2m_ioreq_server || a.hvmmem_type !=

HVMMEM_ram_rw) )

Review

Quoted 4 lines
xen/arch/x86/hvm/hvm.c +0 -0
             {
                 put_gfn(d, pfn);
                 goto setmemtype_fail;
(quoted diff) +0 -0

b/xen/arch/x86/mm/p2m-

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

ept.c

Quoted 5 lines
Quoted 5 lines

xen/arch/x86/mm/p2m-ept.c static void ept_p2m_type_to_flags(struct

Quoted 4 lines

index 3cb6868..380ec25 100644

xen/arch/x86/mm/p2m-ept.c +0 -0
@@ -171,7 +171,7 @@ static void ept_p2m_type_to_flags(struct

p2m_domain *p2m, ept_entry_t *entry,

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

xen/arch/x86/mm/p2m-

Quoted 9 lines
xen/arch/x86/mm/p2m-ept.c +1 -1
             entry->a = entry->d = !!cpu_has_vmx_ept_ad;
             break;
         case p2m_grant_map_ro:
-        case p2m_mmio_write_dm:
+        case p2m_ioreq_server:
             entry->r = 1;
             entry->w = entry->x = 0;
             entry->a = !!cpu_has_vmx_ept_ad;
xen/arch/x86/mm/p2m- renamed from xen/arch/x86/mm/p2m-pt.c +0 -0

pt.c

Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 4 lines
Quoted 4 lines

xen/arch/x86/mm/p2m-pt.c static unsigned long

Quoted 4 lines

index 3d80612..eabd2e3 100644

xen/arch/x86/mm/p2m-pt.c +0 -0
@@ -94,7 +94,7 @@ static unsigned long

p2m_type_to_flags(p2m_type_t

Quoted 11 lines
Quoted 11 lines

t, mfn_t mfn,

Review

Quoted 9 lines
xen/arch/x86/mm/p2m-pt.c +1 -1
     default:
         return flags | _PAGE_NX_BIT;
     case p2m_grant_map_ro:
-    case p2m_mmio_write_dm:
+    case p2m_ioreq_server:
         return flags | P2M_BASE_FLAGS | _PAGE_NX_BIT;
     case p2m_ram_ro:
     case p2m_ram_logdirty:
(quoted diff) +0 -0

b/xen/arch/x86/mm/shadow/multi.c

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

xen/arch/x86/mm/shadow/multi.c static int sh_page_fault(struct vcpu *v, · line 3228

Quoted 8 lines

index e5c8499..c81302a 100644

xen/arch/x86/mm/shadow/multi.c +0 -1
@@ -3225,7 +3225,7 @@ static int sh_page_fault(struct vcpu *v,
 
     /* Need to hand off device-model MMIO to the device model */
     if ( p2mt == p2m_mmio_dm
-         || (p2mt == p2m_mmio_write_dm && ft ==

ft_demand_write) )

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

xen/include/asm-

Quoted 5 lines
xen/arch/x86/mm/shadow/multi.c +1 -0
+         || (p2mt == p2m_ioreq_server && ft == ft_demand_write) )
     {
         gpa = guest_walk_to_gpa(&gw);
         goto mmio;
xen/include/asm- renamed from xen/include/asm-x86/p2m.h +0 -0

x86/p2m.h

Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

index 5392eb0..ee2ea9c 100644

xen/include/asm-x86/p2m.h +0 -0
@@ -71,7 +71,7 @@ typedef enum {
     p2m_ram_shared = 12,          /* Shared or sharable memory */
     p2m_ram_broken = 13,          /* Broken page, access cause

domain

crash

Quoted 17 lines
Quoted 17 lines

*/

Quoted 4 lines

p2m_map_foreign = 14, /* ram pages from foreign
domain */
- p2m_mmio_write_dm = 15, /* Read-only; writes go to the
device

model */

Quoted 11 lines
xen/include/asm-x86/p2m.h +2 -1
+    p2m_ioreq_server = 15,
 } p2m_type_t;
 
 /* Modifiers to the query */
@@ -112,7 +112,7 @@ typedef unsigned int p2m_query_t;
                       | p2m_to_mask(p2m_ram_ro)         \
                       | p2m_to_mask(p2m_grant_map_ro)   \
                       | p2m_to_mask(p2m_ram_shared)     \
-                      | p2m_to_mask(p2m_mmio_write_dm))
+                      | p2m_to_mask(p2m_ioreq_server))
 
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
xen/include/asm-x86/p2m.h +0 -0
 /* Write-discard types, which should discard the write

operations */
#define P2M_DISCARD_WRITE_TYPES

(p2m_to_mask(p2m_ram_ro) \

Quoted 37 lines
Quoted 37 lines
Quoted 37 lines
Quoted 37 lines
Quoted 10 lines
Quoted 10 lines

Review

Quoted 1 line
(quoted diff) +0 -0

b/xen/include/public/hvm/hvm_op.h

Quoted 8 lines

index 1606185..b3e45cf 100644

xen/include/public/hvm/hvm_op.h +0 -0
@@ -83,7 +83,13 @@ typedef enum {
     HVMMEM_ram_rw,             /* Normal read/write guest RAM */
     HVMMEM_ram_ro,             /* Read-only; writes are

discarded */
HVMMEM_mmio_dm, /* Reads and write go to the device

model

Quoted 11 lines
Quoted 11 lines

*/

Quoted 2 lines

- HVMMEM_mmio_write_dm /* Read-only; writes go to the
device

model */

Quoted 3 lines
xen/include/public/hvm/hvm_op.h +2 -0
+#if __XEN_INTERFACE_VERSION__ < 0x00040700
+    HVMMEM_mmio_write_dm,      /* Read-only; writes go to the

device

model */

Quoted 3 lines
xen/include/public/hvm/hvm_op.h +2 -0
+#else
+    HVMMEM_unused,             /* Placeholder; setting memory to

this

type

Quoted 14 lines
Quoted 14 lines

xen/include/public/hvm/hvm_op.h

Quoted 3 lines
xen/include/public/hvm/hvm_op.h +3 -0
+                                  will fail for code after 4.7.0 */
+#endif
+    HVMMEM_ioreq_server

Also, I don't think we've had a convincing argument for why this patch
needs to be in 4.7. The p2m name changes are internal only, and so don't need to be made at all; and the old functionality will work as well as it ever did. Furthermore, the whole reason we're in this situation is that we checked in a publicly-visible change to the interface before it was properly ready; I think we should avoid making
the same mistake this time.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

So personally I'd just leave this patch entirely for 4.8; but if Paul and/or Jan have strong opinions, then I would say check in only a patch to do the #if/#else/#endif, and leave both the p2m type

changes

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
Quoted 1 line

and the new HVMMEM_ioreq_server enum for when the 4.8

development

Quoted 5 lines
Quoted 2 lines

window opens.

If the whole series is going in then I think this patch is ok. If this the

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

only

Quoted 7 lines

patch that is going in for 4.7 then I thing we need the patch to hvm_op.h to
deprecate the old type and that's it. We definitely should not introduce an
implementation of the type HVMMEM_ioreq_server that has the same hardcoded semantics as the old type and then change it.

Quoted 1 line

The p2m type changes are also wrong. That type needs to be left

alone,

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

presumably, so that anything using HVMMEM_mmio_write_dm and compiled to the old interface version continues to function. I think HVMMEM_ioreq_server needs to map to a new p2m type which

should be

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines

introduced in patch #3.

Quoted 1 line

Sorry, I'm also confused now. :(

Do we really want to introduce a new p2m type? Why? My understanding of the previous agreement is that:
1> We need the interface to work on old hypervisor for HVMMEM_mmio_write_dm;
2> We need the interface to return -EINVAL for new hypervisor for HVMMEM_mmio_write_dm;
3> We need the new type HVMMEM_ioreq_server to work on new hypervisor;

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines

Did I miss something? Or I totally misunderstood?

I don't know. I'm confused too. What we definitely don't want to do is add a
new HVMMEM type and have it map to the old behaviour, otherwise

we're no

Quoted 14 lines
Quoted 4 lines
Quoted 4 lines

better off.

The question I'm not clear on the answer to is what happens to old code:

Quoted 9 lines
Quoted 1 line

Should it continue to compile? If so, should it continue to run.

We only need to be concerned about the "get type" functionality, as that's the only thing an arbitrary guest can use. If the hypercall simply never returns the old type, then old code will still work (it'll just have some dead code on new Xen), and hence it compiling against the older interface is fine (and, from general considerations, a requirement).

Quoted 2 lines

Thanks Jan. And I think the answer is yes. The new hypervisor will only return HVMMEM_ioreq_server, which is a different value now.

Quoted 7 lines

Right -- but we can't check in this entire series for 4.7; however, Paul would like to make it clear that HVMMEM_mmio_write_dm is deprecated; so
we need a patch which does the #ifdef/#else/#endif clause, and then everything else necessary to make sure that things compile properly either way, but no p2m changes or additional functionality.

Quoted 2 lines

For clarity, do you expect any existing use of HVMMEM_mmio_write_dm to continue to *function*? I agree that things should continue to build, but if they don't need to function then the now redundant p2m type should be removed IMO and any attempt to set a page to HVMMEM_mmio_write_dm (or the new HVMMEM_unused) name should result in -EINVAL. What is your position on this?

Thanks, Paul.
My expectation is that HVMMEM_mmio_write_dm shall fail in new xen version, but I do not think we need to remove the p2m type, just rename it could be OK.

Quoted 3 lines

Paul

Quoted 1 line

-George

Yu

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#19 lore raw

Re: [PATCH v3 1/3] x86/ioreq server(patch for 4.7): Rename p2m_mmio_write_dm to p2m_ioreq_server.

Quoted 1 line

-----Original Message-----

[snip]

Quoted 9 lines
Quoted 2 lines

For clarity, do you expect any existing use of HVMMEM_mmio_write_dm

to continue to *function*? I agree that things should continue to build, but if they don't need to function then the now redundant p2m type should be removed IMO and any attempt to set a page to HVMMEM_mmio_write_dm (or the new HVMMEM_unused) name should result in -EINVAL. What is your position on this?

Quoted 1 line
Quoted 5 lines

Thanks, Paul.
My expectation is that HVMMEM_mmio_write_dm shall fail in new xen version, but I do not think we need to remove the p2m type, just rename it could be OK.

I think we need George's response before we can proceed.

Paul
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#20 lore raw

Re: [PATCH v3 1/3] x86/ioreq server(patch for 4.7): Rename p2m_mmio_write_dm to p2m_ioreq_server.

In reply to Paul Durrant
Quoted 1 line · Paul Durrant

For clarity, do you expect any existing use of HVMMEM_mmio_write_dm to continue to *function*? I agree that things should continue to build, but if they don't need to function then the now redundant p2m type should be removed IMO and any attempt to set a page to HVMMEM_mmio_write_dm (or the new HVMMEM_unused) name should result in -EINVAL. What is your position on this?

I sort of feel like we're playing some strange guessing game with the color of this bike shed, where all 4 of us give a random combination of constrants and then we have to figure out what the solution is. :-)

There are two issues: the interface (HVMMEM_*) and the internals.(p2m_*).

Jan says that code that calls HVMOP_get_mem_type has to continue to compile and function. "Functioning" is easy, as you just don't return that value and you're done. Compiling just means having the #ifdef.

It sounds like we all agree that HVMOP_set_mem_type with the current HVMMEM_mmio_write_dm value should return -EINVAL.

Regarding the p2m type which now should be impossible to set -- I don't think it's critical to remove from the release, since it's just internal. I'd normally say just leave it for now to reduce code churn.

But mostly I think we just want to get this bike shed painted, so if anyone thinks we should really remove the p2m type from this release, then that's fine with me too (assuming it's OK with Wei).

Does this cover everything?

-George

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#21 lore raw

Re: [PATCH v3 1/3] x86/ioreq server(patch for 4.7): Rename p2m_mmio_write_dm to p2m_ioreq_server.

Quoted 37 lines

-----Original Message-----
From: George Dunlap
Sent: 27 April 2016 15:13
To: Paul Durrant
Cc: Yu, Zhang; Jan Beulich; Kevin Tian; Wei Liu; Andrew Cooper; Tim (Xen.org); [email protected]; Zhiyuan Lv; Jun Nakajima; Keir (Xen.org)
Subject: Re: [Xen-devel] [PATCH v3 1/3] x86/ioreq server(patch for 4.7):
Rename p2m_mmio_write_dm to p2m_ioreq_server.

Quoted 1 line · Paul Durrant

For clarity, do you expect any existing use of HVMMEM_mmio_write_dm

to continue to *function*? I agree that things should continue to build, but if they don't need to function then the now redundant p2m type should be removed IMO and any attempt to set a page to HVMMEM_mmio_write_dm (or the new HVMMEM_unused) name should result in -EINVAL. What is your position on this?

I sort of feel like we're playing some strange guessing game with the color of this bike shed, where all 4 of us give a random combination of constrants and then we have to figure out what the solution is. :-)

There are two issues: the interface (HVMMEM_*) and the internals.(p2m_*).

Jan says that code that calls HVMOP_get_mem_type has to continue to compile and function. "Functioning" is easy, as you just don't return that value and you're done. Compiling just means having the #ifdef.

It sounds like we all agree that HVMOP_set_mem_type with the current HVMMEM_mmio_write_dm value should return -EINVAL.

Regarding the p2m type which now should be impossible to set -- I don't think it's critical to remove from the release, since it's just internal. I'd normally say just leave it for now to reduce code churn.

Quoted 6 lines

But mostly I think we just want to get this bike shed painted, so if anyone thinks we should really remove the p2m type from this release, then that's fine with me too (assuming it's OK with Wei).

Does this cover everything?

I think so. Thanks for the clarification.

Yu, are you happy to submit a patch with the #ifdef in the header, and that removes any ability to set the old type?

I guess leaving the p2m type in place to avoid code churn is reasonable at this stage, but anyone looking at the p2m code is probably going to question why it's there in 4.7.

Paul

Quoted 1 line

-George

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

author
#22 lore raw

Re: [PATCH v3 1/3] x86/ioreq server(patch for 4.7): Rename p2m_mmio_write_dm to p2m_ioreq_server.

Quoted 41 lines · Paul Durrant
Quoted 41 lines

-----Original Message-----
From: George Dunlap
Sent: 27 April 2016 15:13
To: Paul Durrant
Cc: Yu, Zhang; Jan Beulich; Kevin Tian; Wei Liu; Andrew Cooper; Tim (Xen.org); [email protected]; Zhiyuan Lv; Jun Nakajima; Keir (Xen.org)
Subject: Re: [Xen-devel] [PATCH v3 1/3] x86/ioreq server(patch for 4.7):
Rename p2m_mmio_write_dm to p2m_ioreq_server.

Quoted 1 line · Paul Durrant

For clarity, do you expect any existing use of HVMMEM_mmio_write_dm

to continue to *function*? I agree that things should continue to build, but if they don't need to function then the now redundant p2m type should be removed IMO and any attempt to set a page to HVMMEM_mmio_write_dm (or the new HVMMEM_unused) name should result in -EINVAL. What is your position on this?

I sort of feel like we're playing some strange guessing game with the color of this bike shed, where all 4 of us give a random combination of constrants and then we have to figure out what the solution is. :-)

There are two issues: the interface (HVMMEM_*) and the internals.(p2m_*).

Jan says that code that calls HVMOP_get_mem_type has to continue to compile and function. "Functioning" is easy, as you just don't return that value and you're done. Compiling just means having the #ifdef.

It sounds like we all agree that HVMOP_set_mem_type with the current HVMMEM_mmio_write_dm value should return -EINVAL.

Regarding the p2m type which now should be impossible to set -- I don't think it's critical to remove from the release, since it's just internal. I'd normally say just leave it for now to reduce code churn.

But mostly I think we just want to get this bike shed painted, so if anyone thinks we should really remove the p2m type from this release, then that's fine with me too (assuming it's OK with Wei).

Quoted 7 lines
Quoted 2 lines

Does this cover everything?

I think so. Thanks for the clarification.

Yu, are you happy to submit a patch with the #ifdef in the header, and that removes any ability to set the old type?

I'm fine with this, and thanks. :)
So my understanding is that the only difference between the new patch and this current one is we do not replace p2m_mmio_write_dm with p2m_ioreq_server, hence no need to introduce HVMMEM_ioreq_server. Is this understanding correct?

Besides, do you think it acceptable we just replace p2m_mmio_write_dm with p2m_ioreq_server in next version, or should we remove this p2m type and define p2m_ioreq_server with a different value? :)

Quoted 5 lines

I guess leaving the p2m type in place to avoid code churn is reasonable at this stage, but anyone looking at the p2m code is probably going to question why it's there in 4.7.

Paul

Quoted 1 line

-George

B.R.
Yu

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#23 lore raw

Re: [PATCH v3 1/3] x86/ioreq server(patch for 4.7): Rename p2m_mmio_write_dm to p2m_ioreq_server.

Quoted 67 lines

-----Original Message-----
From: Yu, Zhang [mailto:[email protected]]
Sent: 28 April 2016 03:47
To: Paul Durrant; George Dunlap
Cc: Kevin Tian; Wei Liu; Jun Nakajima; Andrew Cooper; Tim (Xen.org); xen- [email protected]; Zhiyuan Lv; Jan Beulich; Keir (Xen.org)
Subject: Re: [Xen-devel] [PATCH v3 1/3] x86/ioreq server(patch for 4.7):
Rename p2m_mmio_write_dm to p2m_ioreq_server.

Quoted 6 lines · Paul Durrant
Quoted 6 lines

-----Original Message-----
From: George Dunlap
Sent: 27 April 2016 15:13
To: Paul Durrant
Cc: Yu, Zhang; Jan Beulich; Kevin Tian; Wei Liu; Andrew Cooper; Tim (Xen.org); [email protected]; Zhiyuan Lv; Jun Nakajima; Keir

(Xen.org)

Quoted 6 lines
Quoted 6 lines

Subject: Re: [Xen-devel] [PATCH v3 1/3] x86/ioreq server(patch for 4.7):
Rename p2m_mmio_write_dm to p2m_ioreq_server.

Quoted 1 line · Paul Durrant

For clarity, do you expect any existing use of

HVMMEM_mmio_write_dm

Quoted 1 line
Quoted 1 line

to continue to *function*? I agree that things should continue to build,

but if

Quoted 2 lines
Quoted 2 lines

they don't need to function then the now redundant p2m type should be removed IMO and any attempt to set a page to

HVMMEM_mmio_write_dm

Quoted 1 line
Quoted 1 line

(or the new HVMMEM_unused) name should result in -EINVAL. What is

your

Quoted 25 lines
Quoted 25 lines

position on this?

I sort of feel like we're playing some strange guessing game with the color of this bike shed, where all 4 of us give a random combination of constrants and then we have to figure out what the solution is. :-)

There are two issues: the interface (HVMMEM_*) and the internals.(p2m_*).

Jan says that code that calls HVMOP_get_mem_type has to continue to compile and function. "Functioning" is easy, as you just don't return that value and you're done. Compiling just means having the #ifdef.

It sounds like we all agree that HVMOP_set_mem_type with the current HVMMEM_mmio_write_dm value should return -EINVAL.

Regarding the p2m type which now should be impossible to set -- I don't think it's critical to remove from the release, since it's just internal. I'd normally say just leave it for now to reduce code churn.

But mostly I think we just want to get this bike shed painted, so if anyone thinks we should really remove the p2m type from this release, then that's fine with me too (assuming it's OK with Wei).

Quoted 6 lines
Quoted 2 lines

Does this cover everything?

I think so. Thanks for the clarification.

Yu, are you happy to submit a patch with the #ifdef in the header, and that

removes any ability to set the old type?

Quoted 1 line
Quoted 7 lines

I'm fine with this, and thanks. :)
So my understanding is that the only difference between the new patch and this current one is we do not replace p2m_mmio_write_dm with p2m_ioreq_server, hence no need to introduce HVMMEM_ioreq_server.
Is this understanding correct?

I believe so. The main points are that:

a) HVMMEM_mmio_write_dm no longer exists with the new interface version and is replaced by HVMMEM_unused
b) Any attempt to set a page to type HVMMEM_unused results in -EINVAL

Quoted 4 lines

Besides, do you think it acceptable we just replace p2m_mmio_write_dm with p2m_ioreq_server in next version, or should we remove this p2m type and define p2m_ioreq_server with a different value? :)

p2m_ioreq_server becomes defunct after the aforementioned patch. With that patch applied there will be no way to set that type on a p2m entry so it should be ok to re-use the type.

Paul

Quoted 11 lines
Quoted 2 lines

I guess leaving the p2m type in place to avoid code churn is reasonable at

this stage, but anyone looking at the p2m code is probably going to question why it's there in 4.7.

Quoted 4 lines

Paul

Quoted 1 line

-George

B.R.
Yu

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

author
#24 lore raw

Re: [PATCH v3 1/3] x86/ioreq server(patch for 4.7): Rename p2m_mmio_write_dm to p2m_ioreq_server.

Quoted 75 lines · Paul Durrant
Quoted 67 lines

-----Original Message-----
From: Yu, Zhang [mailto:[email protected]]
Sent: 28 April 2016 03:47
To: Paul Durrant; George Dunlap
Cc: Kevin Tian; Wei Liu; Jun Nakajima; Andrew Cooper; Tim (Xen.org); xen- [email protected]; Zhiyuan Lv; Jan Beulich; Keir (Xen.org)
Subject: Re: [Xen-devel] [PATCH v3 1/3] x86/ioreq server(patch for 4.7):
Rename p2m_mmio_write_dm to p2m_ioreq_server.

Quoted 6 lines · Paul Durrant
Quoted 6 lines

-----Original Message-----
From: George Dunlap
Sent: 27 April 2016 15:13
To: Paul Durrant
Cc: Yu, Zhang; Jan Beulich; Kevin Tian; Wei Liu; Andrew Cooper; Tim (Xen.org); [email protected]; Zhiyuan Lv; Jun Nakajima; Keir

(Xen.org)

Quoted 6 lines
Quoted 6 lines

Subject: Re: [Xen-devel] [PATCH v3 1/3] x86/ioreq server(patch for 4.7):
Rename p2m_mmio_write_dm to p2m_ioreq_server.

Quoted 1 line · Paul Durrant

For clarity, do you expect any existing use of

HVMMEM_mmio_write_dm

Quoted 1 line
Quoted 1 line

to continue to *function*? I agree that things should continue to build,

but if

Quoted 2 lines
Quoted 2 lines

they don't need to function then the now redundant p2m type should be removed IMO and any attempt to set a page to

HVMMEM_mmio_write_dm

Quoted 1 line
Quoted 1 line

(or the new HVMMEM_unused) name should result in -EINVAL. What is

your

Quoted 25 lines
Quoted 25 lines

position on this?

I sort of feel like we're playing some strange guessing game with the color of this bike shed, where all 4 of us give a random combination of constrants and then we have to figure out what the solution is. :-)

There are two issues: the interface (HVMMEM_*) and the internals.(p2m_*).

Jan says that code that calls HVMOP_get_mem_type has to continue to compile and function. "Functioning" is easy, as you just don't return that value and you're done. Compiling just means having the #ifdef.

It sounds like we all agree that HVMOP_set_mem_type with the current HVMMEM_mmio_write_dm value should return -EINVAL.

Regarding the p2m type which now should be impossible to set -- I don't think it's critical to remove from the release, since it's just internal. I'd normally say just leave it for now to reduce code churn.

But mostly I think we just want to get this bike shed painted, so if anyone thinks we should really remove the p2m type from this release, then that's fine with me too (assuming it's OK with Wei).

Quoted 6 lines
Quoted 2 lines

Does this cover everything?

I think so. Thanks for the clarification.

Yu, are you happy to submit a patch with the #ifdef in the header, and that

removes any ability to set the old type?

Quoted 1 line
Quoted 7 lines

I'm fine with this, and thanks. :)
So my understanding is that the only difference between the new patch and this current one is we do not replace p2m_mmio_write_dm with p2m_ioreq_server, hence no need to introduce HVMMEM_ioreq_server.
Is this understanding correct?

Quoted 5 lines

I believe so. The main points are that:

a) HVMMEM_mmio_write_dm no longer exists with the new interface version and is replaced by HVMMEM_unused
b) Any attempt to set a page to type HVMMEM_unused results in -EINVAL

Yep.

Quoted 7 lines
Quoted 4 lines

Besides, do you think it acceptable we just replace p2m_mmio_write_dm with p2m_ioreq_server in next version, or should we remove this p2m type and define p2m_ioreq_server with a different value? :)

p2m_ioreq_server becomes defunct after the aforementioned patch. With that patch applied there will be no way to set that type on a p2m entry so it should be ok to re-use the type.

Got it. Thank you, Paul.
Will send the patch out later. :)

Quoted 14 lines

Paul

Quoted 11 lines
Quoted 2 lines

I guess leaving the p2m type in place to avoid code churn is reasonable at

this stage, but anyone looking at the p2m code is probably going to question why it's there in 4.7.

Quoted 4 lines

Paul

Quoted 1 line

-George

B.R.
Yu

Yu

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#25 lore raw

Re: [PATCH v3 1/3] x86/ioreq server(patch for 4.7): Rename p2m_mmio_write_dm to p2m_ioreq_server.

In reply to Paul Durrant
Quoted 11 lines
Quoted 7 lines
Quoted 1 line · On 28.04.16 at 09:14, <[email protected]> wrote:

From: Yu, Zhang [mailto:[email protected]]
Sent: 28 April 2016 03:47
Besides, do you think it acceptable we just replace p2m_mmio_write_dm with p2m_ioreq_server in next version, or should we remove this p2m type and define p2m_ioreq_server with a different value? :)

p2m_ioreq_server becomes defunct after the aforementioned patch. With that patch applied there will be no way to set that type on a p2m entry so it should be ok to re-use the type.

s/p2m_ioreq_server/p2m_mmio_write_dm/ ?

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#26 lore raw

Re: [PATCH v3 1/3] x86/ioreq server(patch for 4.7): Rename p2m_mmio_write_dm to p2m_ioreq_server.

Quoted 17 lines

-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: 28 April 2016 11:03
To: Paul Durrant
Cc: Andrew Cooper; George Dunlap; Wei Liu; JunNakajima; Kevin Tian; Zhiyuan Lv; Zhang Yu; [email protected]; Keir (Xen.org); Tim (Xen.org)
Subject: RE: [Xen-devel] [PATCH v3 1/3] x86/ioreq server(patch for 4.7):
Rename p2m_mmio_write_dm to p2m_ioreq_server.

Quoted 8 lines
Quoted 7 lines
Quoted 1 line · On 28.04.16 at 09:14, <[email protected]> wrote:

From: Yu, Zhang [mailto:[email protected]]
Sent: 28 April 2016 03:47
Besides, do you think it acceptable we just replace p2m_mmio_write_dm with p2m_ioreq_server in next version, or should we remove this p2m type and define p2m_ioreq_server with a different value? :)

Quoted 7 lines
Quoted 1 line

p2m_ioreq_server becomes defunct after the aforementioned patch. With

that

Quoted 2 lines

patch applied there will be no way to set that type on a p2m entry so it should be ok to re-use the type.

s/p2m_ioreq_server/p2m_mmio_write_dm/ ?

Yes, that's what I meant.

Paul

Quoted 1 line

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#27 lore raw

Re: [PATCH v3 1/3] x86/ioreq server(patch for 4.7): Rename p2m_mmio_write_dm to p2m_ioreq_server.

In reply to George Dunlap
Quoted 7 lines · George Dunlap
Quoted 1 line · Paul Durrant

For clarity, do you expect any existing use of HVMMEM_mmio_write_dm to continue to *function*? I agree that things should continue to build, but if they don't need to function then the now redundant p2m type should be removed IMO and any attempt to set a page to HVMMEM_mmio_write_dm (or the new HVMMEM_unused) name should result in -EINVAL. What is your position on this?

I sort of feel like we're playing some strange guessing game with the color of this bike shed, where all 4 of us give a random combination of constrants and then we have to figure out what the solution is. :-)

Quoted 9 lines

There are two issues: the interface (HVMMEM_*) and the internals.(p2m_*).

Jan says that code that calls HVMOP_get_mem_type has to continue to compile and function. "Functioning" is easy, as you just don't return that value and you're done. Compiling just means having the #ifdef.

It sounds like we all agree that HVMOP_set_mem_type with the current HVMMEM_mmio_write_dm value should return -EINVAL.

This, is the most urgent issue at the moment AIUI.

Quoted 9 lines

Regarding the p2m type which now should be impossible to set -- I don't think it's critical to remove from the release, since it's just internal. I'd normally say just leave it for now to reduce code churn.

But mostly I think we just want to get this bike shed painted, so if anyone thinks we should really remove the p2m type from this release, then that's fine with me too (assuming it's OK with Wei).

I would prefer as few churns as possible.

Wei.

Quoted 3 lines

Does this cover everything?

-George

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

author
#28 lore raw

Re: [PATCH v3 1/3] x86/ioreq server(patch for 4.7): Rename p2m_mmio_write_dm to p2m_ioreq_server.

In reply to Paul Durrant
Quoted 274 lines · Paul Durrant
Quoted 274 lines

-----Original Message-----
From: Yu, Zhang [mailto:[email protected]]
Sent: 25 April 2016 16:22
To: Paul Durrant; George Dunlap
Cc: [email protected]; Kevin Tian; Keir (Xen.org); Jun Nakajima; Andrew Cooper; Tim (Xen.org); Lv, Zhiyuan; Jan Beulich; Wei Liu
Subject: Re: [Xen-devel] [PATCH v3 1/3] x86/ioreq server(patch for 4.7):
Rename p2m_mmio_write_dm to p2m_ioreq_server.

Quoted 7 lines · Paul Durrant
Quoted 7 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of George Dunlap
Sent: 25 April 2016 14:39
To: Yu Zhang
Cc: [email protected]; Kevin Tian; Keir (Xen.org); Jun Nakajima; Andrew Cooper; Tim (Xen.org); Paul Durrant; Lv, Zhiyuan; Jan Beulich; Wei

Liu

Quoted 4 lines
Quoted 4 lines

Subject: Re: [Xen-devel] [PATCH v3 1/3] x86/ioreq server(patch for 4.7):
Rename p2m_mmio_write_dm to p2m_ioreq_server.

On Mon, Apr 25, 2016 at 11:35 AM, Yu Zhang

<[email protected]>

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines · wrote:

Previously p2m type p2m_mmio_write_dm was introduced for write- protected memory pages whose write operations are supposed to be forwarded to and emulated by an ioreq server. Yet limitations of rangeset restrict the number of guest pages to be write-protected.

This patch replaces the p2m type p2m_mmio_write_dm with a new

name:

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

p2m_ioreq_server, which means this p2m type can be claimed by one ioreq server, instead of being tracked inside the rangeset of ioreq server. Patches following up will add the related hvmop handling code which map/unmap type p2m_ioreq_server to/from an ioreq

server.

Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

changes in v3:
- According to Jan & George's comments, keep

HVMMEM_mmio_write_dm

Quoted 3 lines

for old xen interface versions, and replace it with HVMMEM_unused for xen interfaces newer than 4.7.0; For p2m_ioreq_server, a new enum - HVMMEM_ioreq_server is introduced for the get/set mem

type

Quoted 41 lines
Quoted 41 lines
Quoted 2 lines
    interfaces;

- Add George's Reviewed-by and Acked-by from Tim & Andrew.

Unfortunately these rather contradict each other -- I consider Reviewed-by to only stick if the code I've specified hasn't changed (or has only changed trivially).

Also...

xen/arch/x86/hvm/hvm.c int hvm_hap_nested_page_fault(paddr_t gpa,

Quoted 31 lines

changes in v2:
- According to George Dunlap's comments, only rename the p2m type, with no behavior changes.

---
 xen/arch/x86/hvm/hvm.c          | 14 ++++++++------
 xen/arch/x86/mm/p2m-ept.c       |  2 +-
 xen/arch/x86/mm/p2m-pt.c        |  2 +-
 xen/arch/x86/mm/shadow/multi.c  |  2 +-
 xen/include/asm-x86/p2m.h       |  4 ++--
 xen/include/public/hvm/hvm_op.h |  8 +++++++-
 6 files changed, 20 insertions(+), 12 deletions(-)
xen/arch/x86/hvm/hvm.c +0 -0
index f24126d..874cb0f 100644
@@ -1857,7 +1857,7 @@ int hvm_hap_nested_page_fault(paddr_t gpa,

unsigned long gla,

Quoted 4 lines
Quoted 4 lines

xen/arch/x86/hvm/hvm.c int hvm_hap_nested_page_fault(paddr_t gpa, unsigned long gla,

Quoted 4 lines
xen/arch/x86/hvm/hvm.c +0 -1
      */
     if ( (p2mt == p2m_mmio_dm) ||
          (npfec.write_access &&
-          (p2m_is_discard_write(p2mt) || (p2mt ==

p2m_mmio_write_dm))) )

Quoted 44 lines
Quoted 44 lines

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,

Quoted 5 lines
xen/arch/x86/hvm/hvm.c +1 -0
+          (p2m_is_discard_write(p2mt) || (p2mt == p2m_ioreq_server))) )
     {
         __put_gfn(p2m, gfn);
         if ( ap2m_active )
@@ -5499,8 +5499,8 @@ long do_hvm_op(unsigned long op,

XEN_GUEST_HANDLE_PARAM(void) arg)

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,

Quoted 11 lines
xen/arch/x86/hvm/hvm.c +2 -2
             get_gfn_query_unlocked(d, a.pfn, &t);
             if ( p2m_is_mmio(t) )
                 a.mem_type =  HVMMEM_mmio_dm;
-            else if ( t == p2m_mmio_write_dm )
-                a.mem_type = HVMMEM_mmio_write_dm;
+            else if ( t == p2m_ioreq_server )
+                a.mem_type = HVMMEM_ioreq_server;
             else if ( p2m_is_readonly(t) )
                 a.mem_type =  HVMMEM_ram_ro;
             else if ( p2m_is_ram(t) )
@@ -5531,7 +5531,8 @@ long do_hvm_op(unsigned long op,

XEN_GUEST_HANDLE_PARAM(void) arg)

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,

Quoted 10 lines
xen/arch/x86/hvm/hvm.c +2 -1
             [HVMMEM_ram_rw]  = p2m_ram_rw,
             [HVMMEM_ram_ro]  = p2m_ram_ro,
             [HVMMEM_mmio_dm] = p2m_mmio_dm,
-            [HVMMEM_mmio_write_dm] = p2m_mmio_write_dm
+            [HVMMEM_unused] = p2m_invalid,
+            [HVMMEM_ioreq_server] = p2m_ioreq_server
         };
 
         if ( copy_from_guest(&a, arg, 1) )
@@ -5555,7 +5556,8 @@ long do_hvm_op(unsigned long op,

XEN_GUEST_HANDLE_PARAM(void) arg)

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,

Quoted 10 lines
xen/arch/x86/hvm/hvm.c +2 -1
              ((a.first_pfn + a.nr - 1) > domain_get_maximum_gpfn(d)) )
             goto setmemtype_fail;
 
-        if ( a.hvmmem_type >= ARRAY_SIZE(memtype) )
+        if ( a.hvmmem_type >= ARRAY_SIZE(memtype) ||
+             unlikely(a.hvmmem_type == HVMMEM_unused) )
             goto setmemtype_fail;
 
         while ( a.nr > start_iter )
@@ -5579,7 +5581,7 @@ long do_hvm_op(unsigned long op,

XEN_GUEST_HANDLE_PARAM(void) arg)

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg)

Quoted 3 lines
xen/arch/x86/hvm/hvm.c +0 -0
             }
             if ( !p2m_is_ram(t) &&
                  (!p2m_is_hole(t) || a.hvmmem_type != HVMMEM_mmio_dm)

&&

Quoted 8 lines
Quoted 8 lines

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op, · line 5582

Quoted 1 line
xen/arch/x86/hvm/hvm.c +0 -1
-                 (t != p2m_mmio_write_dm || a.hvmmem_type !=

HVMMEM_ram_rw) )

xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op, · line 5584

Quoted 1 line
xen/arch/x86/hvm/hvm.c +1 -0
+                 (t != p2m_ioreq_server || a.hvmmem_type !=

HVMMEM_ram_rw) )

xen/arch/x86/mm/p2m-

Quoted 4 lines
xen/arch/x86/hvm/hvm.c +0 -0
             {
                 put_gfn(d, pfn);
                 goto setmemtype_fail;
xen/arch/x86/mm/p2m- renamed from xen/arch/x86/mm/p2m-ept.c +0 -0

ept.c

Quoted 5 lines
Quoted 5 lines

xen/arch/x86/mm/p2m-ept.c static void ept_p2m_type_to_flags(struct

Quoted 4 lines

index 3cb6868..380ec25 100644

xen/arch/x86/mm/p2m-ept.c +0 -0
@@ -171,7 +171,7 @@ static void ept_p2m_type_to_flags(struct

p2m_domain *p2m, ept_entry_t *entry,

Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
xen/arch/x86/mm/p2m-ept.c +1 -1
             entry->a = entry->d = !!cpu_has_vmx_ept_ad;
             break;
         case p2m_grant_map_ro:
-        case p2m_mmio_write_dm:
+        case p2m_ioreq_server:
Quoted 8 lines

xen/arch/x86/mm/p2m-pt.c static unsigned long

Quoted 8 lines
xen/arch/x86/mm/p2m-ept.c +0 -0
             entry->r = 1;
             entry->w = entry->x = 0;
             entry->a = !!cpu_has_vmx_ept_ad;
xen/arch/x86/mm/p2m-pt.c +0 -0
index 3d80612..eabd2e3 100644
@@ -94,7 +94,7 @@ static unsigned long

p2m_type_to_flags(p2m_type_t

Quoted 16 lines
Quoted 16 lines

t, mfn_t mfn,

Review

Quoted 9 lines
xen/arch/x86/mm/p2m-pt.c +1 -1
     default:
         return flags | _PAGE_NX_BIT;
     case p2m_grant_map_ro:
-    case p2m_mmio_write_dm:
+    case p2m_ioreq_server:
         return flags | P2M_BASE_FLAGS | _PAGE_NX_BIT;
     case p2m_ram_ro:
     case p2m_ram_logdirty:
(quoted diff) +0 -0

b/xen/arch/x86/mm/shadow/multi.c

Quoted 5 lines

index e5c8499..c81302a 100644

xen/arch/x86/mm/shadow/multi.c +0 -0
@@ -3225,7 +3225,7 @@ static int sh_page_fault(struct vcpu *v,
 
Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
xen/arch/x86/mm/shadow/multi.c +1 -1
     /* Need to hand off device-model MMIO to the device model */
     if ( p2mt == p2m_mmio_dm
-         || (p2mt == p2m_mmio_write_dm && ft == ft_demand_write) )
+         || (p2mt == p2m_ioreq_server && ft == ft_demand_write) )
     {
         gpa = guest_walk_to_gpa(&gw);
Quoted 8 lines

xen/include/asm-x86/p2m.h typedef enum { · line 72

Quoted 8 lines
xen/arch/x86/mm/shadow/multi.c +0 -0
         goto mmio;
xen/include/asm-x86/p2m.h +0 -0
index 5392eb0..ee2ea9c 100644
@@ -71,7 +71,7 @@ typedef enum {
     p2m_ram_shared = 12,          /* Shared or sharable memory */
     p2m_ram_broken = 13,          /* Broken page, access cause domain

crash

Quoted 19 lines
Quoted 19 lines

*/

xen/include/asm-x86/p2m.h typedef enum { · line 74

Quoted 2 lines
xen/include/asm-x86/p2m.h +0 -1
     p2m_map_foreign  = 14,        /* ram pages from foreign domain */
-    p2m_mmio_write_dm = 15,       /* Read-only; writes go to the device

model */

Review

Quoted 14 lines
xen/include/asm-x86/p2m.h +2 -1
+    p2m_ioreq_server = 15,
 } p2m_type_t;
 
 /* Modifiers to the query */
@@ -112,7 +112,7 @@ typedef unsigned int p2m_query_t;
                       | p2m_to_mask(p2m_ram_ro)         \
                       | p2m_to_mask(p2m_grant_map_ro)   \
                       | p2m_to_mask(p2m_ram_shared)     \
-                      | p2m_to_mask(p2m_mmio_write_dm))
+                      | p2m_to_mask(p2m_ioreq_server))
 
 /* Write-discard types, which should discard the write operations */
 #define P2M_DISCARD_WRITE_TYPES (p2m_to_mask(p2m_ram_ro)     \
(quoted diff) +0 -0

b/xen/include/public/hvm/hvm_op.h

Quoted 7 lines
Quoted 7 lines

xen/include/public/hvm/hvm_op.h typedef enum { · line 85

Quoted 7 lines

index 1606185..b3e45cf 100644

xen/include/public/hvm/hvm_op.h +0 -0
@@ -83,7 +83,13 @@ typedef enum {
     HVMMEM_ram_rw,             /* Normal read/write guest RAM */
     HVMMEM_ram_ro,             /* Read-only; writes are discarded */
     HVMMEM_mmio_dm,            /* Reads and write go to the device

model

Quoted 8 lines
Quoted 8 lines

*/

xen/include/public/hvm/hvm_op.h typedef enum { · line 86

Quoted 1 line
xen/include/public/hvm/hvm_op.h +0 -1
-    HVMMEM_mmio_write_dm       /* Read-only; writes go to the device

model */

xen/include/public/hvm/hvm_op.h typedef enum { · line 87

Quoted 2 lines
xen/include/public/hvm/hvm_op.h +2 -0
+#if __XEN_INTERFACE_VERSION__ < 0x00040700
+    HVMMEM_mmio_write_dm,      /* Read-only; writes go to the device

model */

Quoted 2 lines
xen/include/public/hvm/hvm_op.h +2 -0
+#else
+    HVMMEM_unused,             /* Placeholder; setting memory to this

type

Quoted 12 lines
Quoted 12 lines

xen/include/public/hvm/hvm_op.h typedef enum { · line 92

Quoted 3 lines
xen/include/public/hvm/hvm_op.h +3 -0
+                                  will fail for code after 4.7.0 */
+#endif
+    HVMMEM_ioreq_server

Also, I don't think we've had a convincing argument for why this patch needs to be in 4.7. The p2m name changes are internal only, and so don't need to be made at all; and the old functionality will work as well as it ever did. Furthermore, the whole reason we're in this situation is that we checked in a publicly-visible change to the interface before it was properly ready; I think we should avoid making the same mistake this time.

Quoted 4 lines
Quoted 4 lines

So personally I'd just leave this patch entirely for 4.8; but if Paul and/or Jan have strong opinions, then I would say check in only a patch to do the #if/#else/#endif, and leave both the p2m type changes and the new HVMMEM_ioreq_server enum for when the 4.8

development

Quoted 4 lines
Quoted 2 lines

window opens.

If the whole series is going in then I think this patch is ok. If this the only

patch that is going in for 4.7 then I thing we need the patch to hvm_op.h to deprecate the old type and that's it. We definitely should not introduce an implementation of the type HVMMEM_ioreq_server that has the same hardcoded semantics as the old type and then change it.

Quoted 1 line

The p2m type changes are also wrong. That type needs to be left alone,

presumably, so that anything using HVMMEM_mmio_write_dm and compiled to the old interface version continues to function. I think HVMMEM_ioreq_server needs to map to a new p2m type which should be introduced in patch #3.

Quoted 1 line

Sorry, I'm also confused now. :(

Do we really want to introduce a new p2m type? Why? My understanding of the previous agreement is that:
1> We need the interface to work on old hypervisor for HVMMEM_mmio_write_dm;
2> We need the interface to return -EINVAL for new hypervisor for HVMMEM_mmio_write_dm;
3> We need the new type HVMMEM_ioreq_server to work on new hypervisor;

Quoted 5 lines
Quoted 2 lines

Did I miss something? Or I totally misunderstood?

I don't know. I'm confused too. What we definitely don't want to do is add a new HVMMEM type and have it map to the old behaviour, otherwise we're no better off.

Thanks for your reply, Paul.

Well, but the old HEMMEM type does not exist anymore, and it is not old behavior with patch3 accepted. Will it be more reasonable if all 3 these patches are accepted in next version, 4.8 or 4.7.1 if there's one?

One reason I hesitate to remove the old p2m_mmio_write_dm (which is 0xf IIRC), and define p2m_ioreq_server another value(say, 0x10), is that what if another future p2m type is introduced with this value(0xf)? That would also be weird…

Quoted 4 lines

The question I'm not clear on the answer to is what happens to old code:

Should it continue to compile? If so, should it continue to run.

By "old code", you mean old interface on new hypervisor, or both?

Quoted 4 lines

Paul

Quoted 2 lines

B.R.
Yu

Yu

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#29 lore raw

Re: [PATCH v3 1/3] x86/ioreq server(patch for 4.7): Rename p2m_mmio_write_dm to p2m_ioreq_server.

In reply to George Dunlap
Quoted 17 lines
Quoted 1 line
Quoted 1 line · On 25.04.16 at 15:39, <[email protected]> wrote:
Quoted 4 lines · Yu Zhang
xen/include/public/hvm/hvm_op.h +0 -0
@@ -83,7 +83,13 @@ typedef enum {
     HVMMEM_ram_rw,             /* Normal read/write guest RAM */

xen/include/public/hvm/hvm_op.h typedef enum { · line 92

Quoted 10 lines
xen/include/public/hvm/hvm_op.h +7 -1
     HVMMEM_ram_ro,             /* Read-only; writes are discarded */
     HVMMEM_mmio_dm,            /* Reads and write go to the device model */
-    HVMMEM_mmio_write_dm       /* Read-only; writes go to the device model */
+#if __XEN_INTERFACE_VERSION__ < 0x00040700
+    HVMMEM_mmio_write_dm,      /* Read-only; writes go to the device model */
+#else
+    HVMMEM_unused,             /* Placeholder; setting memory to this type
+                                  will fail for code after 4.7.0 */
+#endif
+    HVMMEM_ioreq_server
Quoted 7 lines

Also, I don't think we've had a convincing argument for why this patch needs to be in 4.7. The p2m name changes are internal only, and so don't need to be made at all; and the old functionality will work as well as it ever did. Furthermore, the whole reason we're in this situation is that we checked in a publicly-visible change to the interface before it was properly ready; I think we should avoid making the same mistake this time.

Good point.

Quoted 5 lines

So personally I'd just leave this patch entirely for 4.8; but if Paul and/or Jan have strong opinions, then I would say check in only a patch to do the #if/#else/#endif, and leave both the p2m type changes and the new HVMMEM_ioreq_server enum for when the 4.8 development window opens.

Doing that alone would break the build - it would need to be a little more than that.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

author
#30 lore raw

PATCH v3 2/3 x86/ioreq server: Add new functions to get/set memory types.

In reply to Yu Zhang

For clarity this patch breaks the code to set/get memory types out of do_hvm_op() into dedicated functions: hvmop_set/get_mem_type(). Also, for clarity, checks for whether a memory type change is allowed are broken out into a separate function called by hvmop_set_mem_type().

There is no intentional functional change in this patch.

changes in v3:
- Add Andrew's Acked-by and George's Reviewed-by.

changes in v2:
- According to George Dunlap's comments, follow the "set rc / do something / goto out" pattern in hvmop_get_mem_type().

---
 xen/arch/x86/hvm/hvm.c | 288 +++++++++++++++++++++++++++----------------------
 1 file changed, 161 insertions(+), 127 deletions(-)
xen/arch/x86/hvm/hvm.c +161 -127
index 874cb0f..607546c 100644
@@ -5279,6 +5279,61 @@ static int do_altp2m_op(
     return rc;
 }
 
+static int hvmop_get_mem_type(
+    XEN_GUEST_HANDLE_PARAM(xen_hvm_get_mem_type_t) arg)
+{
+    struct xen_hvm_get_mem_type a;
+    struct domain *d;
+    p2m_type_t t;
+    int rc;
+
+    if ( copy_from_guest(&a, arg, 1) )
+        return -EFAULT;
+
+    d = rcu_lock_domain_by_any_id(a.domid);
+    if ( d == NULL )
+        return -ESRCH;
+
+    rc = xsm_hvm_param(XSM_TARGET, d, HVMOP_get_mem_type);
+    if ( rc )
+        goto out;
+
+    rc = -EINVAL;
+    if ( !is_hvm_domain(d) )
+        goto out;
+
+    /*
+     * Use get_gfn query as we are interested in the current
+     * type, not in allocating or unsharing. That'll happen
+     * on access.
+     */
+    get_gfn_query_unlocked(d, a.pfn, &t);
+    if ( p2m_is_mmio(t) )
+        a.mem_type =  HVMMEM_mmio_dm;
+    else if ( t == p2m_ioreq_server )
+        a.mem_type = HVMMEM_ioreq_server;
+    else if ( p2m_is_readonly(t) )
+        a.mem_type =  HVMMEM_ram_ro;
+    else if ( p2m_is_ram(t) )
+        a.mem_type =  HVMMEM_ram_rw;
+    else if ( p2m_is_pod(t) )
+        a.mem_type =  HVMMEM_ram_rw;
+    else if ( p2m_is_grant(t) )
+        a.mem_type =  HVMMEM_ram_rw;
+    else
+        a.mem_type =  HVMMEM_mmio_dm;
+
+    rc = -EFAULT;
+    if ( __copy_to_guest(arg, &a, 1) )
+        goto out;
+    rc = 0;
+
+ out:
+    rcu_unlock_domain(d);
+
+    return rc;
+}
+
 /*
  * Note that this value is effectively part of the ABI, even if we don't need
  * to make it a formal part of it: A guest suspended for migration in the
@@ -5287,6 +5342,107 @@ static int do_altp2m_op(
  */
 #define HVMOP_op_mask 0xff
 
+static bool_t hvm_allow_p2m_type_change(p2m_type_t old, p2m_type_t new)
+{
+    if ( p2m_is_ram(old) ||
+         (p2m_is_hole(old) && new == p2m_mmio_dm) ||
+         (old == p2m_ioreq_server && new == p2m_ram_rw) )
+        return 1;
+
+    return 0;
+}
+
+static int hvmop_set_mem_type(
+    XEN_GUEST_HANDLE_PARAM(xen_hvm_set_mem_type_t) arg,
+    unsigned long *iter)
+{
+    unsigned long start_iter = *iter;
+    struct xen_hvm_set_mem_type a;
+    struct domain *d;
+    int rc;
+
+    /* Interface types to internal p2m types */
+    static const p2m_type_t memtype[] = {
+        [HVMMEM_ram_rw]  = p2m_ram_rw,
+        [HVMMEM_ram_ro]  = p2m_ram_ro,
+        [HVMMEM_mmio_dm] = p2m_mmio_dm,
+        [HVMMEM_unused] = p2m_invalid,
+        [HVMMEM_ioreq_server] = p2m_ioreq_server
+    };
+
+    if ( copy_from_guest(&a, arg, 1) )
+        return -EFAULT;
+
+    rc = rcu_lock_remote_domain_by_id(a.domid, &d);
+    if ( rc != 0 )
+        return rc;
+
+    rc = -EINVAL;
+    if ( !is_hvm_domain(d) )
+        goto out;
+
+    rc = xsm_hvm_control(XSM_DM_PRIV, d, HVMOP_set_mem_type);
+    if ( rc )
+        goto out;
+
+    rc = -EINVAL;
+    if ( a.nr < start_iter ||
+         ((a.first_pfn + a.nr - 1) < a.first_pfn) ||
+         ((a.first_pfn + a.nr - 1) > domain_get_maximum_gpfn(d)) )
+        goto out;
+
+    if ( a.hvmmem_type >= ARRAY_SIZE(memtype) ||
+         unlikely(a.hvmmem_type == HVMMEM_unused) )
+        goto out;
+
+    while ( a.nr > start_iter )
+    {
+        unsigned long pfn = a.first_pfn + start_iter;
+        p2m_type_t t;
+
+        get_gfn_unshare(d, pfn, &t);
+        if ( p2m_is_paging(t) )
+        {
+            put_gfn(d, pfn);
+            p2m_mem_paging_populate(d, pfn);
+            rc = -EAGAIN;
+            goto out;
+        }
+        if ( p2m_is_shared(t) )
+        {
+            put_gfn(d, pfn);
+            rc = -EAGAIN;
+            goto out;
+        }
+        if ( !hvm_allow_p2m_type_change(t, memtype[a.hvmmem_type]) )
+        {
+            put_gfn(d, pfn);
+            goto out;
+        }
+
+        rc = p2m_change_type_one(d, pfn, t, memtype[a.hvmmem_type]);
+        put_gfn(d, pfn);
+
+        if ( rc )
+            goto out;
+
+        /* Check for continuation if it's not the last interation */
+        if ( a.nr > ++start_iter && !(start_iter & HVMOP_op_mask) &&
+             hypercall_preempt_check() )
+        {
+            rc = -ERESTART;
+            goto out;
+        }
+    }
+    rc = 0;
+
+ out:
+    rcu_unlock_domain(d);
+    *iter = start_iter;
+
+    return rc;
+}
+
 long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg)
 {
     unsigned long start_iter, mask;
@@ -5476,137 +5632,15 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg)
     }
 
     case HVMOP_get_mem_type:
-    {
-        struct xen_hvm_get_mem_type a;
-        struct domain *d;
-        p2m_type_t t;
-
-        if ( copy_from_guest(&a, arg, 1) )
-            return -EFAULT;
-
-        d = rcu_lock_domain_by_any_id(a.domid);
-        if ( d == NULL )
-            return -ESRCH;
-
-        rc = xsm_hvm_param(XSM_TARGET, d, op);
-        if ( unlikely(rc) )
-            /* nothing */;
-        else if ( likely(is_hvm_domain(d)) )
-        {
-            /* Use get_gfn query as we are interested in the current 
-             * type, not in allocating or unsharing. That'll happen 
-             * on access. */
-            get_gfn_query_unlocked(d, a.pfn, &t);
-            if ( p2m_is_mmio(t) )
-                a.mem_type =  HVMMEM_mmio_dm;
-            else if ( t == p2m_ioreq_server )
-                a.mem_type = HVMMEM_ioreq_server;
-            else if ( p2m_is_readonly(t) )
-                a.mem_type =  HVMMEM_ram_ro;
-            else if ( p2m_is_ram(t) )
-                a.mem_type =  HVMMEM_ram_rw;
-            else if ( p2m_is_pod(t) )
-                a.mem_type =  HVMMEM_ram_rw;
-            else if ( p2m_is_grant(t) )
-                a.mem_type =  HVMMEM_ram_rw;
-            else
-                a.mem_type =  HVMMEM_mmio_dm;
-            if ( __copy_to_guest(arg, &a, 1) )
-                rc = -EFAULT;
-        }
-        else
-            rc = -EINVAL;
-
-        rcu_unlock_domain(d);
+        rc = hvmop_get_mem_type(
+            guest_handle_cast(arg, xen_hvm_get_mem_type_t));
         break;
-    }
 
     case HVMOP_set_mem_type:
-    {
-        struct xen_hvm_set_mem_type a;
-        struct domain *d;
-        
-        /* Interface types to internal p2m types */
-        static const p2m_type_t memtype[] = {
-            [HVMMEM_ram_rw]  = p2m_ram_rw,
-            [HVMMEM_ram_ro]  = p2m_ram_ro,
-            [HVMMEM_mmio_dm] = p2m_mmio_dm,
-            [HVMMEM_unused] = p2m_invalid,
-            [HVMMEM_ioreq_server] = p2m_ioreq_server
-        };
-
-        if ( copy_from_guest(&a, arg, 1) )
-            return -EFAULT;
-
-        rc = rcu_lock_remote_domain_by_id(a.domid, &d);
-        if ( rc != 0 )
-            return rc;
-
-        rc = -EINVAL;
-        if ( !is_hvm_domain(d) )
-            goto setmemtype_fail;
-
-        rc = xsm_hvm_control(XSM_DM_PRIV, d, op);
-        if ( rc )
-            goto setmemtype_fail;
-
-        rc = -EINVAL;
-        if ( a.nr < start_iter ||
-             ((a.first_pfn + a.nr - 1) < a.first_pfn) ||
-             ((a.first_pfn + a.nr - 1) > domain_get_maximum_gpfn(d)) )
-            goto setmemtype_fail;
-            
-        if ( a.hvmmem_type >= ARRAY_SIZE(memtype) ||
-             unlikely(a.hvmmem_type == HVMMEM_unused) )
-            goto setmemtype_fail;
-
-        while ( a.nr > start_iter )
-        {
-            unsigned long pfn = a.first_pfn + start_iter;
-            p2m_type_t t;
-
-            get_gfn_unshare(d, pfn, &t);
-            if ( p2m_is_paging(t) )
-            {
-                put_gfn(d, pfn);
-                p2m_mem_paging_populate(d, pfn);
-                rc = -EAGAIN;
-                goto setmemtype_fail;
-            }
-            if ( p2m_is_shared(t) )
-            {
-                put_gfn(d, pfn);
-                rc = -EAGAIN;
-                goto setmemtype_fail;
-            }
-            if ( !p2m_is_ram(t) &&
-                 (!p2m_is_hole(t) || a.hvmmem_type != HVMMEM_mmio_dm) &&
-                 (t != p2m_ioreq_server || a.hvmmem_type != HVMMEM_ram_rw) )
-            {
-                put_gfn(d, pfn);
-                goto setmemtype_fail;
-            }
-
-            rc = p2m_change_type_one(d, pfn, t, memtype[a.hvmmem_type]);
-            put_gfn(d, pfn);
-            if ( rc )
-                goto setmemtype_fail;
-
-            /* Check for continuation if it's not the last interation */
-            if ( a.nr > ++start_iter && !(start_iter & HVMOP_op_mask) &&
-                 hypercall_preempt_check() )
-            {
-                rc = -ERESTART;
-                goto setmemtype_fail;
-            }
-        }
-
-        rc = 0;
-
-    setmemtype_fail:
-        rcu_unlock_domain(d);
+        rc = hvmop_set_mem_type(
+            guest_handle_cast(arg, xen_hvm_set_mem_type_t),
+            &start_iter);
         break;
-    }
 
     case HVMOP_pagetable_dying:
     {
Signature · 7 lines
1.9.1


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#31 lore raw

Re: [PATCH v3 2/3] x86/ioreq server: Add new functions to get/set memory types.

Hi Yu

Quoted 5 lines · Yu Zhang

For clarity this patch breaks the code to set/get memory types out of do_hvm_op() into dedicated functions: hvmop_set/get_mem_type(). Also, for clarity, checks for whether a memory type change is allowed are broken out into a separate function called by hvmop_set_mem_type().

Quoted 9 lines

There is no intentional functional change in this patch.

changes in v3:
- Add Andrew's Acked-by and George's Reviewed-by.

changes in v2:
- According to George Dunlap's comments, follow the "set rc / do something / goto out" pattern in hvmop_get_mem_type().

Normally we put these changelogs (or other information that is not intended to be committed) between "---" so that they are ignored when committing. Here is one example:

https://marc.info/?l=xen-devel&m=146056699332101

Note the Cc and some extra words inside surrounded by two "---". They will be ignored when committing.

The code itself looks good to me.

Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

author
#32 lore raw

Re: [PATCH v3 2/3] x86/ioreq server: Add new functions to get/set memory types.

Quoted 18 lines · Wei Liu

Hi Yu

Quoted 5 lines · Yu Zhang

For clarity this patch breaks the code to set/get memory types out of do_hvm_op() into dedicated functions: hvmop_set/get_mem_type(). Also, for clarity, checks for whether a memory type change is allowed are broken out into a separate function called by hvmop_set_mem_type().

Quoted 9 lines

There is no intentional functional change in this patch.

changes in v3:
- Add Andrew's Acked-by and George's Reviewed-by.

changes in v2:
- According to George Dunlap's comments, follow the "set rc / do something / goto out" pattern in hvmop_get_mem_type().

Quoted 9 lines

Normally we put these changelogs (or other information that is not intended to be committed) between "---" so that they are ignored when committing. Here is one example:

https://marc.info/?l=xen-devel&m=146056699332101

Note the Cc and some extra words inside surrounded by two "---". They will be ignored when committing.

Oh. Thanks for your information, Wei. :)

B.R.
Yu

Quoted 4 lines

The code itself looks good to me.

Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

author
#33 lore raw

PATCH v3 3/3 x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server.

In reply to Yu Zhang

A new HVMOP - HVMOP_map_mem_type_to_ioreq_server, is added to let one ioreq server claim/disclaim its responsibility for the handling of guest pages with p2m type p2m_ioreq_server. Users of this HVMOP can specify which kind of operation is supposed to be emulated in a parameter named flags. Currently, this HVMOP only support the emulation of write operations. And it can be easily extended to support the emulation of read ones if an ioreq server has such requirement in the future.

For now, we only support one ioreq server for this p2m type, so once an ioreq server has claimed its ownership, subsequent calls of the HVMOP_map_mem_type_to_ioreq_server will fail. Users can also disclaim the ownership of guest ram pages with p2m_ioreq_server, by triggering this new HVMOP, with ioreq server id set to the current owner's and flags parameter set to 0.

Note both HVMOP_map_mem_type_to_ioreq_server and p2m_ioreq_server are only supported for HVMs with HAP enabled.

Also note that only after one ioreq server claims its ownership of p2m_ioreq_server, will the p2m type change to p2m_ioreq_server be allowed.

changes in v3:
- Only support write emulation in this patch;
- Remove the code to handle race condition in hvmemul_do_io(),
- No need to reset the p2m type after an ioreq server has disclaimed

    its ownership of p2m_ioreq_server;
  - Only allow p2m type change to p2m_ioreq_server after an ioreq
    server has claimed its ownership of p2m_ioreq_server;
  - Only allow p2m type change to p2m_ioreq_server from pages with type
    p2m_ram_rw, and vice versa;
  - HVMOP_map_mem_type_to_ioreq_server interface change - use uint16,
    instead of enum to specify the memory type;

- Function prototype change to p2m_get_ioreq_server();
- Coding style changes;
- Commit message changes;
- Add Tim's Acked-by.

changes in v2:
- Only support HAP enabled HVMs;
- Replace p2m_mem_type_changed() with p2m_change_entry_type_global() to reset the p2m type, when an ioreq server tries to claim/disclaim its ownership of p2m_ioreq_server;
- Comments changes.

Cc Keir Fraser <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Andrew Cooper <[email protected]>
Cc George Dunlap <[email protected]>
Cc Jun Nakajima <[email protected]>
Cc Kevin Tian <[email protected]>
Cc Tim Deegan <[email protected]>
---
 xen/arch/x86/hvm/emulate.c       | 32 ++++++++++++++++--
 xen/arch/x86/hvm/hvm.c           | 63 ++++++++++++++++++++++++++++++++++--
 xen/arch/x86/hvm/ioreq.c         | 41 +++++++++++++++++++++++
 xen/arch/x86/mm/hap/nested_hap.c |  2 +-
 xen/arch/x86/mm/p2m-ept.c        |  7 +++-
 xen/arch/x86/mm/p2m-pt.c         | 23 +++++++++----
 xen/arch/x86/mm/p2m.c            | 70 ++++++++++++++++++++++++++++++++++++++++
 xen/arch/x86/mm/shadow/multi.c   |  3 +-
 xen/include/asm-x86/hvm/ioreq.h  |  2 ++
 xen/include/asm-x86/p2m.h        | 30 +++++++++++++++--
 xen/include/public/hvm/hvm_op.h  | 31 ++++++++++++++++++
 11 files changed, 286 insertions(+), 18 deletions(-)
xen/arch/x86/hvm/emulate.c +29 -3
index cc0b841..fd350bd 100644
@@ -100,6 +100,7 @@ static int hvmemul_do_io(
     uint8_t dir, bool_t df, bool_t data_is_addr, uintptr_t data)
 {
     struct vcpu *curr = current;
+    struct domain *currd = curr->domain;
     struct hvm_vcpu_io *vio = &curr->arch.hvm_vcpu.hvm_io;
     ioreq_t p = {
         .type = is_mmio ? IOREQ_TYPE_COPY : IOREQ_TYPE_PIO,
@@ -141,7 +142,7 @@ static int hvmemul_do_io(
              (p.dir != dir) ||
              (p.df != df) ||
              (p.data_is_ptr != data_is_addr) )
-            domain_crash(curr->domain);
+            domain_crash(currd);
 
         if ( data_is_addr )
             return X86EMUL_UNHANDLEABLE;
@@ -169,8 +170,33 @@ static int hvmemul_do_io(
         break;
     case X86EMUL_UNHANDLEABLE:
     {
-        struct hvm_ioreq_server *s =
-            hvm_select_ioreq_server(curr->domain, &p);
+        struct hvm_ioreq_server *s;
+        p2m_type_t p2mt;
+
+        if ( is_mmio )
+        {
+            unsigned long gmfn = paddr_to_pfn(addr);
+
+            (void) get_gfn_query_unlocked(currd, gmfn, &p2mt);
+
+            if ( p2mt == p2m_ioreq_server )
+            {
+                unsigned long flags;
+
+                s = p2m_get_ioreq_server(currd, &flags);
+
+                if ( dir == IOREQ_WRITE &&
+                     !(flags & P2M_IOREQ_HANDLE_WRITE_ACCESS) )
+                    s = NULL;
+            }
+            else
+                s = hvm_select_ioreq_server(currd, &p);
+        }
+        else
+        {
+            p2mt = p2m_invalid;
+            s = hvm_select_ioreq_server(currd, &p);
+        }
 
         /* If there is no suitable backing DM, just ignore accesses */
         if ( !s )
xen/arch/x86/hvm/hvm.c +61 -2

88 lines not on this page · raw message

xen/arch/x86/hvm/ioreq.c +41 -0

53 lines not on this page · raw message

xen/arch/x86/mm/hap/nested_hap.c +1 -1
index 9cee5a0..bbb6d85 100644
@@ -174,7 +174,7 @@ nestedhap_walk_L0_p2m(struct p2m_domain *p2m, paddr_t L1_gpa, paddr_t *L0_gpa,
     if ( *p2mt == p2m_mmio_direct )
         goto direct_mmio_out;
     rc = NESTEDHVM_PAGEFAULT_MMIO;
-    if ( *p2mt == p2m_mmio_dm )
+    if ( *p2mt == p2m_mmio_dm || *p2mt == p2m_ioreq_server )
         goto out;
 
     rc = NESTEDHVM_PAGEFAULT_L0_ERROR;
xen/arch/x86/mm/p2m-ept.c +6 -1
index 380ec25..b803694 100644
@@ -132,6 +132,12 @@ static void ept_p2m_type_to_flags(struct p2m_domain *p2m, ept_entry_t *entry,
             entry->r = entry->w = entry->x = 1;
             entry->a = entry->d = !!cpu_has_vmx_ept_ad;
             break;
+        case p2m_ioreq_server:
+            entry->r = entry->x = 1;
+            entry->w = !(p2m->ioreq.flags & P2M_IOREQ_HANDLE_WRITE_ACCESS);
+            entry->a = !!cpu_has_vmx_ept_ad;
+            entry->d = entry->w && cpu_has_vmx_ept_ad;
+            break;
         case p2m_mmio_direct:
             entry->r = entry->x = 1;
             entry->w = !rangeset_contains_singleton(mmio_ro_ranges,
@@ -171,7 +177,6 @@ static void ept_p2m_type_to_flags(struct p2m_domain *p2m, ept_entry_t *entry,
             entry->a = entry->d = !!cpu_has_vmx_ept_ad;
             break;
         case p2m_grant_map_ro:
-        case p2m_ioreq_server:
             entry->r = 1;
             entry->w = entry->x = 0;
             entry->a = !!cpu_has_vmx_ept_ad;
xen/arch/x86/mm/p2m-pt.c +17 -6
index eabd2e3..bf75afa 100644
@@ -72,7 +72,9 @@ static const unsigned long pgt[] = {
     PGT_l3_page_table
 };
 
-static unsigned long p2m_type_to_flags(p2m_type_t t, mfn_t mfn,
+static unsigned long p2m_type_to_flags(const struct p2m_domain *p2m,
+                                       p2m_type_t t,
+                                       mfn_t mfn,
                                        unsigned int level)
 {
     unsigned long flags;
@@ -94,8 +96,16 @@ static unsigned long p2m_type_to_flags(p2m_type_t t, mfn_t mfn,
     default:
         return flags | _PAGE_NX_BIT;
     case p2m_grant_map_ro:
-    case p2m_ioreq_server:
         return flags | P2M_BASE_FLAGS | _PAGE_NX_BIT;
+    case p2m_ioreq_server:
+    {
+        flags |= P2M_BASE_FLAGS | _PAGE_RW;
+
+        if ( p2m->ioreq.flags & P2M_IOREQ_HANDLE_WRITE_ACCESS )
+            return flags & ~_PAGE_RW;
+        else
+            return flags;
+    }
     case p2m_ram_ro:
     case p2m_ram_logdirty:
     case p2m_ram_shared:
@@ -442,7 +452,8 @@ static int do_recalc(struct p2m_domain *p2m, unsigned long gfn)
             p2m_type_t p2mt = p2m_is_logdirty_range(p2m, gfn & mask, gfn | ~mask)
                               ? p2m_ram_logdirty : p2m_ram_rw;
             unsigned long mfn = l1e_get_pfn(e);
-            unsigned long flags = p2m_type_to_flags(p2mt, _mfn(mfn), level);
+            unsigned long flags = p2m_type_to_flags(p2m, p2mt,
+                                                    _mfn(mfn), level);
 
             if ( level )
             {
@@ -579,7 +590,7 @@ p2m_pt_set_entry(struct p2m_domain *p2m, unsigned long gfn, mfn_t mfn,
         ASSERT(!mfn_valid(mfn) || p2mt != p2m_mmio_direct);
         l3e_content = mfn_valid(mfn) || p2m_allows_invalid_mfn(p2mt)
             ? l3e_from_pfn(mfn_x(mfn),
-                           p2m_type_to_flags(p2mt, mfn, 2) | _PAGE_PSE)
+                           p2m_type_to_flags(p2m, p2mt, mfn, 2) | _PAGE_PSE)
             : l3e_empty();
         entry_content.l1 = l3e_content.l3;
 
@@ -615,7 +626,7 @@ p2m_pt_set_entry(struct p2m_domain *p2m, unsigned long gfn, mfn_t mfn,
 
         if ( mfn_valid(mfn) || p2m_allows_invalid_mfn(p2mt) )
             entry_content = p2m_l1e_from_pfn(mfn_x(mfn),
-                                             p2m_type_to_flags(p2mt, mfn, 0));
+                                         p2m_type_to_flags(p2m, p2mt, mfn, 0));
         else
             entry_content = l1e_empty();
 
@@ -651,7 +662,7 @@ p2m_pt_set_entry(struct p2m_domain *p2m, unsigned long gfn, mfn_t mfn,
         ASSERT(!mfn_valid(mfn) || p2mt != p2m_mmio_direct);
         if ( mfn_valid(mfn) || p2m_allows_invalid_mfn(p2mt) )
             l2e_content = l2e_from_pfn(mfn_x(mfn),
-                                       p2m_type_to_flags(p2mt, mfn, 1) |
+                                       p2m_type_to_flags(p2m, p2mt, mfn, 1) |
                                        _PAGE_PSE);
         else
             l2e_content = l2e_empty();
xen/arch/x86/mm/p2m.c +70 -0

82 lines not on this page · raw message

xen/arch/x86/mm/shadow/multi.c +1 -2
index c81302a..2e0d258 100644
@@ -3224,8 +3224,7 @@ static int sh_page_fault(struct vcpu *v,
     }
 
     /* Need to hand off device-model MMIO to the device model */
-    if ( p2mt == p2m_mmio_dm
-         || (p2mt == p2m_ioreq_server && ft == ft_demand_write) )
+    if ( p2mt == p2m_mmio_dm )
     {
         gpa = guest_walk_to_gpa(&gw);
         goto mmio;
xen/include/asm-x86/hvm/ioreq.h +2 -0
index a1778ee..b03c64d 100644
@@ -36,6 +36,8 @@ int hvm_map_io_range_to_ioreq_server(struct domain *d, ioservid_t id,
 int hvm_unmap_io_range_from_ioreq_server(struct domain *d, ioservid_t id,
                                          uint32_t type, uint64_t start,
                                          uint64_t end);
+int hvm_map_mem_type_to_ioreq_server(struct domain *d, ioservid_t id,
+                                     uint16_t type, uint32_t flags);
 int hvm_set_ioreq_server_state(struct domain *d, ioservid_t id,
                                bool_t enabled);
 
xen/include/asm-x86/p2m.h +27 -3
index ee2ea9c..358605b 100644
@@ -89,7 +89,8 @@ typedef unsigned int p2m_query_t;
                        | p2m_to_mask(p2m_ram_paging_out)      \
                        | p2m_to_mask(p2m_ram_paged)           \
                        | p2m_to_mask(p2m_ram_paging_in)       \
-                       | p2m_to_mask(p2m_ram_shared))
+                       | p2m_to_mask(p2m_ram_shared)          \
+                       | p2m_to_mask(p2m_ioreq_server))
 
 /* Types that represent a physmap hole that is ok to replace with a shared
  * entry */
@@ -111,8 +112,7 @@ typedef unsigned int p2m_query_t;
 #define P2M_RO_TYPES (p2m_to_mask(p2m_ram_logdirty)     \
                       | p2m_to_mask(p2m_ram_ro)         \
                       | p2m_to_mask(p2m_grant_map_ro)   \
-                      | p2m_to_mask(p2m_ram_shared)     \
-                      | p2m_to_mask(p2m_ioreq_server))
+                      | p2m_to_mask(p2m_ram_shared))
 
 /* Write-discard types, which should discard the write operations */
 #define P2M_DISCARD_WRITE_TYPES (p2m_to_mask(p2m_ram_ro)     \
@@ -320,6 +320,24 @@ struct p2m_domain {
         struct ept_data ept;
         /* NPT-equivalent structure could be added here. */
     };
+
+    struct {
+        spinlock_t lock;
+        /*
+         * ioreq server who's responsible for the emulation of
+         * gfns with specific p2m type(for now, p2m_ioreq_server).
+         */
+        struct hvm_ioreq_server *server;
+        /*
+         * flags specifies whether read, write or both operations
+         * are to be emulated by an ioreq server.
+         */
+        unsigned int flags;
+
+#define P2M_IOREQ_HANDLE_WRITE_ACCESS HVMOP_IOREQ_MEM_ACCESS_WRITE
+#define P2M_IOREQ_HANDLE_READ_ACCESS  HVMOP_IOREQ_MEM_ACCESS_READ
+
+    } ioreq;
 };
 
 /* get host p2m table */
@@ -821,6 +839,12 @@ static inline unsigned int p2m_get_iommu_flags(p2m_type_t p2mt)
     return flags;
 }
 
+int p2m_set_ioreq_server(struct domain *d, unsigned long flags,
+                         struct hvm_ioreq_server *s);
+struct hvm_ioreq_server *p2m_get_ioreq_server(struct domain *d,
+                                              unsigned long *flags);
+void p2m_destroy_ioreq_server(struct domain *d, struct hvm_ioreq_server *s);
+
 #endif /* _XEN_P2M_H */
 
 /*
xen/include/public/hvm/hvm_op.h +31 -0
index b3e45cf..6a6de43 100644
@@ -383,6 +383,37 @@ struct xen_hvm_set_ioreq_server_state {
 typedef struct xen_hvm_set_ioreq_server_state xen_hvm_set_ioreq_server_state_t;
 DEFINE_XEN_GUEST_HANDLE(xen_hvm_set_ioreq_server_state_t);
 
+/*
+ * HVMOP_map_mem_type_to_ioreq_server : map or unmap the IOREQ Server <id>
+ *                                      to specific memroy type <type>
+ *                                      for specific accesses <flags>
+ *
+ * For now, flags only accept the value of HVMOP_IOREQ_MEM_ACCESS_WRITE,
+ * which means only write operations are to be forwarded to an ioreq server.
+ * Support for the emulation of read operations can be added when an ioreq
+ * server has such requirement in future.
+ */
+#define HVMOP_map_mem_type_to_ioreq_server 26
+struct xen_hvm_map_mem_type_to_ioreq_server {
+    domid_t domid;      /* IN - domain to be serviced */
+    ioservid_t id;      /* IN - ioreq server id */
+    uint16_t type;      /* IN - memory type */
+    uint16_t pad;
+    uint32_t flags;     /* IN - types of accesses to be forwarded to the
+                           ioreq server. flags with 0 means to unmap the
+                           ioreq server */
+#define _HVMOP_IOREQ_MEM_ACCESS_READ 0
+#define HVMOP_IOREQ_MEM_ACCESS_READ \
+    (1u << _HVMOP_IOREQ_MEM_ACCESS_READ)
+
+#define _HVMOP_IOREQ_MEM_ACCESS_WRITE 1
+#define HVMOP_IOREQ_MEM_ACCESS_WRITE \
+    (1u << _HVMOP_IOREQ_MEM_ACCESS_WRITE)
+};
+typedef struct xen_hvm_map_mem_type_to_ioreq_server
+    xen_hvm_map_mem_type_to_ioreq_server_t;
+DEFINE_XEN_GUEST_HANDLE(xen_hvm_map_mem_type_to_ioreq_server_t);
+
 #endif /* defined(__XEN__) || defined(__XEN_TOOLS__) */
 
 #if defined(__i386__) || defined(__x86_64__)
Signature · 7 lines
1.9.1


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#34 lore raw

Re: [PATCH v3 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server.

Quoted 34 lines

-----Original Message-----
From: Yu Zhang [mailto:[email protected]]
Sent: 25 April 2016 11:36
To: [email protected]
Cc: [email protected]; Wei Liu; Paul Durrant; Paul Durrant; Keir (Xen.org); Jan Beulich; Andrew Cooper; George Dunlap; Jun Nakajima; Kevin Tian; Tim (Xen.org)
Subject: [PATCH v3 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server.

A new HVMOP - HVMOP_map_mem_type_to_ioreq_server, is added to let one ioreq server claim/disclaim its responsibility for the handling of guest pages with p2m type p2m_ioreq_server. Users of this HVMOP can specify which kind of operation is supposed to be emulated in a parameter named flags. Currently, this HVMOP only support the emulation of write operations. And it can be easily extended to support the emulation of read ones if an ioreq server has such requirement in the future.

For now, we only support one ioreq server for this p2m type, so once an ioreq server has claimed its ownership, subsequent calls of the HVMOP_map_mem_type_to_ioreq_server will fail. Users can also disclaim the ownership of guest ram pages with p2m_ioreq_server, by triggering this new HVMOP, with ioreq server id set to the current owner's and flags parameter set to 0.

Note both HVMOP_map_mem_type_to_ioreq_server and
p2m_ioreq_server
are only supported for HVMs with HAP enabled.

Also note that only after one ioreq server claims its ownership of p2m_ioreq_server, will the p2m type change to p2m_ioreq_server be allowed.

Quoted 7 lines

changes in v3:
- Only support write emulation in this patch;
- Remove the code to handle race condition in hvmemul_do_io(),
- No need to reset the p2m type after an ioreq server has disclaimed

    its ownership of p2m_ioreq_server;
  - Only allow p2m type change to p2m_ioreq_server after an ioreq
    server has claimed its ownership of p2m_ioreq_server;

I think this restriction on should be mentioned in hvm_op.h somewhere close to where HVMMEM_ioreq_server is defined.

Paul

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel