x86/ioreq server: introduce HVMMEM_ioreq_server mem type
v2 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.
Changes in v12:
1> Use p2m_change_entry_type_global() to resync the p2m types, instead of p2m_memory_type_changed() in last version, cause p2m_memory_type_changed() only resyncs the memory type in the paging structures other than the p2m types;
2> Only support the HVMOP_map_mem_type_to_ioreq_server and HVMOP_ioreq_server for HVMs with HAP enabled;
3> Code corrections according to George Dunlap's comments;
4> Comments added according to George Dunlap's comments.
Yu Zhang (3):
x86/ioreq server: Add new functions to get/set memory types. x86/ioreq server: Rename p2m_mmio_write_dm to p2m_ioreq_server x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to
an ioreq server
xen/arch/x86/hvm/emulate.c | 125 ++++++++++++- xen/arch/x86/hvm/hvm.c | 375 ++++++++++++++++++++++++++------------- xen/arch/x86/mm/hap/nested_hap.c | 2 +- xen/arch/x86/mm/p2m-ept.c | 14 +- xen/arch/x86/mm/p2m-pt.c | 25 ++- xen/arch/x86/mm/p2m.c | 82 +++++++++ xen/arch/x86/mm/shadow/multi.c | 3 +- xen/include/asm-x86/p2m.h | 38 +++- xen/include/public/hvm/hvm_op.h | 39 +++- 9 files changed, 554 insertions(+), 149 deletions(-)
Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
PATCH v2 1/3 x86/ioreq server: Add new functions to get/set memory types.
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.
--- xen/arch/x86/hvm/hvm.c | 284 +++++++++++++++++++++++++++---------------------- 1 file changed, 159 insertions(+), 125 deletions(-)
xen/arch/x86/hvm/hvm.c +159 -125
@@ -6547,6 +6547,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_mmio_write_dm ) + a.mem_type = HVMMEM_mmio_write_dm; +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
@@ -6555,6 +6610,105 @@ 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_mmio_write_dm && 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_mmio_write_dm] = p2m_mmio_write_dm + }; + +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) ) + 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;
@@ -6744,135 +6898,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_mmio_write_dm ) - a.mem_type = HVMMEM_mmio_write_dm; -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_mmio_write_dm] = p2m_mmio_write_dm - }; - -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) ) - 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_mmio_write_dm || 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
Re: [PATCH v2 1/3] x86/ioreq server: Add new functions to get/set memory types.
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 byhvmop_set_mem_type().
Quoted 7 lines
There is no intentional functional change in this patch.
Signed-off-by Paul Durrant <[email protected]>Signed-off-by Yu Zhang <[email protected]>Cc Keir Fraser <[email protected]>Cc Jan Beulich <[email protected]>Cc Andrew Cooper <[email protected]>
Quoted 321 lines
--- xen/arch/x86/hvm/hvm.c | 284 +++++++++++++++++++++++++++---------------------- 1 file changed, 159 insertions(+), 125 deletions(-)xen/arch/x86/hvm/hvm.c +159
-126@@ -6547,6 +6547,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_mmio_write_dm ) + a.mem_type = HVMMEM_mmio_write_dm; +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 @@ -6555,6 +6610,105 @@ 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_mmio_write_dm && 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_mmio_write_dm] = p2m_mmio_write_dm + }; + +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) ) + 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;@@ -6744,135 +6898,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_mmio_write_dm ) - a.mem_type = HVMMEM_mmio_write_dm; -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_mmio_write_dm] = p2m_mmio_write_dm - }; - -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) ) - 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_mmio_write_dm || 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: { --1.9.1
Quoted 4 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 1/3] x86/ioreq server: Add new functions to get/set memory types.
Quoted 8 lines · George Dunlap
Quoted 7 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 byhvmop_set_mem_type().There is no intentional functional change in this patch.
Quoted 9 lines
Quoted 5 lines
Signed-off-by Paul Durrant <[email protected]>Signed-off-by Yu Zhang <[email protected]>Cc Keir Fraser <[email protected]>Cc Jan Beulich <[email protected]>Cc Andrew Cooper <[email protected]>Reviewed-by George Dunlap <[email protected]>Quoted 1 line
---
And for future reference: You should put the changes between versions in the patches themselves, rather than in the header. It's probably easier for both you and the reviewers.
-George
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 1/3] x86/ioreq server: Add new functions to get/set memory types.
In reply to Yu ZhangQuoted 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 byhvmop_set_mem_type().
Quoted 7 lines
There is no intentional functional change in this patch.
Signed-off-by Paul Durrant <[email protected]>Signed-off-by Yu Zhang <[email protected]>Cc Keir Fraser <[email protected]>Cc Jan Beulich <[email protected]>Cc Andrew Cooper <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
PATCH v2 2/3 x86/ioreq server: Rename p2m_mmio_write_dm to p2m_ioreq_server
In reply to Yu ZhangPreviously 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.
--- xen/arch/x86/hvm/hvm.c | 10 +++++----- 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 | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-)
xen/arch/x86/hvm/hvm.c +5 -5
@@ -3166,7 +3166,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 )
@@ -6578,8 +6578,8 @@ static int hvmop_get_mem_type(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) )
@@ -6614,7 +6614,7 @@ 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_mmio_write_dm && new == p2m_ram_rw) ) + (old == p2m_ioreq_server && new == p2m_ram_rw) )return 1 ;return 0 ;
@@ -6634,7 +6634,7 @@ static int hvmop_set_mem_type( [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_ioreq_server] = p2m_ioreq_server };if (copy_from_guest (&a, arg,1 ) )
xen/arch/x86/mm/p2m-ept.c +1 -1
@@ -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
@@ -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
@@ -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
@@ -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 +1 -1
@@ -83,7 +83,7 @@ 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 */ + 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
Re: [PATCH v2 2/3] x86/ioreq server: Rename p2m_mmio_write_dm to p2m_ioreq_server
Quoted 5 lines · Yu Zhang
Previously p2m type
p2m_mmio_write_dmwas 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_dmwith 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 typep2m_ioreq_serverto/from an ioreq server.Signed-off-by Paul Durrant <[email protected]>Signed-off-by Yu Zhang <[email protected]>
Again, this would have been a lot easier to review if you'd said that the only difference was to make it a straight rename, and move the type change to the next patch.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 2/3] x86/ioreq server: Rename p2m_mmio_write_dm to p2m_ioreq_server
In reply to Yu ZhangQuoted 5 lines · Yu Zhang
Previously p2m type
p2m_mmio_write_dmwas 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_dmwith 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 typep2m_ioreq_serverto/from an ioreq server.Signed-off-by Paul Durrant <[email protected]>Signed-off-by Yu Zhang <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 2/3] x86/ioreq server: Rename p2m_mmio_write_dm to p2m_ioreq_server
In reply to Yu Zhangxen/include/public/hvm/hvm_op.h typedef enum { · line 89
Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 31.03.16 at 12:53, <[email protected]> wrote:
xen/include/public/hvm/hvm_op.h +1
-1@@ -83,7 +83,7 @@ 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 */ + HVMMEM_ioreq_server, } hvmmem_type_t;/* Following tools-only interfaces may change in future. */
So there's one problem here, which the comment at the bottom of the context already hints at: This enum is part of the not tools restricted interface (as HVMOP_get_mem_type is usable by guests themselves), which we cannot change like this. Since the meaning of the enumerator value doesn't change, I guess we can get away with simply retaining its old name for non-up- to-date __XEN_INTERFACE_VERSION__.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 2/3] x86/ioreq server: Rename p2m_mmio_write_dm to p2m_ioreq_server
Quoted 24 lines
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: 08 April 2016 22:48
To: [email protected]
Cc: Andrew Cooper; Paul Durrant; George Dunlap; Jun Nakajima; Kevin Tian; [email protected]; Yu Zhang; Keir (Xen.org); Tim (Xen.org)
Subject: Re: [PATCH v2 2/3] x86/ioreq server: Renamep2m_mmio_write_dmtop2m_ioreq_serverxen/include/public/hvm/hvm_op.h typedef enum { · line 85
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 31.03.16 at 12:53, <[email protected]> wrote:
xen/include/public/hvm/hvm_op.h +0
-0@@ -83,7 +83,7 @@ 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 89
Quoted 4 lines
xen/include/public/hvm/hvm_op.h +1
-0+ HVMMEM_ioreq_server, } hvmmem_type_t;/* Following tools-only interfaces may change in future. */
Quoted 8 lines
So there's one problem here, which the comment at the bottom of the context already hints at: This enum is part of the not tools restricted interface (as
HVMOP_get_mem_typeis usable by guests themselves), which we cannot change like this. Since the meaning of the enumerator value doesn't change, I guess we can get away with simply retaining its old name for non-up- to-date__XEN_INTERFACE_VERSION__.
Has the type made it into a release yet. I was assuming we could make the change without any need to play with the version since it's only ever been present in xen-unstable so far.
Paul
Quoted 1 line
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 2/3] x86/ioreq server: Rename p2m_mmio_write_dm to p2m_ioreq_server
Quoted 33 lines · Paul Durrant
Quoted 24 lines
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: 08 April 2016 22:48
To: [email protected]
Cc: Andrew Cooper; Paul Durrant; George Dunlap; Jun Nakajima; Kevin Tian; [email protected]; Yu Zhang; Keir (Xen.org); Tim (Xen.org)
Subject: Re: [PATCH v2 2/3] x86/ioreq server: Renamep2m_mmio_write_dmtop2m_ioreq_serverxen/include/public/hvm/hvm_op.h typedef enum { · line 85
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 31.03.16 at 12:53, <[email protected]> wrote:
xen/include/public/hvm/hvm_op.h +0
-0@@ -83,7 +83,7 @@ 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 89
Quoted 4 lines
xen/include/public/hvm/hvm_op.h +1
-0+ HVMMEM_ioreq_server, } hvmmem_type_t;/* Following tools-only interfaces may change in future. */ Quoted 8 lines
So there's one problem here, which the comment at the bottom of the context already hints at: This enum is part of the not tools restricted interface (as
HVMOP_get_mem_typeis usable by guests themselves), which we cannot change like this. Since the meaning of the enumerator value doesn't change, I guess we can get away with simply retaining its old name for non-up- to-date__XEN_INTERFACE_VERSION__.
Quoted 1 line
Has the type made it into a release yet. I was assuming we could make the change without any need to play with the version since it's only ever been present in xen-unstable so far.
I think you need a Release Manager ack for that; but if it's the case that the type has never been seen in public, then I think it should be able to be renamed (in fact, we should rename it so that we don't have to deal with backwards compatibility later).
-George
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 2/3] x86/ioreq server: Rename p2m_mmio_write_dm to p2m_ioreq_server
Quoted 34 lines · George Dunlap
Quoted 33 lines · Paul Durrant
Quoted 32 lines
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: 08 April 2016 22:48
To: [email protected]
Cc: Andrew Cooper; Paul Durrant; George Dunlap; Jun Nakajima; Kevin Tian; [email protected]; Yu Zhang; Keir (Xen.org); Tim (Xen.org)
Subject: Re: [PATCH v2 2/3] x86/ioreq server: Renamep2m_mmio_write_dmtop2m_ioreq_serverxen/include/public/hvm/hvm_op.h typedef enum { · line 85
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 31.03.16 at 12:53, <[email protected]> wrote:
xen/include/public/hvm/hvm_op.h +0
-0@@ -83,7 +83,7 @@ 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 89
Quoted 4 lines
xen/include/public/hvm/hvm_op.h +1
-0+ HVMMEM_ioreq_server, } hvmmem_type_t;/* Following tools-only interfaces may change in future. */ So there's one problem here, which the comment at the bottom of the context already hints at: This enum is part of the not tools restricted interface (as
HVMOP_get_mem_typeis usable by guests themselves), which we cannot change like this. Since the meaning of the enumerator value doesn't change, I guess we can get away with simply retaining its old name for non-up- to-date__XEN_INTERFACE_VERSION__.
Quoted 7 lines
Quoted 1 line
Has the type made it into a release yet. I was assuming we could make the change without any need to play with the version since it's only ever been present in xen-unstable so far.
I think you need a Release Manager ack for that; but if it's the case that the type has never been seen in public, then I think it should be able to be renamed (in fact, we should rename it so that we don't have to deal with backwards compatibility later).
If it is not released yet, feel free to change it -- but at this point you also need to present argument on why it should be changed. I don't expect the seddery too hard to review.
Wei.
Quoted 1 line
-George
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 2/3] x86/ioreq server: Rename p2m_mmio_write_dm to p2m_ioreq_server
Quoted 60 lines
-----Original Message-----
From: Wei Liu [mailto:[email protected]]
Sent: 18 April 2016 10:15
To: George Dunlap
Cc: Paul Durrant; Jan Beulich; [email protected]; Kevin Tian; Keir (Xen.org); Andrew Cooper; Tim (Xen.org); Yu Zhang; [email protected]; Jun Nakajima; Wei Liu
Subject: Re: [Xen-devel] [PATCH v2 2/3] x86/ioreq server: Renamep2m_mmio_write_dmtop2m_ioreq_serverQuoted 1 line · George Dunlap
On Mon, Apr 18, 2016 at 9:41 AM, Paul Durrant <[email protected]>
Quoted 5 lines · wrote:
Quoted 5 lines
Quoted 5 lines
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: 08 April 2016 22:48
To: [email protected]
Cc: Andrew Cooper; Paul Durrant; George Dunlap; Jun Nakajima; KevinTian;
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
[email protected]; Yu Zhang; Keir (Xen.org); Tim (Xen.org)
Subject: Re: [PATCH v2 2/3] x86/ioreq server: Rename
p2m_mmio_write_dmQuoted 9 lines
Quoted 9 lines
Quoted 9 lines
to
p2m_ioreq_serverxen/include/public/hvm/hvm_op.h typedef enum { · line 85
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 31.03.16 at 12:53, <[email protected]> wrote:
xen/include/public/hvm/hvm_op.h +0
-0@@ -83,7 +83,7 @@ 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 devicemodel
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
*/
Quoted 1 line
xen/include/public/hvm/hvm_op.h +0
-1- HVMMEM_mmio_write_dm/* Read-only; writes go to the device
Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
model */
xen/include/public/hvm/hvm_op.h typedef enum { · line 89
Quoted 4 lines
xen/include/public/hvm/hvm_op.h +1
-0+ HVMMEM_ioreq_server, } hvmmem_type_t;/* Following tools-only interfaces may change in future. */ So there's one problem here, which the comment at the bottom of the context already hints at: This enum is part of the not tools restricted interface (as
HVMOP_get_mem_typeis usable by guests themselves), which we cannot change like this. Since the meaning of the enumerator value doesn't change, I guess we can get away with simply retaining its old name for non-up- to-date__XEN_INTERFACE_VERSION__.Quoted 1 line
Quoted 1 line
Has the type made it into a release yet. I was assuming we could make
the change without any need to play with the version since it's only ever been present in xen-unstable so far.
Quoted 6 lines
I think you need a Release Manager ack for that; but if it's the case that the type has never been seen in public, then I think it should be able to be renamed (in fact, we should rename it so that we don't have to deal with backwards compatibility later).
Quoted 4 lines
If it is not released yet, feel free to change it -- but at this point you also need to present argument on why it should be changed. I don't expect the seddery too hard to review.
There was a design doc posted to the list a couple of months back which has the justification. See http://lists.xen.org/archives/html/xen-devel/2016-02/msg03770.html
Paul
Quoted 3 lines
Wei.
Quoted 1 line
-George
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 2/3] x86/ioreq server: Rename p2m_mmio_write_dm to p2m_ioreq_server
In reply to Paul DurrantQuoted 26 lines
Quoted 1 line
Quoted 1 line
Paul Durrant <[email protected]> 04/18/16 10:41 AM >>>
From: Jan Beulich [mailto:[email protected]]
Sent: 08 April 2016 22:48Quoted 15 lines
xen/include/public/hvm/hvm_op.h typedef enum { · line 85
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 31.03.16 at 12:53, <[email protected]> wrote:
xen/include/public/hvm/hvm_op.h +0
-0@@ -83,7 +83,7 @@ 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 89
Quoted 4 lines
xen/include/public/hvm/hvm_op.h +1
-0+ HVMMEM_ioreq_server, } hvmmem_type_t;/* Following tools-only interfaces may change in future. */ Quoted 7 lines
So there's one problem here, which the comment at the bottom of the context already hints at: This enum is part of the not tools restricted interface (as
HVMOP_get_mem_typeis usable by guests themselves), which we cannot change like this. Since the meaning of the enumerator value doesn't change, I guess we can get away with simply retaining its old name for non-up- to-date__XEN_INTERFACE_VERSION__.
Quoted 1 line
Has the type made it into a release yet. I was assuming we could make the change without any need to play with the version since it's only ever been present in >xen-unstable so far.
Oh, I didn't realize this got added only after 4.6. If that was the case, then the
change of course could be done without any conditional. Checking ... No, 4.6.1 has it.
As for any of this going in now - I suppose this would need a freeze exception, which I think we've meant to avoid as much as possible this time round.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 2/3] x86/ioreq server: Rename p2m_mmio_write_dm to p2m_ioreq_server
Quoted 38 lines
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: 18 April 2016 17:40
To: Paul Durrant
Cc: Andrew Cooper; George Dunlap; [email protected]; Kevin Tian; [email protected]; [email protected]; [email protected]; Keir (Xen.org); Tim (Xen.org)
Subject: Re: RE: [PATCH v2 2/3] x86/ioreq server: Renamep2m_mmio_write_dmtop2m_ioreq_serverQuoted 10 lines
Quoted 1 line
Quoted 1 line
Paul Durrant <[email protected]> 04/18/16 10:41 AM >>>
From: Jan Beulich [mailto:[email protected]]
Sent: 08 April 2016 22:48Quoted 7 lines
xen/include/public/hvm/hvm_op.h typedef enum { · line 85
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 31.03.16 at 12:53, <[email protected]> wrote:
xen/include/public/hvm/hvm_op.h +0
-0@@ -83,7 +83,7 @@ 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 devicemodel
Quoted 16 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 89
Quoted 4 lines
xen/include/public/hvm/hvm_op.h +1
-0+ HVMMEM_ioreq_server, } hvmmem_type_t;/* Following tools-only interfaces may change in future. */ Quoted 7 lines
So there's one problem here, which the comment at the bottom of the context already hints at: This enum is part of the not tools restricted interface (as
HVMOP_get_mem_typeis usable by guests themselves), which we cannot change like this. Since the meaning of the enumerator value doesn't change, I guess we can get away with simply retaining its old name for non-up- to-date__XEN_INTERFACE_VERSION__.Quoted 1 line
Has the type made it into a release yet. I was assuming we could make the
Quoted 9 lines
change without any need to play with the version since it's only ever been present in >xen-unstable so far.
Oh, I didn't realize this got added only after 4.6. If that was the case, then
the
change of course could be done without any conditional. Checking ... No, 4.6.1
has it.
Damn. It needs to be ifdef-ed then :-(
Quoted 4 lines
As for any of this going in now - I suppose this would need a freeze exception,
which I think we've meant to avoid as much as possible this time round.
The original patch was posted before the cut-off IIRC so I'm not sure of the policy regarding freeze-exceptions.
Paul
Quoted 1 line
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 2/3] x86/ioreq server: Rename p2m_mmio_write_dm to p2m_ioreq_server
Quoted 3 lines
Quoted 1 line
Quoted 1 line
Paul Durrant <[email protected]> 04/18/16 6:45 PM >>>
The original patch was posted before the cut-off IIRC so I'm not sure of the policy regarding freeze-exceptions.
It was submitted before the feature freeze, yes, but didn't make it in by
code freeze. So it's my understanding that an exception would be needed.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 2/3] x86/ioreq server: Rename p2m_mmio_write_dm to p2m_ioreq_server
Quoted 11 lines
-----Original Message-----
From: Xen-devel [mailto:[email protected]] On Behalf Of Jan Beulich
Sent: 18 April 2016 17:47
To: Paul Durrant
Cc: Kevin Tian; Keir (Xen.org); Andrew Cooper; Tim (Xen.org); George Dunlap; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH v2 2/3] x86/ioreq server: Renamep2m_mmio_write_dmtop2m_ioreq_server
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line
Paul Durrant <[email protected]> 04/18/16 6:45 PM >>>
The original patch was posted before the cut-off IIRC so I'm not sure of the policy regarding freeze-exceptions.
It was submitted before the feature freeze, yes, but didn't make it in by
code freeze. So it's my understanding that an exception would be needed.
Ok. Thanks for the clarification. IMO getting this in is worth the freeze exception... it's a shame p2m_mmio_write_dm made it into 4.6.1. It needs to go before it proliferates any further.
Paul
Quoted 7 lines
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 2/3] x86/ioreq server: Rename p2m_mmio_write_dm to p2m_ioreq_server
Quoted 12 lines · Paul Durrant
Quoted 12 lines
-----Original Message-----
From: Xen-devel [mailto:[email protected]] On Behalf Of Jan Beulich
Sent: 18 April 2016 17:47
To: Paul Durrant
Cc: Kevin Tian; Keir (Xen.org); Andrew Cooper; Tim (Xen.org); George Dunlap; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH v2 2/3] x86/ioreq server: Renamep2m_mmio_write_dmtop2m_ioreq_serverQuoted 1 line
Quoted 1 line
Quoted 1 line
Paul Durrant <[email protected]> 04/18/16 6:45 PM >>>
Quoted 9 lines
Quoted 6 lines
Quoted 2 lines
The original patch was posted before the cut-off IIRC so I'm not sure of the policy regarding freeze-exceptions.
It was submitted before the feature freeze, yes, but didn't make it in by
code freeze. So it's my understanding that an exception would be needed.Ok. Thanks for the clarification. IMO getting this in is worth the freeze exception... it's a shame
p2m_mmio_write_dmmade it into 4.6.1. It needs to go before it proliferates any further.
Thanks, Paul.
So I suppose the only place we need change for this patch is for hvmmem_type_t, which should be defined like this?
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 */#if __XEN_INTERFACE_VERSION__ >= 0x00040700
HVMMEM_ioreq_server
#else
HVMMEM_mmio_write_dm
#endif
} hvmmem_type_t;
Besides, does 4.7 still accept freeze exception? It would be great if we can get an approval for this.
Thanks
Yu
Quoted 5 lines
Paul
Quoted 3 lines
Jan
Quoted 9 lines
Quoted 4 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 2/3] x86/ioreq server: Rename p2m_mmio_write_dm to p2m_ioreq_server
Quoted 55 lines
-----Original Message-----
From: Yu, Zhang [mailto:[email protected]]
Sent: 19 April 2016 12:03
To: Paul Durrant; Jan Beulich; Wei Liu
Cc: Kevin Tian; Keir (Xen.org); Andrew Cooper; Tim (Xen.org); George Dunlap; [email protected]; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH v2 2/3] x86/ioreq server: Renamep2m_mmio_write_dmtop2m_ioreq_serverQuoted 2 lines · Paul Durrant
Quoted 2 lines
-----Original Message-----
From: Xen-devel [mailto:[email protected]] On Behalf OfJan
Quoted 9 lines
Quoted 9 lines
Beulich
Sent: 18 April 2016 17:47
To: Paul Durrant
Cc: Kevin Tian; Keir (Xen.org); Andrew Cooper; Tim (Xen.org); George Dunlap; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH v2 2/3] x86/ioreq server: Renamep2m_mmio_write_dmtop2m_ioreq_serverQuoted 6 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line
Paul Durrant <[email protected]> 04/18/16 6:45 PM >>>
The original patch was posted before the cut-off IIRC so I'm not sure of the policy regarding freeze-exceptions.
It was submitted before the feature freeze, yes, but didn't make it in by
code freeze. So it's my understanding that an exception would beneeded.
Quoted 3 lines
Quoted 1 line
Ok. Thanks for the clarification. IMO getting this in is worth the freeze
exception... it's a shame
p2m_mmio_write_dmmade it into 4.6.1. It needs to go before it proliferates any further.Quoted 1 line
Thanks, Paul.
So I suppose the only place we need change for this patch is for
hvmmem_type_t, which should be defined like this?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 */#if
__XEN_INTERFACE_VERSION__>=0x00040700
HVMMEM_ioreq_server
#else
HVMMEM_mmio_write_dm
#endif
}hvmmem_type_t;
Quoted 2 lines
Besides, does 4.7 still accept freeze exception? It would be great if we can get an approval for this.
I talked to Wei earlier and he is happy to give a freeze exception to this change.
Paul
Quoted 18 lines
Thanks
YuQuoted 14 lines
Paul
Quoted 7 lines
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 2/3] x86/ioreq server: Rename p2m_mmio_write_dm to p2m_ioreq_server
Quoted 55 lines · Paul Durrant
Quoted 55 lines
-----Original Message-----
From: Yu, Zhang [mailto:[email protected]]
Sent: 19 April 2016 12:03
To: Paul Durrant; Jan Beulich; Wei Liu
Cc: Kevin Tian; Keir (Xen.org); Andrew Cooper; Tim (Xen.org); George Dunlap; [email protected]; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH v2 2/3] x86/ioreq server: Renamep2m_mmio_write_dmtop2m_ioreq_serverQuoted 2 lines · Paul Durrant
Quoted 2 lines
-----Original Message-----
From: Xen-devel [mailto:[email protected]] On Behalf OfJan
Quoted 9 lines
Quoted 9 lines
Beulich
Sent: 18 April 2016 17:47
To: Paul Durrant
Cc: Kevin Tian; Keir (Xen.org); Andrew Cooper; Tim (Xen.org); George Dunlap; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH v2 2/3] x86/ioreq server: Renamep2m_mmio_write_dmtop2m_ioreq_serverQuoted 6 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line
Paul Durrant <[email protected]> 04/18/16 6:45 PM >>>
The original patch was posted before the cut-off IIRC so I'm not sure of the policy regarding freeze-exceptions.
It was submitted before the feature freeze, yes, but didn't make it in by
code freeze. So it's my understanding that an exception would beneeded.
Quoted 3 lines
Quoted 1 line
Ok. Thanks for the clarification. IMO getting this in is worth the freeze
exception... it's a shame
p2m_mmio_write_dmmade it into 4.6.1. It needs to go before it proliferates any further.Quoted 1 line
Thanks, Paul.
So I suppose the only place we need change for this patch is for
hvmmem_type_t, which should be defined like this?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 */#if
__XEN_INTERFACE_VERSION__>=0x00040700
HVMMEM_ioreq_server
#else
HVMMEM_mmio_write_dm
#endif
}hvmmem_type_t;
Quoted 5 lines
Quoted 2 lines
Besides, does 4.7 still accept freeze exception? It would be great if we can get an approval for this.
I talked to Wei earlier and he is happy to give a freeze exception to this change.
Great! I really obliged. :)
BTW, Does some form of application need to be submitted? I'm not familiar with the procedure.
Yu
Quoted 20 lines
Paul
Quoted 18 lines
Thanks
YuQuoted 14 lines
Paul
Quoted 7 lines
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 2/3] x86/ioreq server: Rename p2m_mmio_write_dm to p2m_ioreq_server
Quoted 75 lines
-----Original Message-----
From: Yu, Zhang [mailto:[email protected]]
Sent: 19 April 2016 12:39
To: Paul Durrant; Jan Beulich; Wei Liu
Cc: Kevin Tian; Keir (Xen.org); Andrew Cooper; Tim (Xen.org); George Dunlap; [email protected]; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH v2 2/3] x86/ioreq server: Renamep2m_mmio_write_dmtop2m_ioreq_serverQuoted 12 lines · Paul Durrant
Quoted 12 lines
-----Original Message-----
From: Yu, Zhang [mailto:[email protected]]
Sent: 19 April 2016 12:03
To: Paul Durrant; Jan Beulich; Wei Liu
Cc: Kevin Tian; Keir (Xen.org); Andrew Cooper; Tim (Xen.org); George Dunlap; [email protected]; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH v2 2/3] x86/ioreq server: Renamep2m_mmio_write_dmtop2m_ioreq_serverQuoted 3 lines
Quoted 3 lines · Paul Durrant
Quoted 2 lines
Quoted 2 lines
-----Original Message-----
From: Xen-devel [mailto:[email protected]] On BehalfOf
Quoted 10 lines
Quoted 10 lines
Jan
Quoted 9 lines
Quoted 9 lines
Beulich
Sent: 18 April 2016 17:47
To: Paul Durrant
Cc: Kevin Tian; Keir (Xen.org); Andrew Cooper; Tim (Xen.org); George Dunlap; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH v2 2/3] x86/ioreq server: Renamep2m_mmio_write_dmtop2m_ioreq_serverQuoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line
Paul Durrant <[email protected]> 04/18/16 6:45 PM >>>
The original patch was posted before the cut-off IIRC so I'm not sure of the policy regarding freeze-exceptions.
It was submitted before the feature freeze, yes, but didn't make it in
by
Quoted 6 lines
Quoted 6 lines
Quoted 1 line
Quoted 1 line
code freeze. So it's my understanding that an exception would be
needed.
Quoted 3 lines
Quoted 1 line
Ok. Thanks for the clarification. IMO getting this in is worth the freeze
exception... it's a shame
p2m_mmio_write_dmmade it into 4.6.1. Itneeds to
Quoted 5 lines
Quoted 5 lines
go before it proliferates any further.
Quoted 1 line
Thanks, Paul.
Quoted 7 lines
Quoted 7 lines
So I suppose the only place we need change for this patch is for
hvmmem_type_t, which should be defined like this?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 10 lines
Quoted 9 lines
#if
__XEN_INTERFACE_VERSION__>=0x00040700
HVMMEM_ioreq_server
#else
HVMMEM_mmio_write_dm
#endif
}hvmmem_type_t;Besides, does 4.7 still accept freeze exception? It would be great if we can get an approval for this.
Quoted 7 lines
Quoted 1 line
I talked to Wei earlier and he is happy to give a freeze exception to this
change.
Quoted 1 line
Great! I really obliged. :)
BTW, Does some form of application need to be submitted? I'm not familiar with the procedure.
Nor am I. I would expect that you should submit the patch with something like "PATCH for 4.7" in the subject.
Paul
Quoted 22 lines
Yu
Quoted 20 lines
Paul
Quoted 18 lines
Thanks
YuQuoted 14 lines
Paul
Quoted 7 lines
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 2/3] x86/ioreq server: Rename p2m_mmio_write_dm to p2m_ioreq_server
In reply to Yu, ZhangQuoted 7 lines
Quoted 1 line
Quoted 1 line
"Yu, Zhang" <[email protected]> 04/19/16 1:46 PM >>>
Quoted 1 line · Paul Durrant
I talked to Wei earlier and he is happy to give a freeze exception to this change.
Great! I really obliged. :)
BTW, Does some form of application need to be submitted? I'm not familiar with the procedure.
To add some clarification (hopefully; Wei, please correct me if I'm wrong): The exception so far was granted only for this one patch, not the entire series. Hence it would help if in the re-submission (with the I think single pending change needed to this particular patch) you'd put this first in the series (or submit it on its own). And make sure you Cc Wei in addition to any of the people you're normally expected to Cc.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 2/3] x86/ioreq server: Rename p2m_mmio_write_dm to p2m_ioreq_server
Quoted 8 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line
"Yu, Zhang" <[email protected]> 04/19/16 1:46 PM >>>
Quoted 1 line · Paul Durrant
I talked to Wei earlier and he is happy to give a freeze exception to this change.
Great! I really obliged. :)
BTW, Does some form of application need to be submitted? I'm not familiar with the procedure.
Quoted 6 lines
To add some clarification (hopefully; Wei, please correct me if I'm wrong): The exception so far was granted only for this one patch, not the entire series. Hence it would help if in the re-submission (with the I think single pending change needed to this particular patch) you'd put this first in the series (or submit it on its own). And make sure you Cc Wei in addition to any of the people you're normally expected to Cc.
Hmm... I had the impression that this is the only patch needed and the enum wasn't released, but I was wrong. I will go over this series in detailed and let you know.
Wei.
Quoted 3 lines
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 2/3] x86/ioreq server: Rename p2m_mmio_write_dm to p2m_ioreq_server
In reply to Yu, ZhangQuoted 45 lines · Zhang
Quoted 16 lines · Paul Durrant
Quoted 16 lines
-----Original Message-----
From: Xen-devel [mailto:[email protected]] On Behalf Of Jan
Beulich
Sent: 18 April 2016 17:47
To: Paul Durrant
Cc: Kevin Tian; Keir (Xen.org); Andrew Cooper; Tim (Xen.org); George Dunlap; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH v2 2/3] x86/ioreq server: Renamep2m_mmio_write_dmtop2m_ioreq_serverQuoted 3 lines
Quoted 1 line
Quoted 1 line
Paul Durrant <[email protected]> 04/18/16 6:45 PM >>>
The original patch was posted before the cut-off IIRC so I'm not sure of the policy regarding freeze-exceptions.
Quoted 9 lines
Quoted 4 lines
It was submitted before the feature freeze, yes, but didn't make
it in by
code freeze. So it's my understanding that an exception would be needed.Ok. Thanks for the clarification. IMO getting this in is worth the freeze exception... it's a shame
p2m_mmio_write_dmmade it into 4.6.1. It needs to go before it proliferates any further.Thanks, Paul.
So I suppose the only place we need change for this patch is for
hvmmem_type_t, which should be defined like this?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 */#if
__XEN_INTERFACE_VERSION__>=0x00040700
HVMMEM_ioreq_server
#else
HVMMEM_mmio_write_dm
#endif
}hvmmem_type_t;
Quoted 2 lines
Besides, does 4.7 still accept freeze exception? It would be great if we can get an approval for this.
Wait, do we *actually* need this? Is anyone actually using this?
I'd say remove it, and if anyone complains, *then* do the #ifdef'ery as a bug-fix. I'm pretty sure that's Linux's policy -- You Must Keep Userspace Working, but you can break it to see if anyone complains first.
-George
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 2/3] x86/ioreq server: Rename p2m_mmio_write_dm to p2m_ioreq_server
Quoted 46 lines · George Dunlap
Quoted 45 lines · Zhang
Quoted 16 lines · Paul Durrant
Quoted 16 lines
-----Original Message-----
From: Xen-devel [mailto:[email protected]] On Behalf Of Jan
Beulich
Sent: 18 April 2016 17:47
To: Paul Durrant
Cc: Kevin Tian; Keir (Xen.org); Andrew Cooper; Tim (Xen.org); George Dunlap; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH v2 2/3] x86/ioreq server: Renamep2m_mmio_write_dmtop2m_ioreq_serverQuoted 3 lines
Quoted 1 line
Quoted 1 line
Paul Durrant <[email protected]> 04/18/16 6:45 PM >>>
The original patch was posted before the cut-off IIRC so I'm not sure of the policy regarding freeze-exceptions.
Quoted 9 lines
Quoted 4 lines
It was submitted before the feature freeze, yes, but didn't make
it in by
code freeze. So it's my understanding that an exception would be needed.Ok. Thanks for the clarification. IMO getting this in is worth the freeze exception... it's a shame
p2m_mmio_write_dmmade it into 4.6.1. It needs to go before it proliferates any further.Thanks, Paul.
So I suppose the only place we need change for this patch is for
hvmmem_type_t, which should be defined like this?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 */#if
__XEN_INTERFACE_VERSION__>=0x00040700
HVMMEM_ioreq_server
#else
HVMMEM_mmio_write_dm
#endif
}hvmmem_type_t;
Quoted 8 lines
Quoted 2 lines
Besides, does 4.7 still accept freeze exception? It would be great if we can get an approval for this.
Wait, do we *actually* need this? Is anyone actually using this?
I'd say remove it, and if anyone complains, *then* do the #ifdef'ery as a bug-fix. I'm pretty sure that's Linux's policy -- You Must Keep Userspace Working, but you can break it to see if anyone complains first.
Going further than this:
The proposed patch series not only changes the name, it changes the functionality. We do not want code to *compile* against 4.7 and then not *work* against 4.7; and the worst of all is to compile and sort of work but do it incorrectly.
Does the ioreq server have a way of asking Xen what version of the ABI it's providing? I'm assuming the answer is "no"; in which case code that is compiled against the 4.6 interface but run on a 4.8 interface that looks like this will fail in a somewhat unpredictable way.
Given that:
1. When we do check the ioreq server functionality in, what's the correct way to deal with code that wants to use the old interface, and what do we do with code compiled against the old interface but running on the new one?
2. What's the best thing to do for this release?
If it's the case that the only code that uses this is in XenServer, then I'd say the answer to #1 can be simply, "Don't compile" and "Don't do that" respectively; and the answer to #2 can be either "Leave it be" or "Remove the enum from the public interface".
If there are other projects that have started to use this interface, then we need a better answer to #1 than "Compile but fail in unpredicatble ways".
-George
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 2/3] x86/ioreq server: Rename p2m_mmio_write_dm to p2m_ioreq_server
Quoted 17 lines
Quoted 1 line
Quoted 1 line
George Dunlap <[email protected]> 04/20/16 6:30 PM >>>
Quoted 15 lines · George Dunlap
Quoted 14 lines · Zhang
So I suppose the only place we need change for this patch is for
hvmmem_type_t, which should be defined like this?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 */#if
__XEN_INTERFACE_VERSION__>=0x00040700
HVMMEM_ioreq_server
#else
HVMMEM_mmio_write_dm
#endif
}hvmmem_type_t;
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
Besides, does 4.7 still accept freeze exception? It would be great if we can get an approval for this.
Wait, do we *actually* need this? Is anyone actually using this?
I'd say remove it, and if anyone complains, *then* do the #ifdef'ery as a bug-fix. I'm pretty sure that's Linux's policy -- You Must Keep Userspace Working, but you can break it to see if anyone complains first.
We don't normally do it like that - we aim at keeping things compatible right away. I don't know of a case where we would have knowingly broken compatibility for users of the public headers (leaving aside tool stack only stuff of course).
Quoted 6 lines
Going further than this:
The proposed patch series not only changes the name, it changes the functionality. We do not want code to *compile* against 4.7 and then not *work* against 4.7; and the worst of all is to compile and sort of work but do it incorrectly.
I had the impression that the renaming patch was what it is - a renaming patch, without altering behavior.
Quoted 4 lines
Does the ioreq server have a way of asking Xen what version of the ABI it's providing? I'm assuming the answer is "no"; in which case code that is compiled against the 4.6 interface but run on a 4.8 interface that looks like this will fail in a somewhat unpredictable way.
The only thing it can do is ask for the Xen version. The ABI version is not being returned by anything (but perhaps should be).
Quoted 6 lines
Given that:
1. When we do check the ioreq server functionality in, what's the correct way to deal with code that wants to use the old interface, and what do we do with code compiled against the old interface but running on the new one?
For the full series I'm not sure I can really tell.But as said, for the rename patch alone I thought it is just a rename. And that's what we want to get in (see Paul's earlier reply - he wants to see the old name gone, so it won't be used any further).
Quoted 1 line
2. What's the best thing to do for this release?
If the entire series (no matter whether to go in now or later) is changing behavior, then the only choice is to consider the currently used enum value burnt, and use a fresh one for the new semantics.
Quoted 8 lines
If it's the case that the only code that uses this is in XenServer, then I'd say the answer to #1 can be simply, "Don't compile" and "Don't do that" respectively; and the answer to #2 can be either "Leave it be" or "Remove the enum from the public interface".
If there are other projects that have started to use this interface, then we need a better answer to #1 than "Compile but fail in unpredicatble ways".
How would we know whether there are other users?
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 2/3] x86/ioreq server: Rename p2m_mmio_write_dm to p2m_ioreq_server
Quoted 73 lines
-----Original Message-----
From: Xen-devel [mailto:[email protected]] On Behalf Of Jan Beulich
Sent: 20 April 2016 17:53
To: George Dunlap; Paul Durrant; Wei Liu; [email protected]
Cc: Kevin Tian; Keir (Xen.org); Andrew Cooper; Tim (Xen.org); xen- [email protected]; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH v2 2/3] x86/ioreq server: Renamep2m_mmio_write_dmtop2m_ioreq_serverQuoted 2 lines
Quoted 1 line
Quoted 1 line
George Dunlap <[email protected]> 04/20/16 6:30 PM >>>
On Wed, Apr 20, 2016 at 4:02 PM, George Dunlap
Quoted 8 lines · <[email protected]> wrote:
Quoted 8 lines · Zhang
Quoted 7 lines
So I suppose the only place we need change for this patch is for
hvmmem_type_t, which should be defined like this?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 devicemodel */
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
#if
__XEN_INTERFACE_VERSION__>=0x00040700
HVMMEM_ioreq_server
#else
HVMMEM_mmio_write_dm
#endif
}hvmmem_type_t;Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
Besides, does 4.7 still accept freeze exception? It would be great if we can get an approval for this.
Wait, do we *actually* need this? Is anyone actually using this?
I'd say remove it, and if anyone complains, *then* do the #ifdef'ery as a bug-fix. I'm pretty sure that's Linux's policy -- You Must Keep Userspace Working, but you can break it to see if anyone complains first.
We don't normally do it like that - we aim at keeping things compatible right away. I don't know of a case where we would have knowingly broken compatibility for users of the public headers (leaving aside tool stack only stuff of course).
Quoted 6 lines
Going further than this:
The proposed patch series not only changes the name, it changes the functionality. We do not want code to *compile* against 4.7 and then not *work* against 4.7; and the worst of all is to compile and sort of work but do it incorrectly.
I had the impression that the renaming patch was what it is - a renaming patch, without altering behavior.
Quoted 4 lines
Does the ioreq server have a way of asking Xen what version of the ABI it's providing? I'm assuming the answer is "no"; in which case code that is compiled against the 4.6 interface but run on a 4.8 interface that looks like this will fail in a somewhat unpredictable way.
The only thing it can do is ask for the Xen version. The ABI version is not being returned by anything (but perhaps should be).
Quoted 6 lines
Given that:
1. When we do check the ioreq server functionality in, what's the correct way to deal with code that wants to use the old interface, and what do we do with code compiled against the old interface but running on the new one?
For the full series I'm not sure I can really tell.But as said, for the rename patch alone I thought it is just a rename. And that's what we want to get in (see Paul's earlier reply - he wants to see the old name gone, so it won't be used any further).
Quoted 5 lines
Quoted 1 line
2. What's the best thing to do for this release?
If the entire series (no matter whether to go in now or later) is changing behavior, then the only choice is to consider the currently used enum value burnt, and use a fresh one for the new semantics.
It sounds like that would be best way. If we don't so that then we have to maintain the write-dm semantics for pages of that type unless the type is claimed (by using the new hypercall) and that's bit icky. I much prefer that pages of the new type are treated as RAM until claimed.
Paul
Quoted 12 lines
Quoted 9 lines
If it's the case that the only code that uses this is in XenServer, then I'd say the answer to #1 can be simply, "Don't compile" and "Don't do that" respectively; and the answer to #2 can be either "Leave it be" or "Remove the enum from the public interface".
If there are other projects that have started to use this interface, then we need a better answer to #1 than "Compile but fail in unpredicatble ways".
How would we know whether there are other users?
Quoted 7 lines
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 2/3] x86/ioreq server: Rename p2m_mmio_write_dm to p2m_ioreq_server
Quoted 73 lines · Paul Durrant
Quoted 73 lines
-----Original Message-----
From: Xen-devel [mailto:[email protected]] On Behalf Of Jan Beulich
Sent: 20 April 2016 17:53
To: George Dunlap; Paul Durrant; Wei Liu; [email protected]
Cc: Kevin Tian; Keir (Xen.org); Andrew Cooper; Tim (Xen.org); xen- [email protected]; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH v2 2/3] x86/ioreq server: Renamep2m_mmio_write_dmtop2m_ioreq_serverQuoted 2 lines
Quoted 1 line
Quoted 1 line
George Dunlap <[email protected]> 04/20/16 6:30 PM >>>
On Wed, Apr 20, 2016 at 4:02 PM, George Dunlap
Quoted 8 lines · <[email protected]> wrote:
Quoted 8 lines · Zhang
Quoted 7 lines
So I suppose the only place we need change for this patch is for
hvmmem_type_t, which should be defined like this?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 devicemodel */
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
#if
__XEN_INTERFACE_VERSION__>=0x00040700
HVMMEM_ioreq_server
#else
HVMMEM_mmio_write_dm
#endif
}hvmmem_type_t;Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
Besides, does 4.7 still accept freeze exception? It would be great if we can get an approval for this.
Wait, do we *actually* need this? Is anyone actually using this?
I'd say remove it, and if anyone complains, *then* do the #ifdef'ery as a bug-fix. I'm pretty sure that's Linux's policy -- You Must Keep Userspace Working, but you can break it to see if anyone complains first.
We don't normally do it like that - we aim at keeping things compatible right away. I don't know of a case where we would have knowingly broken compatibility for users of the public headers (leaving aside tool stack only stuff of course).
Quoted 6 lines
Going further than this:
The proposed patch series not only changes the name, it changes the functionality. We do not want code to *compile* against 4.7 and then not *work* against 4.7; and the worst of all is to compile and sort of work but do it incorrectly.
I had the impression that the renaming patch was what it is - a renaming patch, without altering behavior.
Quoted 4 lines
Does the ioreq server have a way of asking Xen what version of the ABI it's providing? I'm assuming the answer is "no"; in which case code that is compiled against the 4.6 interface but run on a 4.8 interface that looks like this will fail in a somewhat unpredictable way.
The only thing it can do is ask for the Xen version. The ABI version is not being returned by anything (but perhaps should be).
Quoted 6 lines
Given that:
1. When we do check the ioreq server functionality in, what's the correct way to deal with code that wants to use the old interface, and what do we do with code compiled against the old interface but running on the new one?
For the full series I'm not sure I can really tell.But as said, for the rename patch alone I thought it is just a rename. And that's what we want to get in (see Paul's earlier reply - he wants to see the old name gone, so it won't be used any further).
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
2. What's the best thing to do for this release?
If the entire series (no matter whether to go in now or later) is changing behavior, then the only choice is to consider the currently used enum value burnt, and use a fresh one for the new semantics.
It sounds like that would be best way. If we don't so that then we have to maintain the write-dm semantics for pages of that type unless the type is claimed (by using the new hypercall) and that's bit icky. I much prefer that pages of the new type are treated as RAM until claimed.
I think the only sensible way to keep the enum is to also keep the functionality, which would mean using *another* p2m type for ioreq_server.
Given that the functionality isn't going away for 4.7, I don't see an urgent need to remove the enum; but if Paul does, then a patch renaming it to HVMMEM_unused would be the way forward then I guess. Once the underlying p2m type goes away, you'll want to return -EINVAL for this enum value.
-George
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 2/3] x86/ioreq server: Rename p2m_mmio_write_dm to p2m_ioreq_server
Quoted 97 lines
-----Original Message-----
From: George Dunlap [mailto:[email protected]]
Sent: 20 April 2016 18:07
To: Paul Durrant; Jan Beulich; Wei Liu; [email protected]
Cc: Kevin Tian; Keir (Xen.org); Andrew Cooper; Tim (Xen.org); xen- [email protected]; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH v2 2/3] x86/ioreq server: Renamep2m_mmio_write_dmtop2m_ioreq_serverQuoted 2 lines · Paul Durrant
Quoted 2 lines
-----Original Message-----
From: Xen-devel [mailto:[email protected]] On Behalf OfJan
Quoted 27 lines
Quoted 27 lines
Beulich
Sent: 20 April 2016 17:53
To: George Dunlap; Paul Durrant; Wei Liu; [email protected]
Cc: Kevin Tian; Keir (Xen.org); Andrew Cooper; Tim (Xen.org); xen- [email protected]; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH v2 2/3] x86/ioreq server: Renamep2m_mmio_write_dmtop2m_ioreq_serverQuoted 2 lines
Quoted 1 line
Quoted 1 line
George Dunlap <[email protected]> 04/20/16 6:30 PM >>>
On Wed, Apr 20, 2016 at 4:02 PM, George Dunlap
Quoted 8 lines · <[email protected]> wrote:
Quoted 8 lines · Zhang
Quoted 7 lines
So I suppose the only place we need change for this patch is for
hvmmem_type_t, which should be defined like this?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 devicemodel */
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
#if
__XEN_INTERFACE_VERSION__>=0x00040700
HVMMEM_ioreq_server
#else
HVMMEM_mmio_write_dm
#endif
}hvmmem_type_t;Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
Besides, does 4.7 still accept freeze exception? It would be great if we can get an approval for this.
Wait, do we *actually* need this? Is anyone actually using this?
I'd say remove it, and if anyone complains, *then* do the #ifdef'ery as a bug-fix. I'm pretty sure that's Linux's policy -- You Must Keep Userspace Working, but you can break it to see if anyone complains
first.
Quoted 3 lines
Quoted 3 lines
We don't normally do it like that - we aim at keeping things compatible right away. I don't know of a case where we would have knowingly
broken
Quoted 33 lines
Quoted 33 lines
compatibility for users of the public headers (leaving aside tool stack only stuff of course).
Quoted 6 lines
Going further than this:
The proposed patch series not only changes the name, it changes the functionality. We do not want code to *compile* against 4.7 and then not *work* against 4.7; and the worst of all is to compile and sort of work but do it incorrectly.
I had the impression that the renaming patch was what it is - a renaming patch, without altering behavior.
Quoted 4 lines
Does the ioreq server have a way of asking Xen what version of the ABI it's providing? I'm assuming the answer is "no"; in which case code that is compiled against the 4.6 interface but run on a 4.8 interface that looks like this will fail in a somewhat unpredictable way.
The only thing it can do is ask for the Xen version. The ABI version is not being returned by anything (but perhaps should be).
Quoted 6 lines
Given that:
1. When we do check the ioreq server functionality in, what's the correct way to deal with code that wants to use the old interface, and what do we do with code compiled against the old interface but running on the new one?
For the full series I'm not sure I can really tell.But as said, for the rename patch alone I thought it is just a rename. And that's what we want to get in (see Paul's earlier reply - he wants to see the old name gone, so it won't be used any further).
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
2. What's the best thing to do for this release?
If the entire series (no matter whether to go in now or later) is changing behavior, then the only choice is to consider the currently used enum value burnt, and use a fresh one for the new semantics.
It sounds like that would be best way. If we don't so that then we have to
maintain the write-dm semantics for pages of that type unless the type is claimed (by using the new hypercall) and that's bit icky. I much prefer that pages of the new type are treated as RAM until claimed.
Quoted 9 lines
I think the only sensible way to keep the enum is to also keep the functionality, which would mean using *another* p2m type for
ioreq_server.Given that the functionality isn't going away for 4.7, I don't see an urgent need to remove the enum; but if Paul does, then a patch renaming it to
HVMMEM_unusedwould be the way forward then I guess. Once the underlying p2m type goes away, you'll want to return-EINVALfor this enum value.
Since the old semantics made it into the wild in 4.6.1 (which I was unaware of until a couple of days ago) then I guess we are going to need some form of deprecation like this.
Paul
Quoted 1 line
-George
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 2/3] x86/ioreq server: Rename p2m_mmio_write_dm to p2m_ioreq_server
In reply to George DunlapQuoted 82 lines · George Dunlap
Quoted 73 lines · Paul Durrant
Quoted 73 lines
-----Original Message-----
From: Xen-devel [mailto:[email protected]] On Behalf Of Jan Beulich
Sent: 20 April 2016 17:53
To: George Dunlap; Paul Durrant; Wei Liu; [email protected]
Cc: Kevin Tian; Keir (Xen.org); Andrew Cooper; Tim (Xen.org); xen- [email protected]; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH v2 2/3] x86/ioreq server: Renamep2m_mmio_write_dmtop2m_ioreq_serverQuoted 2 lines
Quoted 1 line
Quoted 1 line
George Dunlap <[email protected]> 04/20/16 6:30 PM >>>
On Wed, Apr 20, 2016 at 4:02 PM, George Dunlap
Quoted 8 lines · <[email protected]> wrote:
Quoted 8 lines · Zhang
Quoted 7 lines
So I suppose the only place we need change for this patch is for
hvmmem_type_t, which should be defined like this?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 devicemodel */
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
#if
__XEN_INTERFACE_VERSION__>=0x00040700
HVMMEM_ioreq_server
#else
HVMMEM_mmio_write_dm
#endif
}hvmmem_type_t;Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
Besides, does 4.7 still accept freeze exception? It would be great if we can get an approval for this.
Wait, do we *actually* need this? Is anyone actually using this?
I'd say remove it, and if anyone complains, *then* do the #ifdef'ery as a bug-fix. I'm pretty sure that's Linux's policy -- You Must Keep Userspace Working, but you can break it to see if anyone complains first.
We don't normally do it like that - we aim at keeping things compatible right away. I don't know of a case where we would have knowingly broken compatibility for users of the public headers (leaving aside tool stack only stuff of course).
Quoted 6 lines
Going further than this:
The proposed patch series not only changes the name, it changes the functionality. We do not want code to *compile* against 4.7 and then not *work* against 4.7; and the worst of all is to compile and sort of work but do it incorrectly.
I had the impression that the renaming patch was what it is - a renaming patch, without altering behavior.
Quoted 4 lines
Does the ioreq server have a way of asking Xen what version of the ABI it's providing? I'm assuming the answer is "no"; in which case code that is compiled against the 4.6 interface but run on a 4.8 interface that looks like this will fail in a somewhat unpredictable way.
The only thing it can do is ask for the Xen version. The ABI version is not being returned by anything (but perhaps should be).
Quoted 6 lines
Given that:
1. When we do check the ioreq server functionality in, what's the correct way to deal with code that wants to use the old interface, and what do we do with code compiled against the old interface but running on the new one?
For the full series I'm not sure I can really tell.But as said, for the rename patch alone I thought it is just a rename. And that's what we want to get in (see Paul's earlier reply - he wants to see the old name gone, so it won't be used any further).
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
2. What's the best thing to do for this release?
If the entire series (no matter whether to go in now or later) is changing behavior, then the only choice is to consider the currently used enum value burnt, and use a fresh one for the new semantics.
It sounds like that would be best way. If we don't so that then we have to maintain the write-dm semantics for pages of that type unless the type is claimed (by using the new hypercall) and that's bit icky. I much prefer that pages of the new type are treated as RAM until claimed.
Quoted 9 lines
I think the only sensible way to keep the enum is to also keep the functionality, which would mean using *another* p2m type for
ioreq_server.Given that the functionality isn't going away for 4.7, I don't see an urgent need to remove the enum; but if Paul does, then a patch renaming it to
HVMMEM_unusedwould be the way forward then I guess. Once the underlying p2m type goes away, you'll want to return-EINVALfor this enum value.
So the enum would be sth. like this?
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 */#if __XEN_INTERFACE_VERSION__ < 0x00040700
HVMMEM_mmio_write_dm, /* Read-only; writes go to the device model */
#else
HVMMEM_unused,
#endif
HVMMEM_ioreq_server
} hvmmem_type_t;
Thanks
Yu
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 2/3] x86/ioreq server: Rename p2m_mmio_write_dm to p2m_ioreq_server
Quoted 120 lines
-----Original Message-----
From: Yu, Zhang [mailto:[email protected]]
Sent: 21 April 2016 13:25
To: George Dunlap; Paul Durrant; Jan Beulich; Wei Liu
Cc: Kevin Tian; Keir (Xen.org); Andrew Cooper; Tim (Xen.org); xen- [email protected]; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH v2 2/3] x86/ioreq server: Renamep2m_mmio_write_dmtop2m_ioreq_serverQuoted 3 lines · George Dunlap
Quoted 2 lines · Paul Durrant
Quoted 2 lines
-----Original Message-----
From: Xen-devel [mailto:[email protected]] On BehalfOf Jan
Quoted 27 lines
Quoted 27 lines
Quoted 27 lines
Beulich
Sent: 20 April 2016 17:53
To: George Dunlap; Paul Durrant; Wei Liu; [email protected]
Cc: Kevin Tian; Keir (Xen.org); Andrew Cooper; Tim (Xen.org); xen- [email protected]; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH v2 2/3] x86/ioreq server: Renamep2m_mmio_write_dmtop2m_ioreq_serverQuoted 2 lines
Quoted 1 line
Quoted 1 line
George Dunlap <[email protected]> 04/20/16 6:30 PM >>>
On Wed, Apr 20, 2016 at 4:02 PM, George Dunlap
Quoted 8 lines · <[email protected]> wrote:
Quoted 8 lines · Zhang
Quoted 7 lines
So I suppose the only place we need change for this patch is for
hvmmem_type_t, which should be defined like this?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 devicemodel */
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
#if
__XEN_INTERFACE_VERSION__>=0x00040700
HVMMEM_ioreq_server
#else
HVMMEM_mmio_write_dm
#endif
}hvmmem_type_t;Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
Besides, does 4.7 still accept freeze exception? It would be great if we can get an approval for this.
Wait, do we *actually* need this? Is anyone actually using this?
I'd say remove it, and if anyone complains, *then* do the #ifdef'ery
as
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
a bug-fix. I'm pretty sure that's Linux's policy -- You Must Keep Userspace Working, but you can break it to see if anyone complains
first.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
We don't normally do it like that - we aim at keeping things compatible right away. I don't know of a case where we would have knowingly
broken
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
compatibility for users of the public headers (leaving aside tool stack only stuff of course).
Quoted 6 lines
Going further than this:
The proposed patch series not only changes the name, it changes the functionality. We do not want code to *compile* against 4.7 and then not *work* against 4.7; and the worst of all is to compile and sort of work but do it incorrectly.
I had the impression that the renaming patch was what it is - a renaming patch, without altering behavior.
Quoted 4 lines
Does the ioreq server have a way of asking Xen what version of the ABI it's providing? I'm assuming the answer is "no"; in which case code that is compiled against the 4.6 interface but run on a 4.8 interface that looks like this will fail in a somewhat unpredictable way.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
The only thing it can do is ask for the Xen version. The ABI version is not being returned by anything (but perhaps should be).
Quoted 5 lines
Given that:
1. When we do check the ioreq server functionality in, what's the correct way to deal with code that wants to use the old interface, and what do we do with code compiled against the old interface but
running
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
on the new one?
For the full series I'm not sure I can really tell.But as said, for the rename patch alone I thought it is just a rename. And that's what we want to get in (see Paul's earlier reply - he wants to see the old name gone, so it
won't
Quoted 9 lines
Quoted 9 lines
Quoted 7 lines
be used any further).
Quoted 1 line
2. What's the best thing to do for this release?
If the entire series (no matter whether to go in now or later) is changing behavior, then the only choice is to consider the currently used enum value burnt, and use a fresh one for the new semantics.
It sounds like that would be best way. If we don't so that then we have to
maintain the write-dm semantics for pages of that type unless the type is claimed (by using the new hypercall) and that's bit icky. I much prefer that pages of the new type are treated as RAM until claimed.
Quoted 3 lines
I think the only sensible way to keep the enum is to also keep the functionality, which would mean using *another* p2m type for
ioreq_server.Quoted 7 lines
Given that the functionality isn't going away for 4.7, I don't see an urgent need to remove the enum; but if Paul does, then a patch renaming it to
HVMMEM_unusedwould be the way forward then I guess. Once the underlying p2m type goes away, you'll want to return-EINVALfor this enum value.So the enum would be sth. like this?
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 9 lines
#if
__XEN_INTERFACE_VERSION__<0x00040700
HVMMEM_mmio_write_dm, /* Read-only; writes go to the device model
*/
#else
HVMMEM_unused,
#endif
HVMMEM_ioreq_server
}hvmmem_type_t;
I believe that's correct, but presumably there's need to be a change to the hypervisor since any reference there to HVMMEM_mmio_write_dm (which I think is limited to the get and set mem type code in hvm.c) will now need to map HVMMEM_unused to the old p2m_mmio_write_dm type.
Paul
Quoted 2 lines
Thanks
Yu
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 2/3] x86/ioreq server: Rename p2m_mmio_write_dm to p2m_ioreq_server
Quoted 130 lines · Paul Durrant
Quoted 120 lines
-----Original Message-----
From: Yu, Zhang [mailto:[email protected]]
Sent: 21 April 2016 13:25
To: George Dunlap; Paul Durrant; Jan Beulich; Wei Liu
Cc: Kevin Tian; Keir (Xen.org); Andrew Cooper; Tim (Xen.org); xen- [email protected]; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH v2 2/3] x86/ioreq server: Renamep2m_mmio_write_dmtop2m_ioreq_serverQuoted 3 lines · George Dunlap
Quoted 2 lines · Paul Durrant
Quoted 2 lines
-----Original Message-----
From: Xen-devel [mailto:[email protected]] On BehalfOf Jan
Quoted 27 lines
Quoted 27 lines
Quoted 27 lines
Beulich
Sent: 20 April 2016 17:53
To: George Dunlap; Paul Durrant; Wei Liu; [email protected]
Cc: Kevin Tian; Keir (Xen.org); Andrew Cooper; Tim (Xen.org); xen- [email protected]; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH v2 2/3] x86/ioreq server: Renamep2m_mmio_write_dmtop2m_ioreq_serverQuoted 2 lines
Quoted 1 line
Quoted 1 line
George Dunlap <[email protected]> 04/20/16 6:30 PM >>>
On Wed, Apr 20, 2016 at 4:02 PM, George Dunlap
Quoted 8 lines · <[email protected]> wrote:
Quoted 8 lines · Zhang
Quoted 7 lines
So I suppose the only place we need change for this patch is for
hvmmem_type_t, which should be defined like this?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 devicemodel */
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
#if
__XEN_INTERFACE_VERSION__>=0x00040700
HVMMEM_ioreq_server
#else
HVMMEM_mmio_write_dm
#endif
}hvmmem_type_t;Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
Besides, does 4.7 still accept freeze exception? It would be great if we can get an approval for this.
Wait, do we *actually* need this? Is anyone actually using this?
I'd say remove it, and if anyone complains, *then* do the #ifdef'ery
as
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
a bug-fix. I'm pretty sure that's Linux's policy -- You Must Keep Userspace Working, but you can break it to see if anyone complains
first.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
We don't normally do it like that - we aim at keeping things compatible right away. I don't know of a case where we would have knowingly
broken
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
compatibility for users of the public headers (leaving aside tool stack only stuff of course).
Quoted 6 lines
Going further than this:
The proposed patch series not only changes the name, it changes the functionality. We do not want code to *compile* against 4.7 and then not *work* against 4.7; and the worst of all is to compile and sort of work but do it incorrectly.
I had the impression that the renaming patch was what it is - a renaming patch, without altering behavior.
Quoted 4 lines
Does the ioreq server have a way of asking Xen what version of the ABI it's providing? I'm assuming the answer is "no"; in which case code that is compiled against the 4.6 interface but run on a 4.8 interface that looks like this will fail in a somewhat unpredictable way.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
The only thing it can do is ask for the Xen version. The ABI version is not being returned by anything (but perhaps should be).
Quoted 5 lines
Given that:
1. When we do check the ioreq server functionality in, what's the correct way to deal with code that wants to use the old interface, and what do we do with code compiled against the old interface but
running
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
on the new one?
For the full series I'm not sure I can really tell.But as said, for the rename patch alone I thought it is just a rename. And that's what we want to get in (see Paul's earlier reply - he wants to see the old name gone, so it
won't
Quoted 9 lines
Quoted 9 lines
Quoted 7 lines
be used any further).
Quoted 1 line
2. What's the best thing to do for this release?
If the entire series (no matter whether to go in now or later) is changing behavior, then the only choice is to consider the currently used enum value burnt, and use a fresh one for the new semantics.
It sounds like that would be best way. If we don't so that then we have to
maintain the write-dm semantics for pages of that type unless the type is claimed (by using the new hypercall) and that's bit icky. I much prefer that pages of the new type are treated as RAM until claimed.
Quoted 3 lines
I think the only sensible way to keep the enum is to also keep the functionality, which would mean using *another* p2m type for
ioreq_server.Quoted 7 lines
Given that the functionality isn't going away for 4.7, I don't see an urgent need to remove the enum; but if Paul does, then a patch renaming it to
HVMMEM_unusedwould be the way forward then I guess. Once the underlying p2m type goes away, you'll want to return-EINVALfor this enum value.So the enum would be sth. like this?
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 9 lines
#if
__XEN_INTERFACE_VERSION__<0x00040700
HVMMEM_mmio_write_dm, /* Read-only; writes go to the device model
*/
#else
HVMMEM_unused,
#endif
HVMMEM_ioreq_server
}hvmmem_type_t;
Quoted 2 lines
I believe that's correct, but presumably there's need to be a change to the hypervisor since any reference there to
HVMMEM_mmio_write_dm(which I think is limited to the get and set mem type code inhvm.c) will now need to mapHVMMEM_unusedto the oldp2m_mmio_write_dmtype.
Thank you, Paul.
But p2m_mmio_write_dm will not exist any more...
E.g. if in hvmop_get_mem_type(), if type 0xf(p2m_ioreq_server) is returned, we could just return HVMMEM_ioreq_server. No need to worry about the HVMMEM_mmio_write_dm.
Maybe we only need to change the beginning of hvmop_set_mem_type() to sth. like this:
/* 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, /* this will be rejected later */
[HVMMEM_ioreq_server] = p2m_ioreq_server
};and later in the same routine, just reject the HVMMEM_unused type, in an if(with unlikely) statement.
Quoted 1 line
Paul
B.R.
Yu
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 2/3] x86/ioreq server: Rename p2m_mmio_write_dm to p2m_ioreq_server
Quoted 181 lines
-----Original Message-----
From: Yu, Zhang [mailto:[email protected]]
Sent: 21 April 2016 14:49
To: Paul Durrant; George Dunlap; Jan Beulich; Wei Liu
Cc: Kevin Tian; Keir (Xen.org); Andrew Cooper; Tim (Xen.org); xen- [email protected]; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH v2 2/3] x86/ioreq server: Renamep2m_mmio_write_dmtop2m_ioreq_serverQuoted 44 lines · Paul Durrant
Quoted 44 lines
-----Original Message-----
From: Yu, Zhang [mailto:[email protected]]
Sent: 21 April 2016 13:25
To: George Dunlap; Paul Durrant; Jan Beulich; Wei Liu
Cc: Kevin Tian; Keir (Xen.org); Andrew Cooper; Tim (Xen.org); xen- [email protected]; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH v2 2/3] x86/ioreq server: Renamep2m_mmio_write_dmtop2m_ioreq_serverQuoted 3 lines · George Dunlap
Quoted 2 lines · Paul Durrant
Quoted 2 lines
-----Original Message-----
From: Xen-devel [mailto:[email protected]] On BehalfOf Jan
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Beulich
Sent: 20 April 2016 17:53
To: George Dunlap; Paul Durrant; Wei Liu; [email protected]
Cc: Kevin Tian; Keir (Xen.org); Andrew Cooper; Tim (Xen.org); xen- [email protected]; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH v2 2/3] x86/ioreq server: Renamep2m_mmio_write_dmtop2m_ioreq_serverQuoted 3 lines
Quoted 1 line
Quoted 1 line
George Dunlap <[email protected]> 04/20/16 6:30 PM
On Wed, Apr 20, 2016 at 4:02 PM, George Dunlap
Quoted 8 lines · <[email protected]> wrote:
Quoted 8 lines · Zhang
Quoted 7 lines
So I suppose the only place we need change for this patch is for
hvmmem_type_t, which should be defined like this?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 devicemodel */
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
#if
__XEN_INTERFACE_VERSION__>=0x00040700
HVMMEM_ioreq_server
#else
HVMMEM_mmio_write_dm
#endif
}hvmmem_type_t;Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
Besides, does 4.7 still accept freeze exception? It would be great if we can get an approval for this.
Wait, do we *actually* need this? Is anyone actually using this?
I'd say remove it, and if anyone complains, *then* do the
#ifdef'ery
Quoted 9 lines
Quoted 9 lines
as
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
a bug-fix. I'm pretty sure that's Linux's policy -- You Must Keep Userspace Working, but you can break it to see if anyone complains
first.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
We don't normally do it like that - we aim at keeping things compatible right away. I don't know of a case where we would have knowingly
broken
Quoted 1 line
Quoted 1 line
Quoted 1 line
compatibility for users of the public headers (leaving aside tool stack
only
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
stuff of course).
Quoted 3 lines
Going further than this:
The proposed patch series not only changes the name, it changes
the
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
functionality. We do not want code to *compile* against 4.7 and
then
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
not *work* against 4.7; and the worst of all is to compile and sort of work but do it incorrectly.
I had the impression that the renaming patch was what it is - a
renaming
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
patch, without altering behavior.
Quoted 1 line
Does the ioreq server have a way of asking Xen what version of the
ABI
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
it's providing? I'm assuming the answer is "no"; in which case code that is compiled against the 4.6 interface but run on a 4.8 interface that looks like this will fail in a somewhat unpredictable way.
The only thing it can do is ask for the Xen version. The ABI version is
not
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
being returned by anything (but perhaps should be).
Quoted 4 lines
Given that:
1. When we do check the ioreq server functionality in, what's the correct way to deal with code that wants to use the old interface,
and
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
what do we do with code compiled against the old interface but
running
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
on the new one?
For the full series I'm not sure I can really tell.But as said, for the
rename
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
patch alone I thought it is just a rename. And that's what we want to
get
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
in (see Paul's earlier reply - he wants to see the old name gone, so it
won't
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
be used any further).
Quoted 1 line
2. What's the best thing to do for this release?
If the entire series (no matter whether to go in now or later) is
changing
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
behavior, then the only choice is to consider the currently used enum value burnt, and use a fresh one for the new semantics.
It sounds like that would be best way. If we don't so that then we have
to
Quoted 10 lines
Quoted 10 lines
maintain the write-dm semantics for pages of that type unless the type is claimed (by using the new hypercall) and that's bit icky. I much prefer that pages of the new type are treated as RAM until claimed.
Quoted 3 lines
I think the only sensible way to keep the enum is to also keep the functionality, which would mean using *another* p2m type for
ioreq_server.Quoted 3 lines
Given that the functionality isn't going away for 4.7, I don't see an urgent need to remove the enum; but if Paul does, then a patch
renaming
Quoted 1 line
Quoted 1 line
Quoted 1 line
it to
HVMMEM_unusedwould be the way forward then I guess. Oncethe
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
underlying p2m type goes away, you'll want to return
-EINVALfor this enum value.Quoted 8 lines
Quoted 8 lines
So the enum would be sth. like this?
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 */#if
__XEN_INTERFACE_VERSION__<0x00040700
HVMMEM_mmio_write_dm, /* Read-only; writes go to the devicemodel
Quoted 9 lines
Quoted 7 lines
*/
#else
HVMMEM_unused,
#endif
HVMMEM_ioreq_server
}hvmmem_type_t;I believe that's correct, but presumably there's need to be a change to the
hypervisor since any reference there to
HVMMEM_mmio_write_dm(which I think is limited to the get and set mem type code inhvm.c) will now need to mapHVMMEM_unusedto the oldp2m_mmio_write_dmtype.Quoted 1 line
Thank you, Paul.
But
p2m_mmio_write_dmwill not exist any more...
E.g. if inhvmop_get_mem_type(), if type 0xf(p2m_ioreq_server) is returned, we could just returnHVMMEM_ioreq_server. No need to worry about theHVMMEM_mmio_write_dm.Maybe we only need to change the beginning of
hvmop_set_mem_type()to sth. like this:/* 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, /* this will be rejected later */ [HVMMEM_ioreq_server] = p2m_ioreq_server };
Quoted 3 lines
and later in the same routine, just reject the
HVMMEM_unusedtype, in an if(with unlikely) statement.
As long as everyone is in agreement then we can break the functionality that exists in 4.6.1 (and presumably 4.7 now) then that’s ok.
Paul
Quoted 4 lines
Quoted 1 line
Paul
B.R.
Yu
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 2/3] x86/ioreq server: Rename p2m_mmio_write_dm to p2m_ioreq_server
Quoted 185 lines · Paul Durrant
Quoted 181 lines
-----Original Message-----
From: Yu, Zhang [mailto:[email protected]]
Sent: 21 April 2016 14:49
To: Paul Durrant; George Dunlap; Jan Beulich; Wei Liu
Cc: Kevin Tian; Keir (Xen.org); Andrew Cooper; Tim (Xen.org); xen- [email protected]; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH v2 2/3] x86/ioreq server: Renamep2m_mmio_write_dmtop2m_ioreq_serverQuoted 44 lines · Paul Durrant
Quoted 44 lines
-----Original Message-----
From: Yu, Zhang [mailto:[email protected]]
Sent: 21 April 2016 13:25
To: George Dunlap; Paul Durrant; Jan Beulich; Wei Liu
Cc: Kevin Tian; Keir (Xen.org); Andrew Cooper; Tim (Xen.org); xen- [email protected]; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH v2 2/3] x86/ioreq server: Renamep2m_mmio_write_dmtop2m_ioreq_serverQuoted 3 lines · George Dunlap
Quoted 2 lines · Paul Durrant
Quoted 2 lines
-----Original Message-----
From: Xen-devel [mailto:[email protected]] On BehalfOf Jan
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Beulich
Sent: 20 April 2016 17:53
To: George Dunlap; Paul Durrant; Wei Liu; [email protected]
Cc: Kevin Tian; Keir (Xen.org); Andrew Cooper; Tim (Xen.org); xen- [email protected]; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH v2 2/3] x86/ioreq server: Renamep2m_mmio_write_dmtop2m_ioreq_serverQuoted 3 lines
Quoted 1 line
Quoted 1 line
George Dunlap <[email protected]> 04/20/16 6:30 PM
On Wed, Apr 20, 2016 at 4:02 PM, George Dunlap
Quoted 8 lines · <[email protected]> wrote:
Quoted 8 lines · Zhang
Quoted 7 lines
So I suppose the only place we need change for this patch is for
hvmmem_type_t, which should be defined like this?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 devicemodel */
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
#if
__XEN_INTERFACE_VERSION__>=0x00040700
HVMMEM_ioreq_server
#else
HVMMEM_mmio_write_dm
#endif
}hvmmem_type_t;Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
Besides, does 4.7 still accept freeze exception? It would be great if we can get an approval for this.
Wait, do we *actually* need this? Is anyone actually using this?
I'd say remove it, and if anyone complains, *then* do the
#ifdef'ery
Quoted 9 lines
Quoted 9 lines
as
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
a bug-fix. I'm pretty sure that's Linux's policy -- You Must Keep Userspace Working, but you can break it to see if anyone complains
first.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
We don't normally do it like that - we aim at keeping things compatible right away. I don't know of a case where we would have knowingly
broken
Quoted 1 line
Quoted 1 line
Quoted 1 line
compatibility for users of the public headers (leaving aside tool stack
only
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
stuff of course).
Quoted 3 lines
Going further than this:
The proposed patch series not only changes the name, it changes
the
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
functionality. We do not want code to *compile* against 4.7 and
then
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
not *work* against 4.7; and the worst of all is to compile and sort of work but do it incorrectly.
I had the impression that the renaming patch was what it is - a
renaming
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
patch, without altering behavior.
Quoted 1 line
Does the ioreq server have a way of asking Xen what version of the
ABI
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
it's providing? I'm assuming the answer is "no"; in which case code that is compiled against the 4.6 interface but run on a 4.8 interface that looks like this will fail in a somewhat unpredictable way.
The only thing it can do is ask for the Xen version. The ABI version is
not
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
being returned by anything (but perhaps should be).
Quoted 4 lines
Given that:
1. When we do check the ioreq server functionality in, what's the correct way to deal with code that wants to use the old interface,
and
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
what do we do with code compiled against the old interface but
running
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
on the new one?
For the full series I'm not sure I can really tell.But as said, for the
rename
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
patch alone I thought it is just a rename. And that's what we want to
get
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
in (see Paul's earlier reply - he wants to see the old name gone, so it
won't
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
be used any further).
Quoted 1 line
2. What's the best thing to do for this release?
If the entire series (no matter whether to go in now or later) is
changing
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
behavior, then the only choice is to consider the currently used enum value burnt, and use a fresh one for the new semantics.
It sounds like that would be best way. If we don't so that then we have
to
Quoted 10 lines
Quoted 10 lines
maintain the write-dm semantics for pages of that type unless the type is claimed (by using the new hypercall) and that's bit icky. I much prefer that pages of the new type are treated as RAM until claimed.
Quoted 3 lines
I think the only sensible way to keep the enum is to also keep the functionality, which would mean using *another* p2m type for
ioreq_server.Quoted 3 lines
Given that the functionality isn't going away for 4.7, I don't see an urgent need to remove the enum; but if Paul does, then a patch
renaming
Quoted 1 line
Quoted 1 line
Quoted 1 line
it to
HVMMEM_unusedwould be the way forward then I guess. Oncethe
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
underlying p2m type goes away, you'll want to return
-EINVALfor this enum value.Quoted 8 lines
Quoted 8 lines
So the enum would be sth. like this?
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 */#if
__XEN_INTERFACE_VERSION__<0x00040700
HVMMEM_mmio_write_dm, /* Read-only; writes go to the devicemodel
Quoted 9 lines
Quoted 7 lines
*/
#else
HVMMEM_unused,
#endif
HVMMEM_ioreq_server
}hvmmem_type_t;I believe that's correct, but presumably there's need to be a change to the
hypervisor since any reference there to
HVMMEM_mmio_write_dm(which I think is limited to the get and set mem type code inhvm.c) will now need to mapHVMMEM_unusedto the oldp2m_mmio_write_dmtype.Quoted 1 line
Thank you, Paul.
But
p2m_mmio_write_dmwill not exist any more...
E.g. if inhvmop_get_mem_type(), if type 0xf(p2m_ioreq_server) is returned, we could just returnHVMMEM_ioreq_server. No need to worry about theHVMMEM_mmio_write_dm.Maybe we only need to change the beginning of
hvmop_set_mem_type()to sth. like this:/* 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, /* this will be rejected later */ [HVMMEM_ioreq_server] = p2m_ioreq_server };Quoted 3 lines
and later in the same routine, just reject the
HVMMEM_unusedtype, in an if(with unlikely) statement.
Quoted 1 line
As long as everyone is in agreement then we can break the functionality that exists in 4.6.1 (and presumably 4.7 now) then that’s ok.
I think we're all in agreement that we can *remove* functionality as long as (from Xen's perspective) it should fail gracefully. Which means that if anyone uses the hvm_mem_type enum value previously allocated do HVMMEM_mmio_write_dm, return an error (one way or another).
The exact method for doing so is up for review.
-George
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 2/3] x86/ioreq server: Rename p2m_mmio_write_dm to p2m_ioreq_server
In reply to Jan BeulichQuoted 10 lines · Jan Beulich
Quoted 8 lines
If it's the case that the only code that uses this is in XenServer, then I'd say the answer to #1 can be simply, "Don't compile" and "Don't do that" respectively; and the answer to #2 can be either "Leave it be" or "Remove the enum from the public interface".
If there are other projects that have started to use this interface, then we need a better answer to #1 than "Compile but fail in unpredicatble ways".
How would we know whether there are other users?
Well we'd wait for them to complain... at which point we would have had a release with an *incompatible* ABI and no way to change it.
So yes, upon consideration, burning the enum value is really the only option. :-)
-George
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 2/3] x86/ioreq server: Rename p2m_mmio_write_dm to p2m_ioreq_server
In reply to Jan Beulichmaintainers,
Thanks for the discussion and sorry for my delayed reply...
Quoted 61 lines · Jan Beulich
Quoted 17 lines
Quoted 1 line
Quoted 1 line
George Dunlap <[email protected]> 04/20/16 6:30 PM >>>
Quoted 15 lines · George Dunlap
Quoted 14 lines · Zhang
So I suppose the only place we need change for this patch is for
hvmmem_type_t, which should be defined like this?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 */#if
__XEN_INTERFACE_VERSION__>=0x00040700
HVMMEM_ioreq_server
#else
HVMMEM_mmio_write_dm
#endif
}hvmmem_type_t;Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
Besides, does 4.7 still accept freeze exception? It would be great if we can get an approval for this.
Wait, do we *actually* need this? Is anyone actually using this?
I'd say remove it, and if anyone complains, *then* do the #ifdef'ery as a bug-fix. I'm pretty sure that's Linux's policy -- You Must Keep Userspace Working, but you can break it to see if anyone complains first.
We don't normally do it like that - we aim at keeping things compatible right away. I don't know of a case where we would have knowingly broken compatibility for users of the public headers (leaving aside tool stack only stuff of course).
Quoted 6 lines
Going further than this:
The proposed patch series not only changes the name, it changes the functionality. We do not want code to *compile* against 4.7 and then not *work* against 4.7; and the worst of all is to compile and sort of work but do it incorrectly.
I had the impression that the renaming patch was what it is - a renaming patch, without altering behavior.
Quoted 4 lines
Does the ioreq server have a way of asking Xen what version of the ABI it's providing? I'm assuming the answer is "no"; in which case code that is compiled against the 4.6 interface but run on a 4.8 interface that looks like this will fail in a somewhat unpredictable way.
The only thing it can do is ask for the Xen version. The ABI version is not being returned by anything (but perhaps should be).
Quoted 6 lines
Given that:
1. When we do check the ioreq server functionality in, what's the correct way to deal with code that wants to use the old interface, and what do we do with code compiled against the old interface but running on the new one?
For the full series I'm not sure I can really tell.But as said, for the rename patch alone I thought it is just a rename. And that's what we want to get in (see Paul's earlier reply - he wants to see the old name gone, so it won't be used any further).
Quoted 6 lines
Quoted 1 line
2. What's the best thing to do for this release?
If the entire series (no matter whether to go in now or later) is changing behavior, then the only choice is to consider the currently used enum value burnt, and use a fresh one for the new semantics.
The 3rd patch in this V2 series do change the semantics of this type.
But IIUC, we have reached an agreement in the discussion of patch 3 that for now, we only support the write emulation, and it shall be no p2m_ioreq_server entries before an ioreq server claimed its ownership. So in my V3 series(nearly finished, not sent out yet), this type shall have the same semantics with the old one.
Besides, I'm sorry, and I do not quite understand what "consider the currently used enum value burnt" means. Any example? :)
Quoted 11 lines
Quoted 8 lines
If it's the case that the only code that uses this is in XenServer, then I'd say the answer to #1 can be simply, "Don't compile" and "Don't do that" respectively; and the answer to #2 can be either "Leave it be" or "Remove the enum from the public interface".
If there are other projects that have started to use this interface, then we need a better answer to #1 than "Compile but fail in unpredicatble ways".
How would we know whether there are other users?
B.R.
Yu
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
PATCH v2 3/3 x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
In reply to Yu ZhangA 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 whether the p2m_ioreq_server is supposed to handle write accesses or read ones or both in a parameter named flags. 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 this p2m type, by triggering this new HVMOP, with ioreq server id set to the current owner's and flags parameter set to 0.
For now, both HVMOP_map_mem_type_to_ioreq_server and p2m_ioreq_server are only supported for HVMs with HAP enabled.
Note that flags parameter(if not 0) of this HVMOP only indicates which kind of memory accesses are to be forwarded to an ioreq server, it has impact on the access rights of guest ram pages, but are not the same. Due to hardware limitations, if only write operations are to be forwarded, read ones will be performed at full speed, with no hypervisor intervention. But if read ones are to be forwarded to an ioreq server, writes will inevitably be trapped into hypervisor, which means significant performance impact.
Also note that this HVMOP_map_mem_type_to_ioreq_server will not change the p2m type of any guest ram page, until HVMOP_set_mem_type is triggered. So normally the steps should be the backend driver first claims its ownership of guest ram pages with p2m_ioreq_server type, and then sets the memory type to p2m_ioreq_server for specified guest ram pages.
--- xen/arch/x86/hvm/emulate.c | 125 +++++++++++++++++++++++++++++++++++++-- xen/arch/x86/hvm/hvm.c | 95 +++++++++++++++++++++++++++-- xen/arch/x86/mm/hap/nested_hap.c | 2 +- xen/arch/x86/mm/p2m-ept.c | 14 ++++- xen/arch/x86/mm/p2m-pt.c | 25 +++++--- xen/arch/x86/mm/p2m.c | 82 +++++++++++++++++++++++++ xen/arch/x86/mm/shadow/multi.c | 3 +- xen/include/asm-x86/p2m.h | 36 +++++++++-- xen/include/public/hvm/hvm_op.h | 37 ++++++++++++ 9 files changed, 395 insertions(+), 24 deletions(-)
xen/arch/x86/hvm/emulate.c +121 -4
@@ -94,11 +94,69 @@ static const struct hvm_io_handler null_handler = { .ops = &null_ops }; +static int mem_read (const struct hvm_io_handler *io_handler, +uint64_t addr, +uint32_t size, +uint64_t *data) +{ +struct domain *currd = current->domain; +unsigned long gmfn =paddr_to_pfn (addr); +unsigned long offset = addr & ~PAGE_MASK ; +struct page_info *page =get_page_from_gfn (currd, gmfn,NULL ,P2M_UNSHARE ); +uint8_t *p; + +if ( !page ) +return X86EMUL_UNHANDLEABLE ; + + p =__map_domain_page (page); + p += offset; +memcpy (data, p, size); + +unmap_domain_page (p); +put_page (page); + +return X86EMUL_OKAY ; +} + +static int mem_write (const struct hvm_io_handler *handler, +uint64_t addr, +uint32_t size, +uint64_t data) +{ +struct domain *currd = current->domain; +unsigned long gmfn =paddr_to_pfn (addr); +unsigned long offset = addr & ~PAGE_MASK ; +struct page_info *page =get_page_from_gfn (currd, gmfn,NULL ,P2M_UNSHARE ); +uint8_t *p; + +if ( !page ) +return X86EMUL_UNHANDLEABLE ; + + p =__map_domain_page (page); + p += offset; +memcpy (p, &data, size); + +unmap_domain_page (p); +put_page (page); + +return X86EMUL_OKAY ; +} + +static const struct hvm_io_ops mem_ops = { + .read = mem_read, + .write = mem_write +}; + +static const struct hvm_io_handler mem_handler = { + .ops = &mem_ops +}; +static int hvmemul_do_io (bool_t is_mmio,paddr_t addr,unsigned long reps,unsigned int size,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 ,
@@ -140,7 +198,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 ;
@@ -168,13 +226,72 @@ 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); + +switch ( p2mt ) + { +case p2m_ioreq_server: + { +unsigned long flags; + +p2m_get_ioreq_server (currd, &flags, &s); + +if ( !s ) +break ; + +if ( (dir ==IOREQ_READ && + !(flags &P2M_IOREQ_HANDLE_READ_ACCESS )) || + (dir ==IOREQ_WRITE && + !(flags &P2M_IOREQ_HANDLE_WRITE_ACCESS )) ) + s =NULL ; + +break ; + } +case p2m_ram_rw: + s =NULL ; +break ; + +default : + s =hvm_select_ioreq_server (currd, &p); +break ; + } + } +else + { + p2mt = p2m_invalid; + + s =hvm_select_ioreq_server (currd, &p); + }/* If there is no suitable backing DM, just ignore accesses */ if ( !s ) { - rc =hvm_process_io_intercept (&null_handler, &p); +switch ( p2mt ) + { +case p2m_ioreq_server: +/* +* Race conditions may exist when access to a gfn with +* p2m_ioreq_server is intercepted by hypervisor, during +* which time p2m type of this gfn is recalculated back +* to p2m_ram_rw. mem_handler is used to handle this +* corner case. +*/ +case p2m_ram_rw: + rc =hvm_process_io_intercept (&mem_handler, &p); +break ; + +default : + rc =hvm_process_io_intercept (&null_handler, &p); +break ; + } + vio->io_req.state =STATE_IOREQ_NONE ; }else
xen/arch/x86/hvm/hvm.c +90 -5
137 lines not on this page · raw message
xen/arch/x86/mm/hap/nested_hap.c +1 -1
@@ -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 +13 -1
@@ -132,6 +132,19 @@ 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 = !(p2m->ioreq.flags &P2M_IOREQ_HANDLE_READ_ACCESS ); +/* +* write access right is disabled when entry->r is 0, but whether +* write accesses are emulated by hypervisor or forwarded to an +* ioreq server depends on the setting of p2m->ioreq.flags. +*/ + entry->w = (entry->r && + !(p2m->ioreq.flags &P2M_IOREQ_HANDLE_WRITE_ACCESS )); + entry->x = entry->r; + 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 +184,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 +18 -7
@@ -72,8 +72,8 @@ static const unsigned long pgt[] = { PGT_l3_page_table }; -static unsigned long p2m_type_to_flags (p2m_type_t t,mfn_t mfn, -unsigned int level) +static unsigned long p2m_type_to_flags (struct p2m_domain *p2m,p2m_type_t t, +mfn_t mfn,unsigned int level) {unsigned long flags;/*
@@ -94,8 +94,18 @@ 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_READ_ACCESS ) +return flags & ~(_PAGE_PRESENT | _PAGE_RW); +else 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 +82 -0
94 lines not on this page · raw message
xen/arch/x86/mm/shadow/multi.c +1 -2
@@ -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/p2m.h +32 -4
@@ -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) \
@@ -120,7 +120,8 @@ typedef unsigned int p2m_query_t;/* Types that can be subject to bulk transitions. */ #define P2M_CHANGEABLE_TYPES (p2m_to_mask(p2m_ram_rw) \ - | p2m_to_mask(p2m_ram_logdirty) ) + | p2m_to_mask(p2m_ram_logdirty) \ + | p2m_to_mask(p2m_ioreq_server) )#define P2M_POD_TYPES (p2m_to_mask(p2m_populate_on_demand))
@@ -320,6 +321,27 @@ 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). +* Behaviors of gfns with p2m_ioreq_server set but no +* ioreq server mapped in advance should be the same as +* p2m_ram_rw. +*/ +struct hvm_ioreq_server *server; +/* +* flags specifies whether read, write or both operations +* are to be emulated by an ioreq server. +*/ +unsigned long 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 +843,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); +void p2m_get_ioreq_server (struct domain *d,unsigned long *flags, +struct hvm_ioreq_server **s); +void p2m_destroy_ioreq_server (struct domain *d,struct hvm_ioreq_server *s); +#endif /* _XEN_P2M_H */ /*
xen/include/public/hvm/hvm_op.h +37 -0
@@ -489,6 +489,43 @@ struct xen_hvm_altp2m_op {typedef struct xen_hvm_altp2m_op xen_hvm_altp2m_op_t ;DEFINE_XEN_GUEST_HANDLE (xen_hvm_altp2m_op_t); +#if defined(__XEN__) || defined(__XEN_TOOLS__) + +/* +* HVMOP_map_mem_type_to_ioreq_server : map or unmap the IOREQ Server <id> +* to specific memroy type <type> +* for specific accesses <flags> +* +* Note that if only write operations are to be forwarded to an ioreq server, +* read operations will be performed with no hypervisor intervention. But if +* flags indicates that read operations are to be forwarded to an ioreq server, +* write operations will inevitably be trapped into hypervisor, whether they +* are emulated by hypervisor or forwarded to ioreq server depends on the flags +* setting. This situation means significant performance impact. +*/ +#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 */ +hvmmem_type_t type;/* IN - memory type */ +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__) */ + +#endif /* __XEN_PUBLIC_HVM_HVM_OP_H__ */ /*
Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
Thanks, Tim.
Quoted 13 lines · Tim Deegan
Quoted 12 lines · 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 typep2m_ioreq_server. Users of this HVMOP can specify whether thep2m_ioreq_serveris supposed to handle write accesses or read ones or both in a parameter named flags. For now, we only support one ioreq server for this p2m type, so once an ioreq server has claimed its ownership, subsequent calls of theHVMOP_map_mem_type_to_ioreq_serverwill fail. Users can also disclaim the ownership of guest ram pages with this p2m type, by triggering this new HVMOP, with ioreq server id set to the current owner's and flags parameter set to 0.
Quoted 6 lines
Quoted 2 lines
For now, both
HVMOP_map_mem_type_to_ioreq_serverandp2m_ioreq_serverare only supported for HVMs with HAP enabled."For now", meaning you intend to make this work on shadow pagetables? :P If not, please just say it's HAP-only.
Well, I have no clear plan in the near future to support this on shadow mode, and I'll change the commit message in next version. :)
Quoted 7 lines
Quoted 7 lines
xen/arch/x86/mm/shadow/multi.c +0
-0@@ -3224,8 +3224,7 @@ static int sh_page_fault(struct vcpu *v, }
Quoted 11 lines
xen/arch/x86/mm/shadow/multi.c static int sh_page_fault(struct vcpu *v, · line 3230
Quoted 7 lines
xen/arch/x86/mm/shadow/multi.c +1
-2/* 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;Acked-by Tim Deegan <[email protected]>
Regards.
Yu
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
In reply to Yu ZhangQuoted 31 lines · 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 typep2m_ioreq_server. Users of this HVMOP can specify whether thep2m_ioreq_serveris supposed to handle write accesses or read ones or both in a parameter named flags. For now, we only support one ioreq server for this p2m type, so once an ioreq server has claimed its ownership, subsequent calls of theHVMOP_map_mem_type_to_ioreq_serverwill fail. Users can also disclaim the ownership of guest ram pages with this p2m type, by triggering this new HVMOP, with ioreq server id set to the current owner's and flags parameter set to 0.For now, both
HVMOP_map_mem_type_to_ioreq_serverandp2m_ioreq_serverare only supported for HVMs with HAP enabled.Note that flags parameter(if not 0) of this HVMOP only indicates which kind of memory accesses are to be forwarded to an ioreq server, it has impact on the access rights of guest ram pages, but are not the same. Due to hardware limitations, if only write operations are to be forwarded, read ones will be performed at full speed, with no hypervisor intervention. But if read ones are to be forwarded to an ioreq server, writes will inevitably be trapped into hypervisor, which means significant performance impact.
Also note that this
HVMOP_map_mem_type_to_ioreq_serverwill not change the p2m type of any guest ram page, untilHVMOP_set_mem_typeis triggered. So normally the steps should be the backend driver first claims its ownership of guest ram pages withp2m_ioreq_servertype, and then sets the memory type top2m_ioreq_serverfor specified guest ram pages.
Quoted 2 lines
Signed-off-by Paul Durrant <[email protected]>Signed-off-by Yu Zhang <[email protected]>
And again, review of this patch was significantly delayed because you didn't provide any description of the changes you made between v1 and v2 or why.
Overall looks good. Just a few questions...
Quoted 11 lines
xen/arch/x86/hvm/hvm.c +11
-0+static int hvmop_map_mem_type_to_ioreq_server ( +XEN_GUEST_HANDLE_PARAM (xen_hvm_map_mem_type_to_ioreq_server_t) uop) +{ +xen_hvm_map_mem_type_to_ioreq_server_t op; +struct domain *d; +int rc; + +if (copy_from_guest (&op, uop,1 ) ) +return -EFAULT ; + + rc =rcu_lock_remote_domain_by_id (op.domid, &d);
xen/arch/x86/hvm/hvm.c static int hvmop_unmap_io_range_from_ioreq_server( · line 6045
Quoted 10 lines
xen/arch/x86/hvm/hvm.c +10
-0+if ( rc !=0 ) +return rc; + + rc = -EINVAL ; +if ( !is_hvm_domain (d) ) + goto out; + +/* For now, only support for HAP enabled hvm */ +if ( !hap_enabled (d) ) + goto out;
So before I suggested that this be restricted to HAP because you were using p2m_memory_type_changed(), which was only implemented on EPT. But since then you've switched that code to use p2m_change_entry_type_global() instead, which is implemented by both; and you implement the type in p2m_type_to_flags(). Is there any reason to keep this restriction?
xen/arch/x86/mm/p2m.c void p2m_memory_type_changed(struct domain *d) · line 328
Quoted 6 lines
xen/arch/x86/mm/p2m.c +6
-0+/* +* Each time we map/unmap an ioreq server to/from p2m_ioreq_server, +* we mark the p2m table to be recalculated, so that gfns which were +* previously marked with p2m_ioreq_server can be resynced. +*/ +p2m_change_entry_type_global (d, p2m_ioreq_server, p2m_ram_rw);
This comment doesn't seem to be accurate (or if it is it's a bit confusing). Would it be more accurate to say something like the following:
"Each time we map / unmap in ioreq server to/from p2m_ioreq_server, we reset all memory currently marked p2m_ioreq_server to p2m_ram_rw."
But of course that raises another question: is there ever any risk that an ioreq server will change some other ram type (say, p2m_ram_ro) to p2m_ioreq_server, and then have it changed back to p2m_ram_rw when it detaches?
xen/include/asm-x86/p2m.h typedef unsigned int p2m_query_t; · line 124
Quoted 5 lines
/* Types that can be subject to bulk transitions. */ #define
P2M_CHANGEABLE_TYPES(p2m_to_mask(p2m_ram_rw)\xen/include/asm-x86/p2m.h +2
-1- | p2m_to_mask(p2m_ram_logdirty) ) + | p2m_to_mask(p2m_ram_logdirty) \ + | p2m_to_mask(p2m_ioreq_server) )
It's probably worth a comment here noting that you can do a mass change *from* p2m_ioreq_server, but you can't do a mass change *to* p2m_ioreq_server. (And doing so would need to change a number of places in the code where it's assumed that the result of such a recalculation is either p2m_logdirty or p2m_ram_rw -- e.g., p2m-ept.c:553, p2m-pt.c:452, &c.
Really getting down to the fine details here -- thanks for all your work on this.
-George
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
Thanks for your advices and good questions. :)
Quoted 32 lines · George Dunlap
Quoted 31 lines · 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 typep2m_ioreq_server. Users of this HVMOP can specify whether thep2m_ioreq_serveris supposed to handle write accesses or read ones or both in a parameter named flags. For now, we only support one ioreq server for this p2m type, so once an ioreq server has claimed its ownership, subsequent calls of theHVMOP_map_mem_type_to_ioreq_serverwill fail. Users can also disclaim the ownership of guest ram pages with this p2m type, by triggering this new HVMOP, with ioreq server id set to the current owner's and flags parameter set to 0.For now, both
HVMOP_map_mem_type_to_ioreq_serverandp2m_ioreq_serverare only supported for HVMs with HAP enabled.Note that flags parameter(if not 0) of this HVMOP only indicates which kind of memory accesses are to be forwarded to an ioreq server, it has impact on the access rights of guest ram pages, but are not the same. Due to hardware limitations, if only write operations are to be forwarded, read ones will be performed at full speed, with no hypervisor intervention. But if read ones are to be forwarded to an ioreq server, writes will inevitably be trapped into hypervisor, which means significant performance impact.
Also note that this
HVMOP_map_mem_type_to_ioreq_serverwill not change the p2m type of any guest ram page, untilHVMOP_set_mem_typeis triggered. So normally the steps should be the backend driver first claims its ownership of guest ram pages withp2m_ioreq_servertype, and then sets the memory type top2m_ioreq_serverfor specified guest ram pages.
Quoted 6 lines
Quoted 2 lines
Signed-off-by Paul Durrant <[email protected]>Signed-off-by Yu Zhang <[email protected]>And again, review of this patch was significantly delayed because you didn't provide any description of the changes you made between v1 and v2 or why.
Sorry about the inconvenience, will change in next version.
Quoted 23 lines
Overall looks good. Just a few questions...
Quoted 20 lines
xen/arch/x86/hvm/hvm.c +20
-0+static int hvmop_map_mem_type_to_ioreq_server ( +XEN_GUEST_HANDLE_PARAM (xen_hvm_map_mem_type_to_ioreq_server_t) uop) +{ +xen_hvm_map_mem_type_to_ioreq_server_t op; +struct domain *d; +int rc; + +if (copy_from_guest (&op, uop,1 ) ) +return -EFAULT ; + + rc =rcu_lock_remote_domain_by_id (op.domid, &d); +if ( rc !=0 ) +return rc; + + rc = -EINVAL ; +if ( !is_hvm_domain (d) ) + goto out; + +/* For now, only support for HAP enabled hvm */ +if ( !hap_enabled (d) )
Quoted 9 lines
Quoted 1 line
+ goto out;
So before I suggested that this be restricted to HAP because you were using
p2m_memory_type_changed(), which was only implemented on EPT. But since then you've switched that code to usep2m_change_entry_type_global()instead, which is implemented by both; and you implement the type inp2m_type_to_flags(). Is there any reason to keep this restriction?
Yes. And this is a change which was not explained clearly. Sorry.
Reason I've chosen p2m_change_entry_type_global() instead:p2m_memory_type_changed() will only trigger the resynchronization for the ept memory types in resolve_misconfig(). Yet it is the p2m type we wanna to be recalculated, so here comes p2m_change_entry_type_global().
Reasons I restricting the code in HAP mode:
Well, I guess p2m_change_entry_type_global() was only called by HAP code like hap_[en|dis]able_log_dirty() etc, which were registered during hap_domain_init(). As to shadow mode, it is sh_[en|dis]able_log_dirty(), which do not use p2m_change_entry_type_global().
Since my intention is to resync the outdated p2m_ioreq_server pages back to p2m_ram_rw, calling p2m_change_entry_global() directly should be much more convenient(and correct) for me than inventing another wrapper to cover both the HAP and shadow mode(which xengt does not use by now).
Quoted 7 lines
xen/arch/x86/mm/p2m.c void p2m_memory_type_changed(struct domain *d) · line 328
Quoted 6 lines
xen/arch/x86/mm/p2m.c +6
-0+/* +* Each time we map/unmap an ioreq server to/from p2m_ioreq_server, +* we mark the p2m table to be recalculated, so that gfns which were +* previously marked with p2m_ioreq_server can be resynced. +*/ +p2m_change_entry_type_global (d, p2m_ioreq_server, p2m_ram_rw);
Quoted 7 lines
This comment doesn't seem to be accurate (or if it is it's a bit confusing). Would it be more accurate to say something like the following:
"Each time we map / unmap in ioreq server to/from
p2m_ioreq_server, we reset all memory currently markedp2m_ioreq_servertop2m_ram_rw."
Well, I agree this comment is not quite accurate. Like you said in your comment, the purpose here, calling p2m_change_entry_type_global() is to "reset all memory currently marked p2m_ioreq_server to p2m_ram_rw". But the recalculation is asynchronous. So how about:
"Each time we map/unmap an ioreq server to/from p2m_ioreq_server, we mark the p2m table to be recalculated, so all memory currently marked p2m_ioreq_server can be reset to p2m_ram_rw later."?
Quoted 5 lines
But of course that raises another question: is there ever any risk that an ioreq server will change some other ram type (say,
p2m_ram_ro) top2m_ioreq_server, and then have it changed back top2m_ram_rwwhen it detaches?
Good question. And unfortunately, yes there is. :) Maybe we should insist only p2m_ram_rw pages can be changed to p2m_ioreq_server, and vice versa.
Quoted 6 lines
xen/include/asm-x86/p2m.h typedef unsigned int p2m_query_t; · line 124
Quoted 5 lines
/* Types that can be subject to bulk transitions. */ #define
P2M_CHANGEABLE_TYPES(p2m_to_mask(p2m_ram_rw)\xen/include/asm-x86/p2m.h +2
-1- | p2m_to_mask(p2m_ram_logdirty) ) + | p2m_to_mask(p2m_ram_logdirty) \ + | p2m_to_mask(p2m_ioreq_server) )
Quoted 7 lines
It's probably worth a comment here noting that you can do a mass change *from*
p2m_ioreq_server, but you can't do a mass change *to*p2m_ioreq_server. (And doing so would need to change a number of places in the code where it's assumed that the result of such a recalculation is eitherp2m_logdirtyorp2m_ram_rw-- e.g., p2m-ept.c:553, p2m-pt.c:452, &c.
I agree with adding a note here.
But adding extra code in resolve_miconfig()/do_recalc()? Is this necessary? IIUC, current code already guarantees there will be no mass change *to* the p2m_ioreq_server.
Quoted 5 lines
Really getting down to the fine details here -- thanks for all your work on this.
-George
B.R.
Yu
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
A message that is not in the archive (sent off-list or not yet received): CAFLBxZbLp2zWzCzQTaJNWbanQSmTJ57ZyTh0qaD-+YUn8o8pyQ@mail.gmail.com
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
Oops -- forgot to CC the list...
Quoted 136 lines · George Dunlap
Quoted 20 lines · Zhang
Quoted 5 lines
xen/arch/x86/hvm/hvm.c static int hvmop_unmap_io_range_from_ioreq_server( · line 6045
Quoted 3 lines
xen/arch/x86/hvm/hvm.c +3
-0+/* For now, only support for HAP enabled hvm */ +if ( !hap_enabled (d) ) + goto out;Quoted 7 lines
So before I suggested that this be restricted to HAP because you were using
p2m_memory_type_changed(), which was only implemented on EPT. But since then you've switched that code to usep2m_change_entry_type_global()instead, which is implemented by both; and you implement the type inp2m_type_to_flags(). Is there any reason to keep this restriction?Yes. And this is a change which was not explained clearly. Sorry.
Reason I've chosen
p2m_change_entry_type_global()instead:p2m_memory_type_changed()will only trigger the resynchronization for the ept memory types inresolve_misconfig(). Yet it is the p2m type we wanna to be recalculated, so here comesp2m_change_entry_type_global().Quoted 5 lines
Reasons I restricting the code in HAP mode:
Well, I guessp2m_change_entry_type_global()was only called by HAP code like hap_[en|dis]able_log_dirty() etc, which were registered duringhap_domain_init(). As to shadow mode, it is sh_[en|dis]able_log_dirty(), which do not usep2m_change_entry_type_global().Oh, right -- yes, there's an ASSERT(hap_enabled()) right at the top of
p2m_pt_change_entry_type_global().Yes, if that functionality is not already implemented for shadow, there's no need for you to implement it; and restricting it to HAP-only is the obvious solution.
Quoted 15 lines
Quoted 8 lines
xen/arch/x86/mm/p2m.c void p2m_memory_type_changed(struct domain *d) · line 328
Quoted 6 lines
xen/arch/x86/mm/p2m.c +6
-0+/* +* Each time we map/unmap an ioreq server to/from p2m_ioreq_server, +* we mark the p2m table to be recalculated, so that gfns which were +* previously marked with p2m_ioreq_server can be resynced. +*/ +p2m_change_entry_type_global (d, p2m_ioreq_server, p2m_ram_rw);Quoted 7 lines
This comment doesn't seem to be accurate (or if it is it's a bit confusing). Would it be more accurate to say something like the following:
"Each time we map / unmap in ioreq server to/from
p2m_ioreq_server, we reset all memory currently markedp2m_ioreq_servertop2m_ram_rw."Quoted 8 lines
Well, I agree this comment is not quite accurate. Like you said in your comment, the purpose here, calling
p2m_change_entry_type_global()is to "reset all memory currently markedp2m_ioreq_servertop2m_ram_rw". But the recalculation is asynchronous. So how about:"Each time we map/unmap an ioreq server to/from
p2m_ioreq_server, we mark the p2m table to be recalculated, so all memory currently markedp2m_ioreq_servercan be reset top2m_ram_rwlater."?I think we're emphasizing different things -- I'm emphasizing what the change will be, and you're emphasizing when the change will happen. :-)
I think from the point of view of someone reading this code, it doesn't matter when the physical p2m entries get updated; *logically* they are updated now, since from this call onward anything that reads the p2m table will get the new type. The fact that we do it lazily is an implementation detail -- we could change the function behind the scenes to do it all at once, and the semantics would be the same (it would just cause a long change all at once).
If you really want to include when the change will happen, what about this:
"Each time we map / unmap in ioreq server to/from
p2m_ioreq_server, we reset all memory currently markedp2m_ioreq_servertop2m_ram_rw. (This happens lazily as the p2m entries are accessed.)"BTW, I think this also means that for the interface at the moment, you can't change the kinds of accesses you want to intercept very easily -- if you want to change from intercepting only writes to intercepting both reads and writes, you have to detach from the
ioreq_servertype completely (which will make all your currently-markedioreq_serverpages go back toram_rw), then attach again, and re-mark all the pages you were watching.Which is perhaps not perfect, but I suppose it will do. It should even be possible to change this in the future -- ioreq servers that want to change the access mode can try just changing it directly, and if they get
-EBUSY, do it the hard way.(Just to be clear, I'm thinking out loud here in the last two paragraphs -- no action required unless you feel like it.)
Quoted 8 lines
Quoted 5 lines
But of course that raises another question: is there ever any risk that an ioreq server will change some other ram type (say,
p2m_ram_ro) top2m_ioreq_server, and then have it changed back top2m_ram_rwwhen it detaches?Good question. And unfortunately, yes there is. :) Maybe we should insist only
p2m_ram_rwpages can be changed top2m_ioreq_server, and vice versa.Well I think if you only allow
p2m_ram_rwpages to be changed top2m_ioreq_server, that should be sufficient. If that works for you it seems like it could be a reasonable approach.Quoted 15 lines
Quoted 8 lines
xen/include/asm-x86/p2m.h typedef unsigned int p2m_query_t; · line 124
Quoted 6 lines
/* Types that can be subject to bulk transitions. */ #define
P2M_CHANGEABLE_TYPES(p2m_to_mask(p2m_ram_rw)\xen/include/asm-x86/p2m.h +2
-1- | p2m_to_mask(p2m_ram_logdirty) ) + | p2m_to_mask(p2m_ram_logdirty) \ + | p2m_to_mask(p2m_ioreq_server) )Quoted 7 lines
It's probably worth a comment here noting that you can do a mass change *from*
p2m_ioreq_server, but you can't do a mass change *to*p2m_ioreq_server. (And doing so would need to change a number of places in the code where it's assumed that the result of such a recalculation is eitherp2m_logdirtyorp2m_ram_rw-- e.g., p2m-ept.c:553, p2m-pt.c:452, &c.Quoted 4 lines
I agree with adding a note here.
But adding extra code in resolve_miconfig()/do_recalc()? Is this necessary? IIUC, current code already guarantees there will be no mass change *to* thep2m_ioreq_server.Sorry -- in this context, when I said "And doing so would need...", I meant, "And also note in your comment that if someone wanted to do a mass change to
p2m_ioreq_server, they would need to change..." That is, was suggesting you write a comment giving a hint to people in the future about the limitations, not add any code yourself. :-)But maybe it would actually be better to add an
ASSERT(nt != p2m_ioreq_server)top2m_change_entry_type_global(), with a comment saying that much of the lazy recalc code assumes being changed into onlyram_logdirtyorram_rw?
Quoted 6 lines
And then of course there's the
p2m_ioreq_server->p2m_ram_logdirtytransition -- I assume that live migration is incompatible with this functionality? Is there anything that prevents a live migration from being started when there are outstandingp2m_ioreq_serverentries?-George
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
On 08/04/16 11:10, Yu, Zhang wrote:
[snip]
Quoted 2 lines
BTW, I noticed your reply has not be CCed to mailing list, and I also wonder if we should raise this last question in community?
Oops -- that was a mistake on my part. :-) I appreciate the discretion; just so you know in the future, if I'm purposely changing the CC list (removing xen-devel and/or adding extra people), I'll almost always say so at the top of the mail.
Quoted 25 lines
Quoted 5 lines
And then of course there's the
p2m_ioreq_server->p2m_ram_logdirtytransition -- I assume that live migration is incompatible with this functionality? Is there anything that prevents a live migration from being started when there are outstandingp2m_ioreq_serverentries?Another good question, and the answer is unfortunately yes. :-)
If live migration happens during the normal emulation process, entries marked with
p2m_ioreq_serverwill be changed top2m_log_dirtyinresolve_misconfig(), and later write operations will change them top2m_ram_rw, thereafter these pages can not be forwarded to device model. From this point of view, this functionality is incompatible with live migration.But for XenGT, I think this is acceptable, because, if live migration is to be supported in the future, intervention from backend device model will be necessary. At that time, we can guarantee from the device model side that there's no outdated
p2m_ioreq_serverentries, hence no need to reset the p2m type back top2m_ram_rw(and do not include p2m_ioreq_server in the P2M_CHANGEABLE_TYPES). By "outdated", I mean when an ioreq server is detached fromp2m_ioreq_server, or before an ioreq server is attached to this type, entries marked withp2m_ioreq_servershould be regarded as outdated.
Quoted 1 line
Is this acceptible to you? Any suggestions?
So the question is, as of this series, what happens if someone tries to initiate a live migration while there are outstanding p2m_ioreq_server entries?
If the answer is "the ioreq server suddenly loses all control of the memory", that's something that needs to be changed.
If the answer is, "everything just works", that's perfect.
If the answer is, "Before logdirty mode is set, the ioreq server has the opportunity to detach, removing the p2m_ioreq_server entries, and operating without that functionality", that's good too.
If the answer is, "the live migration request fails and the guest continues to run", that's also acceptable. If you want this series to be checked in today (the last day for 4.7), this is probably your best bet.
-George
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
Quoted 35 lines · George Dunlap
On 08/04/16 11:10, Yu, Zhang wrote:
[snip]Quoted 2 lines
BTW, I noticed your reply has not be CCed to mailing list, and I also wonder if we should raise this last question in community?
Oops -- that was a mistake on my part. :-) I appreciate the discretion; just so you know in the future, if I'm purposely changing the CC list (removing xen-devel and/or adding extra people), I'll almost always say so at the top of the mail.
Quoted 25 lines
Quoted 5 lines
And then of course there's the
p2m_ioreq_server->p2m_ram_logdirtytransition -- I assume that live migration is incompatible with this functionality? Is there anything that prevents a live migration from being started when there are outstandingp2m_ioreq_serverentries?Another good question, and the answer is unfortunately yes. :-)
If live migration happens during the normal emulation process, entries marked with
p2m_ioreq_serverwill be changed top2m_log_dirtyinresolve_misconfig(), and later write operations will change them top2m_ram_rw, thereafter these pages can not be forwarded to device model.
From this point of view, this functionality is incompatible with live
migration.But for XenGT, I think this is acceptable, because, if live migration is to be supported in the future, intervention from backend device model will be necessary. At that time, we can guarantee from the device model side that there's no outdated
p2m_ioreq_serverentries, hence no need to reset the p2m type back top2m_ram_rw(and do not include p2m_ioreq_server in the P2M_CHANGEABLE_TYPES). By "outdated", I mean when an ioreq server is detached fromp2m_ioreq_server, or before an ioreq server is attached to this type, entries marked withp2m_ioreq_servershould be regarded as outdated.
Quoted 9 lines
Quoted 1 line
Is this acceptible to you? Any suggestions?
So the question is, as of this series, what happens if someone tries to initiate a live migration while there are outstanding
p2m_ioreq_serverentries?If the answer is "the ioreq server suddenly loses all control of the memory", that's something that needs to be changed.
Sorry, for this patch series, I'm afraid the above description is the answer.
Besides, I find it's hard to change current code to both support the deferred resetting of p2m_ioreq_server and the live migration at the same time. One reason is that a page with p2m_ioreq_server behaves differently in different situations.
My assumption of XenGT is that, for live migration to work, the device model should guarantee there's no outstanding p2m_ioreq_server pages in hypervisor(no need to use the deferred recalculation), and it is our device model who should be responsible for the copying of the write protected guest pages later.
And another solution I can think of: when unmapping the ioreq server, we walk the p2m table and reset entries with p2m_ioreq_server back directly, instead of deferring the reset. And of course, this means performance impact. But since the mapping and unmapping of an ioreq server is not a frequent one, the performance penalty may be acceptable. How do you think about this approach?
Quoted 6 lines
If the answer is, "everything just works", that's perfect.
If the answer is, "Before logdirty mode is set, the ioreq server has the opportunity to detach, removing the
p2m_ioreq_serverentries, and operating without that functionality", that's good too.
Quoted 8 lines
If the answer is, "the live migration request fails and the guest continues to run", that's also acceptable. If you want this series to be checked in today (the last day for 4.7), this is probably your best bet.
-George
B.R.
Yu
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
Quoted 62 lines · Zhang
Quoted 35 lines · George Dunlap
On 08/04/16 11:10, Yu, Zhang wrote:
[snip]Quoted 2 lines
BTW, I noticed your reply has not be CCed to mailing list, and I also wonder if we should raise this last question in community?
Oops -- that was a mistake on my part. :-) I appreciate the discretion; just so you know in the future, if I'm purposely changing the CC list (removing xen-devel and/or adding extra people), I'll almost always say so at the top of the mail.
Quoted 25 lines
Quoted 5 lines
And then of course there's the
p2m_ioreq_server->p2m_ram_logdirtytransition -- I assume that live migration is incompatible with this functionality? Is there anything that prevents a live migration from being started when there are outstandingp2m_ioreq_serverentries?Another good question, and the answer is unfortunately yes. :-)
If live migration happens during the normal emulation process, entries marked with
p2m_ioreq_serverwill be changed top2m_log_dirtyinresolve_misconfig(), and later write operations will change them top2m_ram_rw, thereafter these pages can not be forwarded to device model.
From this point of view, this functionality is incompatible with live
migration.But for XenGT, I think this is acceptable, because, if live migration is to be supported in the future, intervention from backend device model will be necessary. At that time, we can guarantee from the device model side that there's no outdated
p2m_ioreq_serverentries, hence no need to reset the p2m type back top2m_ram_rw(and do not include p2m_ioreq_server in the P2M_CHANGEABLE_TYPES). By "outdated", I mean when an ioreq server is detached fromp2m_ioreq_server, or before an ioreq server is attached to this type, entries marked withp2m_ioreq_servershould be regarded as outdated.Quoted 9 lines
Quoted 1 line
Is this acceptible to you? Any suggestions?
So the question is, as of this series, what happens if someone tries to initiate a live migration while there are outstanding
p2m_ioreq_serverentries?If the answer is "the ioreq server suddenly loses all control of the memory", that's something that needs to be changed.
Sorry, for this patch series, I'm afraid the above description is the answer.
Besides, I find it's hard to change current code to both support the deferred resetting of
p2m_ioreq_serverand the live migration at the same time. One reason is that a page withp2m_ioreq_serverbehaves differently in different situations.My assumption of XenGT is that, for live migration to work, the device model should guarantee there's no outstanding
p2m_ioreq_serverpages in hypervisor(no need to use the deferred recalculation), and it is our device model who should be responsible for the copying of the write protected guest pages later.
Quoted 7 lines
And another solution I can think of: when unmapping the ioreq server, we walk the p2m table and reset entries with
p2m_ioreq_serverback directly, instead of deferring the reset. And of course, this means performance impact. But since the mapping and unmapping of an ioreq server is not a frequent one, the performance penalty may be acceptable. How do you think about this approach?
George, sorry to bother you. Any comments on above option? :)
Another choice might be to let live migration fail if there's outstanding p2m_ioreq_server entries. But I'm not quite inclined to do so, because:
1> I'd still like to keep live migration feature for XenGT. 2> Not easy to know if there's outstanding p2m_ioreq_server entries. I mean, since p2m type change is not only triggered by hypercall, to keep a counter for remaining p2m_ioreq_server entries means a lot code changes;
Besides, I wonder whether the requirement to reset the p2m_ioreq_server is indispensable, could we let the device model side to be responsible for this? The worst case I can imagine for device model failing to do so is that operations of a gfn might be delivered to a wrong device model. I'm not clear what kind of damage would this cause to the hypervisor or other VM.
Does any other maintainers have any suggestions?
Thanks in advance! :)
Quoted 11 lines
Quoted 11 lines
If the answer is, "everything just works", that's perfect.
If the answer is, "Before logdirty mode is set, the ioreq server has the opportunity to detach, removing the
p2m_ioreq_serverentries, and operating without that functionality", that's good too.If the answer is, "the live migration request fails and the guest continues to run", that's also acceptable. If you want this series to be checked in today (the last day for 4.7), this is probably your best bet.
Quoted 5 lines
Quoted 4 lines
-George
Regards
Yu
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
Quoted 95 lines
-----Original Message-----
From: Yu, Zhang [mailto:[email protected]]
Sent: 14 April 2016 11:45
To: George Dunlap; Paul Durrant; [email protected]
Cc: Jan Beulich; Kevin Tian; Andrew Cooper; Lv, Zhiyuan; Tim (Xen.org); [email protected]
Subject: Re: [Xen-devel] [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram withp2m_ioreq_serverto an ioreq serverQuoted 8 lines · Zhang
Quoted 5 lines · George Dunlap
On 08/04/16 11:10, Yu, Zhang wrote:
[snip]Quoted 2 lines
BTW, I noticed your reply has not be CCed to mailing list, and I also wonder if we should raise this last question in community?
Quoted 6 lines
Quoted 6 lines
Oops -- that was a mistake on my part. :-) I appreciate the discretion; just so you know in the future, if I'm purposely changing the CC list (removing xen-devel and/or adding extra people), I'll almost always say so at the top of the mail.
Quoted 1 line
Quoted 1 line
And then of course there's the
p2m_ioreq_server->
p2m_ram_logdirtyQuoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 4 lines
transition -- I assume that live migration is incompatible with this functionality? Is there anything that prevents a live migration from being started when there are outstanding
p2m_ioreq_serverentries?Another good question, and the answer is unfortunately yes. :-)
If live migration happens during the normal emulation process, entries marked with
p2m_ioreq_serverwill be changed top2m_log_dirtyinresolve_misconfig(), and later write operations will change them top2m_ram_rw, thereafter these pages can not be forwarded to devicemodel.
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
From this point of view, this functionality is incompatible with live
migration.But for XenGT, I think this is acceptable, because, if live migration is to be supported in the future, intervention from backend device model will be necessary. At that time, we can guarantee from the device model side that there's no outdated
p2m_ioreq_serverentries, henceno
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
need to reset the p2m type back to
p2m_ram_rw(and do not include p2m_ioreq_server in the P2M_CHANGEABLE_TYPES). By "outdated", Imean
Quoted 28 lines
Quoted 4 lines
Quoted 4 lines
when an ioreq server is detached from
p2m_ioreq_server, or before an ioreq server is attached to this type, entries marked withp2m_ioreq_servershould be regarded as outdated.Quoted 9 lines
Quoted 1 line
Is this acceptible to you? Any suggestions?
So the question is, as of this series, what happens if someone tries to initiate a live migration while there are outstanding
p2m_ioreq_serverentries?If the answer is "the ioreq server suddenly loses all control of the memory", that's something that needs to be changed.
Sorry, for this patch series, I'm afraid the above description is the answer.
Besides, I find it's hard to change current code to both support the deferred resetting of
p2m_ioreq_serverand the live migration at the same time. One reason is that a page withp2m_ioreq_serverbehaves differently in different situations.My assumption of XenGT is that, for live migration to work, the device model should guarantee there's no outstanding
p2m_ioreq_serverpages in hypervisor(no need to use the deferred recalculation), and it is our device model who should be responsible for the copying of the write protected guest pages later.Quoted 7 lines
And another solution I can think of: when unmapping the ioreq server, we walk the p2m table and reset entries with
p2m_ioreq_serverback directly, instead of deferring the reset. And of course, this means performance impact. But since the mapping and unmapping of an ioreq server is not a frequent one, the performance penalty may be acceptable. How do you think about this approach?George, sorry to bother you. Any comments on above option? :)
Another choice might be to let live migration fail if there's outstanding
p2m_ioreq_serverentries. But I'm not quite inclined to do so, because:
1> I'd still like to keep live migration feature for XenGT. 2> Not easy to know if there's outstandingp2m_ioreq_serverentries. I mean, since p2m type change is not only triggered by hypercall, to keep a counter for remainingp2m_ioreq_serverentries means a lot code changes;
Quoted 8 lines
Besides, I wonder whether the requirement to reset the
p2m_ioreq_serveris indispensable, could we let the device model side to be responsible for this? The worst case I can imagine for device model failing to do so is that operations of a gfn might be delivered to a wrong device model. I'm not clear what kind of damage would this cause to the hypervisor or other VM.Does any other maintainers have any suggestions?
Note that it is a requirement that an ioreq server be disabled before VM suspend. That means ioreq server pages essentially have to go back to ram_rw semantics.
Paul
Quoted 12 lines
Thanks in advance! :)
Quoted 11 lines
Quoted 11 lines
If the answer is, "everything just works", that's perfect.
If the answer is, "Before logdirty mode is set, the ioreq server has the opportunity to detach, removing the
p2m_ioreq_serverentries, and operating without that functionality", that's good too.If the answer is, "the live migration request fails and the guest continues to run", that's also acceptable. If you want this series to be checked in today (the last day for 4.7), this is probably your best bet.
Quoted 8 lines
Quoted 5 lines
Quoted 4 lines
-George
Regards
Yu
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
Quoted 102 lines · Paul Durrant
Quoted 102 lines
-----Original Message-----
From: Yu, Zhang [mailto:[email protected]]
Sent: 14 April 2016 11:45
To: George Dunlap; Paul Durrant; [email protected]
Cc: Jan Beulich; Kevin Tian; Andrew Cooper; Lv, Zhiyuan; Tim (Xen.org); [email protected]
Subject: Re: [Xen-devel] [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram withp2m_ioreq_serverto an ioreq serverQuoted 8 lines · Zhang
Quoted 5 lines · George Dunlap
On 08/04/16 11:10, Yu, Zhang wrote:
[snip]Quoted 2 lines
BTW, I noticed your reply has not be CCed to mailing list, and I also wonder if we should raise this last question in community?
Quoted 6 lines
Quoted 6 lines
Oops -- that was a mistake on my part. :-) I appreciate the discretion; just so you know in the future, if I'm purposely changing the CC list (removing xen-devel and/or adding extra people), I'll almost always say so at the top of the mail.
Quoted 1 line
Quoted 1 line
And then of course there's the
p2m_ioreq_server->
p2m_ram_logdirtyQuoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 4 lines
transition -- I assume that live migration is incompatible with this functionality? Is there anything that prevents a live migration from being started when there are outstanding
p2m_ioreq_serverentries?Another good question, and the answer is unfortunately yes. :-)
If live migration happens during the normal emulation process, entries marked with
p2m_ioreq_serverwill be changed top2m_log_dirtyinresolve_misconfig(), and later write operations will change them top2m_ram_rw, thereafter these pages can not be forwarded to devicemodel.
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
From this point of view, this functionality is incompatible with live
migration.But for XenGT, I think this is acceptable, because, if live migration is to be supported in the future, intervention from backend device model will be necessary. At that time, we can guarantee from the device model side that there's no outdated
p2m_ioreq_serverentries, henceno
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
need to reset the p2m type back to
p2m_ram_rw(and do not include p2m_ioreq_server in the P2M_CHANGEABLE_TYPES). By "outdated", Imean
Quoted 28 lines
Quoted 4 lines
Quoted 4 lines
when an ioreq server is detached from
p2m_ioreq_server, or before an ioreq server is attached to this type, entries marked withp2m_ioreq_servershould be regarded as outdated.Quoted 9 lines
Quoted 1 line
Is this acceptible to you? Any suggestions?
So the question is, as of this series, what happens if someone tries to initiate a live migration while there are outstanding
p2m_ioreq_serverentries?If the answer is "the ioreq server suddenly loses all control of the memory", that's something that needs to be changed.
Sorry, for this patch series, I'm afraid the above description is the answer.
Besides, I find it's hard to change current code to both support the deferred resetting of
p2m_ioreq_serverand the live migration at the same time. One reason is that a page withp2m_ioreq_serverbehaves differently in different situations.My assumption of XenGT is that, for live migration to work, the device model should guarantee there's no outstanding
p2m_ioreq_serverpages in hypervisor(no need to use the deferred recalculation), and it is our device model who should be responsible for the copying of the write protected guest pages later.Quoted 7 lines
And another solution I can think of: when unmapping the ioreq server, we walk the p2m table and reset entries with
p2m_ioreq_serverback directly, instead of deferring the reset. And of course, this means performance impact. But since the mapping and unmapping of an ioreq server is not a frequent one, the performance penalty may be acceptable. How do you think about this approach?George, sorry to bother you. Any comments on above option? :)
Another choice might be to let live migration fail if there's outstanding
p2m_ioreq_serverentries. But I'm not quite inclined to do so, because:
1> I'd still like to keep live migration feature for XenGT. 2> Not easy to know if there's outstandingp2m_ioreq_serverentries. I mean, since p2m type change is not only triggered by hypercall, to keep a counter for remainingp2m_ioreq_serverentries means a lot code changes;Besides, I wonder whether the requirement to reset the
p2m_ioreq_serveris indispensable, could we let the device model side to be responsible for this? The worst case I can imagine for device model failing to do so is that operations of a gfn might be delivered to a wrong device model. I'm not clear what kind of damage would this cause to the hypervisor or other VM.
Quoted 6 lines
Quoted 1 line
Does any other maintainers have any suggestions?
Note that it is a requirement that an ioreq server be disabled before VM suspend. That means ioreq server pages essentially have to go back to
ram_rwsemantics.Paul
OK. So it should be hypervisor's responsibility to do the resetting. Now we probably have 2 choices:
1> we reset the p2m type synchronously when ioreq server unmapping happens, instead of deferring to the misconfig handling part. This means performance impact to traverse the p2m table.
Or
2> we just disallow live migration when p2m->ioreq.server is not NULL. This is not quite accurate, because having p2m->ioreq.server mapped to p2m_ioreq_server does not necessarily means there would be such outstanding entries. To be more accurate, we can add some other rough check, e.g. both check if p2m->ioreq.server against NULL and check if the hvmop_set_mem_type has ever been triggered once for the p2m_ioreq_server type.
Both choice seems suboptimal for me. And I wonder if we have any better solutions?
Thanks
Yu
Quoted 18 lines
Quoted 18 lines
Thanks in advance! :)
Quoted 16 lines
Quoted 15 lines
If the answer is, "everything just works", that's perfect.
If the answer is, "Before logdirty mode is set, the ioreq server has the opportunity to detach, removing the
p2m_ioreq_serverentries, and operating without that functionality", that's good too.If the answer is, "the live migration request fails and the guest continues to run", that's also acceptable. If you want this series to be checked in today (the last day for 4.7), this is probably your best bet.
-George
Quoted 7 lines
Quoted 2 lines
Regards
Yu_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
Quoted 1 line
-----Original Message-----
[snip]
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Does any other maintainers have any suggestions?
Note that it is a requirement that an ioreq server be disabled before VM
suspend. That means ioreq server pages essentially have to go back to
ram_rwsemantics.Quoted 1 line
Quoted 9 lines
Quoted 2 lines
Paul
OK. So it should be hypervisor's responsibility to do the resetting. Now we probably have 2 choices:
1> we reset the p2m type synchronously when ioreq server unmapping happens, instead of deferring to the misconfig handling part. This means performance impact to traverse the p2m table.
Do we need to reset at all. The p2m type does need to be transferred, it will just be unclaimed on the far end (i.e. the pages are treated as r/w ram) until the emulator starts up there. If that cannot be done without creating yet another p2m type to handle logdirty (which seems a suboptimal way of dealing with it) then I think migration needs to be disallowed on any domain than contains any ioreq_server type pages at this stage.
Paul
Quoted 9 lines
Or
2> we just disallow live migration whenp2m->ioreq.serveris not NULL. This is not quite accurate, because havingp2m->ioreq.servermapped top2m_ioreq_serverdoes not necessarily means there would be such outstanding entries. To be more accurate, we can add some other rough check, e.g. both check ifp2m->ioreq.serveragainst NULL and check if thehvmop_set_mem_typehas ever been triggered once for thep2m_ioreq_servertype.
Quoted 31 lines
Both choice seems suboptimal for me. And I wonder if we have any better solutions?
Thanks
YuQuoted 25 lines
Quoted 12 lines
Thanks in advance! :)
Quoted 11 lines
Quoted 11 lines
If the answer is, "everything just works", that's perfect.
If the answer is, "Before logdirty mode is set, the ioreq server has the opportunity to detach, removing the
p2m_ioreq_serverentries, and operating without that functionality", that's good too.If the answer is, "the live migration request fails and the guest continues to run", that's also acceptable. If you want this series to be checked in today (the last day for 4.7), this is probably your best bet.
Quoted 8 lines
Quoted 5 lines
Quoted 4 lines
-George
Regards
Yu_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
Quoted 18 lines · Paul Durrant
Quoted 1 line
-----Original Message-----
[snip]
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Does any other maintainers have any suggestions?
Note that it is a requirement that an ioreq server be disabled before VM
suspend. That means ioreq server pages essentially have to go back to
ram_rwsemantics.Quoted 1 line
Quoted 9 lines
Quoted 2 lines
Paul
OK. So it should be hypervisor's responsibility to do the resetting. Now we probably have 2 choices:
1> we reset the p2m type synchronously when ioreq server unmapping happens, instead of deferring to the misconfig handling part. This means performance impact to traverse the p2m table.
Quoted 4 lines
Do we need to reset at all. The p2m type does need to be transferred, it will just be unclaimed on the far end (i.e. the pages are treated as r/w ram) until the emulator starts up there. If that cannot be done without creating yet another p2m type to handle logdirty (which seems a suboptimal way of dealing with it) then I think migration needs to be disallowed on any domain than contains any
ioreq_servertype pages at this stage.Paul
Yes. We need - either the device model or hypervisor should grantee there's no p2m_ioreq_server pages left after an ioreq server is unmapped from this type (which is write protected in such senario), otherwise its emulation might be forwarded to other unexpected device models which claims the p2m_ioreq_server later.
So I guess approach 2> is your suggestion now.
Besides, previously, Jan also questioned the necessity of resetting the
p2m type when an ioreq server is mapping to the p2m_ioreq_server. His
argument is that we should only allow such p2m transition after an
ioreq server has already mapped to this p2m_ioreq_server. I think his point sounds also reasonable.
Thanks
Yu
Quoted 33 lines
Quoted 33 lines
Or
2> we just disallow live migration whenp2m->ioreq.serveris not NULL. This is not quite accurate, because havingp2m->ioreq.servermapped top2m_ioreq_serverdoes not necessarily means there would be such outstanding entries. To be more accurate, we can add some other rough check, e.g. both check ifp2m->ioreq.serveragainst NULL and check if thehvmop_set_mem_typehas ever been triggered once for thep2m_ioreq_servertype.Both choice seems suboptimal for me. And I wonder if we have any better solutions?
Thanks
YuQuoted 18 lines
Quoted 18 lines
Thanks in advance! :)
Quoted 16 lines
Quoted 15 lines
If the answer is, "everything just works", that's perfect.
If the answer is, "Before logdirty mode is set, the ioreq server has the opportunity to detach, removing the
p2m_ioreq_serverentries, and operating without that functionality", that's good too.If the answer is, "the live migration request fails and the guest continues to run", that's also acceptable. If you want this series to be checked in today (the last day for 4.7), this is probably your best bet.
-George
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Regards
Yu_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
Quoted 37 lines
-----Original Message-----
From: Yu, Zhang [mailto:[email protected]]
Sent: 19 April 2016 10:44
To: Paul Durrant; George Dunlap; [email protected]
Cc: Kevin Tian; Jan Beulich; Andrew Cooper; Tim (Xen.org); Lv, Zhiyuan; [email protected]
Subject: Re: [Xen-devel] [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram withp2m_ioreq_serverto an ioreq serverQuoted 11 lines · Paul Durrant
Quoted 1 line
-----Original Message-----
[snip]
Quoted 9 lines
Quoted 3 lines
Quoted 1 line
Does any other maintainers have any suggestions?
Note that it is a requirement that an ioreq server be disabled before VM
suspend. That means ioreq server pages essentially have to go back to
ram_rwsemantics.Quoted 3 lines
Paul
Quoted 8 lines
Quoted 6 lines
OK. So it should be hypervisor's responsibility to do the resetting. Now we probably have 2 choices:
1> we reset the p2m type synchronously when ioreq server unmapping happens, instead of deferring to the misconfig handling part. This means performance impact to traverse the p2m table.Do we need to reset at all. The p2m type does need to be transferred, it
will just be unclaimed on the far end (i.e. the pages are treated as r/w ram) until the emulator starts up there. If that cannot be done without creating yet another p2m type to handle logdirty (which seems a suboptimal way of dealing with it) then I think migration needs to be disallowed on any domain than contains any
ioreq_servertype pages at this stage.Quoted 1 line
Quoted 8 lines
Quoted 2 lines
Paul
Yes. We need - either the device model or hypervisor should grantee there's no
p2m_ioreq_serverpages left after an ioreq server is unmapped from this type (which is write protected in such senario), otherwise its emulation might be forwarded to other unexpected device models which claims thep2m_ioreq_serverlater.
That should be for the device model to guarantee IMO. If the 'wrong' emulator claims the ioreq server type then I don't think that's Xen's problem.
Quoted 9 lines
So I guess approach 2> is your suggestion now.
Besides, previously, Jan also questioned the necessity of resetting the p2m type when an ioreq server is mapping to the
p2m_ioreq_server. His argument is that we should only allow such p2m transition after an ioreq server has already mapped to thisp2m_ioreq_server. I think his point sounds also reasonable.
I was kind of hoping to avoid that ordering dependency but if it makes things simpler then so be it.
Paul
Quoted 15 lines
Thanks
YuQuoted 12 lines
Quoted 12 lines
Or
2> we just disallow live migration whenp2m->ioreq.serveris not NULL. This is not quite accurate, because havingp2m->ioreq.servermapped top2m_ioreq_serverdoes not necessarily means there would be such outstanding entries. To be more accurate, we can add some other rough check, e.g. both check ifp2m->ioreq.serveragainst NULL and check if thehvmop_set_mem_typehas ever been triggered once for thep2m_ioreq_servertype.Both choice seems suboptimal for me. And I wonder if we have any better solutions?
Quoted 29 lines
Quoted 7 lines
Quoted 7 lines
Thanks
YuQuoted 4 lines
Quoted 4 lines
Thanks in advance! :)
Quoted 3 lines
Quoted 3 lines
If the answer is, "everything just works", that's perfect.
If the answer is, "Before logdirty mode is set, the ioreq server has
the
Quoted 21 lines
Quoted 21 lines
Quoted 21 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
opportunity to detach, removing the
p2m_ioreq_serverentries, and operating without that functionality", that's good too.If the answer is, "the live migration request fails and the guest continues to run", that's also acceptable. If you want this series to be checked in today (the last day for 4.7), this is probably your best bet.
Quoted 8 lines
Quoted 5 lines
Quoted 4 lines
-George
Regards
Yu_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
Quoted 40 lines · Paul Durrant
Quoted 40 lines
-----Original Message-----
From: Yu, Zhang [mailto:[email protected]]
Sent: 19 April 2016 10:44
To: Paul Durrant; George Dunlap; [email protected]
Cc: Kevin Tian; Jan Beulich; Andrew Cooper; Tim (Xen.org); Lv, Zhiyuan; [email protected]
Subject: Re: [Xen-devel] [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram withp2m_ioreq_serverto an ioreq serverQuoted 11 lines · Paul Durrant
Quoted 1 line
-----Original Message-----
[snip]
Quoted 9 lines
Quoted 3 lines
Quoted 1 line
Does any other maintainers have any suggestions?
Note that it is a requirement that an ioreq server be disabled before VM
suspend. That means ioreq server pages essentially have to go back to
ram_rwsemantics.Quoted 3 lines
Paul
Quoted 8 lines
Quoted 6 lines
OK. So it should be hypervisor's responsibility to do the resetting. Now we probably have 2 choices:
1> we reset the p2m type synchronously when ioreq server unmapping happens, instead of deferring to the misconfig handling part. This means performance impact to traverse the p2m table.Do we need to reset at all. The p2m type does need to be transferred, it
will just be unclaimed on the far end (i.e. the pages are treated as r/w ram) until the emulator starts up there. If that cannot be done without creating yet another p2m type to handle logdirty (which seems a suboptimal way of dealing with it) then I think migration needs to be disallowed on any domain than contains any
ioreq_servertype pages at this stage.Quoted 3 lines
Paul
Quoted 8 lines
Quoted 5 lines
Yes. We need - either the device model or hypervisor should grantee there's no
p2m_ioreq_serverpages left after an ioreq server is unmapped from this type (which is write protected in such senario), otherwise its emulation might be forwarded to other unexpected device models which claims thep2m_ioreq_serverlater.That should be for the device model to guarantee IMO. If the 'wrong' emulator claims the ioreq server type then I don't think that's Xen's problem.
Thanks, Paul.
So what about the VM suspend case you mentioned above? Will that trigger the unmapping of ioreq server? Could the device model also take the role to change the p2m type back in such case?
It would be much simpler if hypervisor side does not need to provide the p2m resetting logic, and we can support live migration at the same time then. :)
B.R.
Yu
Quoted 10 lines
Quoted 9 lines
So I guess approach 2> is your suggestion now.
Besides, previously, Jan also questioned the necessity of resetting the p2m type when an ioreq server is mapping to the
p2m_ioreq_server. His argument is that we should only allow such p2m transition after an ioreq server has already mapped to thisp2m_ioreq_server. I think his point sounds also reasonable.
Quoted 48 lines
I was kind of hoping to avoid that ordering dependency but if it makes things simpler then so be it.
Paul
Quoted 44 lines
Thanks
YuQuoted 12 lines
Quoted 12 lines
Or
2> we just disallow live migration whenp2m->ioreq.serveris not NULL. This is not quite accurate, because havingp2m->ioreq.servermapped top2m_ioreq_serverdoes not necessarily means there would be such outstanding entries. To be more accurate, we can add some other rough check, e.g. both check ifp2m->ioreq.serveragainst NULL and check if thehvmop_set_mem_typehas ever been triggered once for thep2m_ioreq_servertype.Both choice seems suboptimal for me. And I wonder if we have any better solutions?
Quoted 7 lines
Quoted 7 lines
Thanks
YuQuoted 4 lines
Quoted 4 lines
Thanks in advance! :)
Quoted 3 lines
Quoted 3 lines
If the answer is, "everything just works", that's perfect.
If the answer is, "Before logdirty mode is set, the ioreq server has
the
Quoted 21 lines
Quoted 21 lines
Quoted 21 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
opportunity to detach, removing the
p2m_ioreq_serverentries, and operating without that functionality", that's good too.If the answer is, "the live migration request fails and the guest continues to run", that's also acceptable. If you want this series to be checked in today (the last day for 4.7), this is probably your best bet.
Quoted 8 lines
Quoted 5 lines
Quoted 4 lines
-George
Regards
Yu_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
Quoted 65 lines
-----Original Message-----
From: Yu, Zhang [mailto:[email protected]]
Sent: 19 April 2016 12:18
To: Paul Durrant; George Dunlap; [email protected]
Cc: Kevin Tian; Jan Beulich; Andrew Cooper; Tim (Xen.org); Lv, Zhiyuan; [email protected]
Subject: Re: [Xen-devel] [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram withp2m_ioreq_serverto an ioreq serverQuoted 11 lines · Paul Durrant
Quoted 11 lines
-----Original Message-----
From: Yu, Zhang [mailto:[email protected]]
Sent: 19 April 2016 10:44
To: Paul Durrant; George Dunlap; [email protected]
Cc: Kevin Tian; Jan Beulich; Andrew Cooper; Tim (Xen.org); Lv, Zhiyuan; [email protected]
Subject: Re: [Xen-devel] [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram withp2m_ioreq_serverto an ioreq serverQuoted 6 lines
Quoted 6 lines · Paul Durrant
Quoted 5 lines
Quoted 1 line
-----Original Message-----
[snip]
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
Does any other maintainers have any suggestions?
Note that it is a requirement that an ioreq server be disabled before
VM
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
suspend. That means ioreq server pages essentially have to go back to
ram_rwsemantics.Quoted 3 lines
Paul
OK. So it should be hypervisor's responsibility to do the resetting. Now we probably have 2 choices:
1> we reset the p2m type synchronously when ioreq server unmapping happens, instead of deferring to the misconfig handling part. This means performance impact to traverse the p2m table.Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Do we need to reset at all. The p2m type does need to be transferred, it
will just be unclaimed on the far end (i.e. the pages are treated as r/w
ram)
Quoted 2 lines
Quoted 2 lines
until the emulator starts up there. If that cannot be done without creating yet another p2m type to handle logdirty (which seems a suboptimal way
of
Quoted 1 line
Quoted 1 line
dealing with it) then I think migration needs to be disallowed on any
domain
Quoted 7 lines
Quoted 7 lines
than contains any
ioreq_servertype pages at this stage.Quoted 3 lines
Paul
Yes. We need - either the device model or hypervisor should grantee there's no
p2m_ioreq_serverpages left after an ioreq server isunmapped
Quoted 2 lines
Quoted 2 lines
from this type (which is write protected in such senario), otherwise its emulation might be forwarded to other unexpected device models
which
Quoted 3 lines
Quoted 1 line
claims the
p2m_ioreq_serverlater.That should be for the device model to guarantee IMO. If the 'wrong'
Quoted 8 lines
emulator claims the ioreq server type then I don't think that's Xen's problem.
Quoted 1 line
Thanks, Paul.
So what about the VM suspend case you mentioned above? Will that trigger the unmapping of ioreq server? Could the device model also take the role to change the p2m type back in such case?
Yes. The device model has to be told by the toolstack that the VM is suspending, otherwise it can't disable the ioreq server which puts the shared ioreq pages back into the guest p2m. If that's not done then the pages will be leaked.
Quoted 5 lines
It would be much simpler if hypervisor side does not need to provide the p2m resetting logic, and we can support live migration at the same time then. :)
That really should not be hypervisor's job.
Paul
Quoted 43 lines
B.R.
YuQuoted 11 lines
Quoted 9 lines
So I guess approach 2> is your suggestion now.
Besides, previously, Jan also questioned the necessity of resetting the p2m type when an ioreq server is mapping to the
p2m_ioreq_server. His argument is that we should only allow such p2m transition after an ioreq server has already mapped to thisp2m_ioreq_server. I think his point sounds also reasonable.I was kind of hoping to avoid that ordering dependency but if it makes
things simpler then so be it.
Quoted 11 lines
Paul
Quoted 8 lines
Thanks
YuQuoted 5 lines
Quoted 5 lines
Or
2> we just disallow live migration whenp2m->ioreq.serveris not NULL. This is not quite accurate, because havingp2m->ioreq.servermapped top2m_ioreq_serverdoes not necessarily means there would be such outstanding entries. To be more accurate, we can add some otherrough
Quoted 15 lines
Quoted 15 lines
Quoted 7 lines
Quoted 7 lines
check, e.g. both check if
p2m->ioreq.serveragainst NULL and check if thehvmop_set_mem_typehas ever been triggered once for thep2m_ioreq_servertype.Both choice seems suboptimal for me. And I wonder if we have any better solutions?
Quoted 7 lines
Quoted 7 lines
Thanks
YuQuoted 4 lines
Quoted 4 lines
Thanks in advance! :)
Quoted 3 lines
Quoted 3 lines
If the answer is, "everything just works", that's perfect.
If the answer is, "Before logdirty mode is set, the ioreq server has
the
Quoted 23 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
opportunity to detach, removing the
p2m_ioreq_serverentries,and
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
operating without that functionality", that's good too.
If the answer is, "the live migration request fails and the guest continues to run", that's also acceptable. If you want this series to be checked in today (the last day for 4.7), this is probably your
best
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 10 lines
Quoted 7 lines
Quoted 6 lines
bet.
-George
Regards
Yu_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
Quoted 77 lines · Paul Durrant
Quoted 65 lines
-----Original Message-----
From: Yu, Zhang [mailto:[email protected]]
Sent: 19 April 2016 12:18
To: Paul Durrant; George Dunlap; [email protected]
Cc: Kevin Tian; Jan Beulich; Andrew Cooper; Tim (Xen.org); Lv, Zhiyuan; [email protected]
Subject: Re: [Xen-devel] [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram withp2m_ioreq_serverto an ioreq serverQuoted 11 lines · Paul Durrant
Quoted 11 lines
-----Original Message-----
From: Yu, Zhang [mailto:[email protected]]
Sent: 19 April 2016 10:44
To: Paul Durrant; George Dunlap; [email protected]
Cc: Kevin Tian; Jan Beulich; Andrew Cooper; Tim (Xen.org); Lv, Zhiyuan; [email protected]
Subject: Re: [Xen-devel] [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram withp2m_ioreq_serverto an ioreq serverQuoted 6 lines
Quoted 6 lines · Paul Durrant
Quoted 5 lines
Quoted 1 line
-----Original Message-----
[snip]
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
Does any other maintainers have any suggestions?
Note that it is a requirement that an ioreq server be disabled before
VM
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
suspend. That means ioreq server pages essentially have to go back to
ram_rwsemantics.Quoted 3 lines
Paul
OK. So it should be hypervisor's responsibility to do the resetting. Now we probably have 2 choices:
1> we reset the p2m type synchronously when ioreq server unmapping happens, instead of deferring to the misconfig handling part. This means performance impact to traverse the p2m table.Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Do we need to reset at all. The p2m type does need to be transferred, it
will just be unclaimed on the far end (i.e. the pages are treated as r/w
ram)
Quoted 2 lines
Quoted 2 lines
until the emulator starts up there. If that cannot be done without creating yet another p2m type to handle logdirty (which seems a suboptimal way
of
Quoted 1 line
Quoted 1 line
dealing with it) then I think migration needs to be disallowed on any
domain
Quoted 7 lines
Quoted 7 lines
than contains any
ioreq_servertype pages at this stage.Quoted 3 lines
Paul
Yes. We need - either the device model or hypervisor should grantee there's no
p2m_ioreq_serverpages left after an ioreq server isunmapped
Quoted 2 lines
Quoted 2 lines
from this type (which is write protected in such senario), otherwise its emulation might be forwarded to other unexpected device models
which
Quoted 3 lines
Quoted 1 line
claims the
p2m_ioreq_serverlater.That should be for the device model to guarantee IMO. If the 'wrong'
Quoted 8 lines
emulator claims the ioreq server type then I don't think that's Xen's problem.
Quoted 1 line
Thanks, Paul.
So what about the VM suspend case you mentioned above? Will that trigger the unmapping of ioreq server? Could the device model also take the role to change the p2m type back in such case?
Yes. The device model has to be told by the toolstack that the VM is suspending, otherwise it can't disable the ioreq server which puts the shared ioreq pages back into the guest p2m. If that's not done then the pages will be leaked.
Quoted 1 line
Quoted 9 lines
Quoted 4 lines
It would be much simpler if hypervisor side does not need to provide the p2m resetting logic, and we can support live migration at the same time then. :)
That really should not be hypervisor's job.
Paul
Oh. So let's just remove the p2m type recalculation code from this patch, no need to call p2m_change_entry_type_global, and no need to worry about the log dirty part.
George, do you think this acceptable?
BTW, if no need to call p2m_change_entry_type_global, which is not used for shadow mode, we can keep this p2m type in shadow code, right?
Thanks
Yu
Quoted 59 lines
Quoted 59 lines
B.R.
YuQuoted 11 lines
Quoted 9 lines
So I guess approach 2> is your suggestion now.
Besides, previously, Jan also questioned the necessity of resetting the p2m type when an ioreq server is mapping to the
p2m_ioreq_server. His argument is that we should only allow such p2m transition after an ioreq server has already mapped to thisp2m_ioreq_server. I think his point sounds also reasonable.I was kind of hoping to avoid that ordering dependency but if it makes
things simpler then so be it.
Quoted 11 lines
Paul
Quoted 8 lines
Thanks
YuQuoted 5 lines
Quoted 5 lines
Or
2> we just disallow live migration whenp2m->ioreq.serveris not NULL. This is not quite accurate, because havingp2m->ioreq.servermapped top2m_ioreq_serverdoes not necessarily means there would be such outstanding entries. To be more accurate, we can add some otherrough
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
check, e.g. both check if
p2m->ioreq.serveragainst NULL and check if thehvmop_set_mem_typehas ever been triggered once for thep2m_ioreq_servertype.Both choice seems suboptimal for me. And I wonder if we have any better solutions?
Thanks
YuQuoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Thanks in advance! :)
Quoted 3 lines
Quoted 3 lines
If the answer is, "everything just works", that's perfect.
If the answer is, "Before logdirty mode is set, the ioreq server has
the
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
opportunity to detach, removing the
p2m_ioreq_serverentries,and
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
operating without that functionality", that's good too.
If the answer is, "the live migration request fails and the guest continues to run", that's also acceptable. If you want this series to be checked in today (the last day for 4.7), this is probably your
best
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 6 lines
bet.
-George
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Regards
Yu_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
Quoted 18 lines · Zhang
Quoted 18 lines
Quoted 3 lines
So what about the VM suspend case you mentioned above? Will that trigger the unmapping of ioreq server? Could the device model also take the role to change the p2m type back in such case?
Yes. The device model has to be told by the toolstack that the VM is suspending, otherwise it can't disable the ioreq server which puts the shared ioreq pages back into the guest p2m. If that's not done then the pages will be leaked.
Quoted 5 lines
It would be much simpler if hypervisor side does not need to provide the p2m resetting logic, and we can support live migration at the same time then. :)
That really should not be hypervisor's job.
Quoted 8 lines
Quoted 2 lines
Paul
Oh. So let's just remove the p2m type recalculation code from this patch, no need to call
p2m_change_entry_type_global, and no need to worry about the log dirty part.George, do you think this acceptable?
Sorry, just to make sure I understand your intentions:
1. The ioreq servers will be responsible for changing all the p2m_ioreq_server types back to p2m_ram_rw before detaching
2. Xen will refuse to set logdirty mode if there are any attached ioreq servers
The one problem with #1 is what to do if the ioreq server is buggy / killed, and forgets / is unable to clean up its ioreq_server entries?
There's a certain symmetry with the idea of having the ioreq server responsible both for mapping and unmapping; and it would be nice to have this stuff work for shadow mode as well. But the automatic type change seems like a more robust option. (Still open to persuasion on this.)
On another note: the hard freeze is long past the already-extended deadline, so I was assuming this was 4.8 material at this point.
-George
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
Quoted 40 lines
-----Original Message-----
From: George Dunlap
Sent: 20 April 2016 15:50
To: Yu, Zhang
Cc: Paul Durrant; [email protected]; Kevin Tian; Jan Beulich; Andrew Cooper; Tim (Xen.org); Lv, Zhiyuan; [email protected]
Subject: Re: [Xen-devel] [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram withp2m_ioreq_serverto an ioreq serverQuoted 1 line · Zhang
Quoted 1 line
Quoted 1 line
So what about the VM suspend case you mentioned above? Will that
trigger
Quoted 1 line
Quoted 1 line
Quoted 1 line
the unmapping of ioreq server? Could the device model also take the
role
Quoted 16 lines
Quoted 16 lines
Quoted 1 line
to change the p2m type back in such case?
Yes. The device model has to be told by the toolstack that the VM is suspending, otherwise it can't disable the ioreq server which puts the shared ioreq pages back into the guest p2m. If that's not done then the pages will be leaked.
Quoted 5 lines
It would be much simpler if hypervisor side does not need to provide the p2m resetting logic, and we can support live migration at the same time then. :)
That really should not be hypervisor's job.
Quoted 8 lines
Quoted 2 lines
Paul
Oh. So let's just remove the p2m type recalculation code from this patch, no need to call
p2m_change_entry_type_global, and no need to worry about the log dirty part.George, do you think this acceptable?
Quoted 9 lines
Sorry, just to make sure I understand your intentions:
1. The ioreq servers will be responsible for changing all the
p2m_ioreq_servertypes back top2m_ram_rwbefore detaching
2. Xen will refuse to set logdirty mode if there are any attached ioreq serversThe one problem with #1 is what to do if the ioreq server is buggy / killed, and forgets / is unable to clean up its
ioreq_serverentries?
If we ever want to meaningfully migrate a VM with XenGT enabled then I think it has to be possible to migrate the p2m_ioreq_server page types as-is. I'd expect a new instance of the xengt emulator to claim them on the far and any emulator state be transferred in a similar way to which qemu state is transferred such that vgpu emulation can be continued after the migration. After all, it's not like we magically reset the type of mmio-dm pages on migration. It is just expected that a new instance of QEMU is spawned to take care of them on the far end when the VM is unpaused.
Paul
Quoted 10 lines
There's a certain symmetry with the idea of having the ioreq server responsible both for mapping and unmapping; and it would be nice to have this stuff work for shadow mode as well. But the automatic type change seems like a more robust option. (Still open to persuasion on this.)
On another note: the hard freeze is long past the already-extended deadline, so I was assuming this was 4.8 material at this point.
-George
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
Quoted 46 lines · Paul Durrant
Quoted 46 lines
-----Original Message-----
From: George Dunlap
Sent: 20 April 2016 15:50
To: Yu, Zhang
Cc: Paul Durrant; [email protected]; Kevin Tian; Jan Beulich; Andrew Cooper; Tim (Xen.org); Lv, Zhiyuan; [email protected]
Subject: Re: [Xen-devel] [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram withp2m_ioreq_serverto an ioreq serverQuoted 1 line · Zhang
Quoted 1 line
Quoted 1 line
So what about the VM suspend case you mentioned above? Will that
trigger
Quoted 1 line
Quoted 1 line
Quoted 1 line
the unmapping of ioreq server? Could the device model also take the
role
Quoted 16 lines
Quoted 16 lines
Quoted 1 line
to change the p2m type back in such case?
Yes. The device model has to be told by the toolstack that the VM is suspending, otherwise it can't disable the ioreq server which puts the shared ioreq pages back into the guest p2m. If that's not done then the pages will be leaked.
Quoted 5 lines
It would be much simpler if hypervisor side does not need to provide the p2m resetting logic, and we can support live migration at the same time then. :)
That really should not be hypervisor's job.
Quoted 8 lines
Quoted 2 lines
Paul
Oh. So let's just remove the p2m type recalculation code from this patch, no need to call
p2m_change_entry_type_global, and no need to worry about the log dirty part.George, do you think this acceptable?
Sorry, just to make sure I understand your intentions:
1. The ioreq servers will be responsible for changing all the
p2m_ioreq_servertypes back top2m_ram_rwbefore detaching
2. Xen will refuse to set logdirty mode if there are any attached ioreq servers
Quoted 6 lines
Quoted 3 lines
The one problem with #1 is what to do if the ioreq server is buggy / killed, and forgets / is unable to clean up its
ioreq_serverentries?If we ever want to meaningfully migrate a VM with XenGT enabled then I think it has to be possible to migrate the
p2m_ioreq_serverpage types as-is. I'd expect a new instance of the xengt emulator to claim them on the far and any emulator state be transferred in a similar way to which qemu state is transferred such that vgpu emulation can be continued after the migration. After all, it's not like we magically reset the type of mmio-dm pages on migration. It is just expected that a new instance of QEMU is spawned to take care of them on the far end when the VM is unpaused.
I don't see the implication you're trying to make regarding the attach/detach interface.
In any case, is it really not the case that the devicemodels on the far side have to re-register which IO ranges they're interested in? Shouldn't the devicemodel on the far side re-register the pfns it wants to watch as well? That again seems like the most robust solution, rather than assuming that the pfns you expect to have been marked are already marked. To do otherwise risks bugs where 1) pages you think were being watched aren't 2) pages being watched that you don't care about (and you don't think to un-watch them because you didn't think you'd watched them in the first place).
On a slightly different topic: come to think of it, there's no need to switch the p2m type for ioreq_server when we turn on logdirty mode; we just have to call paging_mark_dirty() if it's a write, don't we?
-George
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
Quoted 78 lines
-----Original Message-----
From: George Dunlap
Sent: 20 April 2016 16:38
To: Paul Durrant
Cc: Yu, Zhang; Kevin Tian; [email protected]; Andrew Cooper; Tim (Xen.org); [email protected]; Lv, Zhiyuan; Jan Beulich
Subject: Re: [Xen-devel] [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram withp2m_ioreq_serverto an ioreq serverQuoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: George Dunlap
Sent: 20 April 2016 15:50
To: Yu, Zhang
Cc: Paul Durrant; [email protected]; Kevin Tian; Jan Beulich;Andrew
Quoted 5 lines
Quoted 5 lines
Cooper; Tim (Xen.org); Lv, Zhiyuan; [email protected]
Subject: Re: [Xen-devel] [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram withp2m_ioreq_serverto an ioreq serverOn Tue, Apr 19, 2016 at 12:59 PM, Yu, Zhang
Quoted 11 lines
Quoted 11 lines
Quoted 1 line · wrote:
Quoted 1 line
Quoted 1 line
So what about the VM suspend case you mentioned above? Will that
trigger
Quoted 1 line
Quoted 1 line
Quoted 1 line
the unmapping of ioreq server? Could the device model also take the
role
Quoted 6 lines
Quoted 6 lines
Quoted 1 line
to change the p2m type back in such case?
Yes. The device model has to be told by the toolstack that the VM is suspending, otherwise it can't disable the ioreq server which puts the shared ioreq pages back into the guest p2m. If that's not done then
the
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
pages will be leaked.
Quoted 3 lines
It would be much simpler if hypervisor side does not need to provide the p2m resetting logic, and we can support live migration at the
same
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 7 lines
Quoted 2 lines
time then. :)
That really should not be hypervisor's job.
Paul
Oh. So let's just remove the p2m type recalculation code from this patch, no need to call
p2m_change_entry_type_global, and no need to worry about the log dirty part.Quoted 7 lines
Quoted 7 lines
Quoted 1 line
George, do you think this acceptable?
Sorry, just to make sure I understand your intentions:
1. The ioreq servers will be responsible for changing all the
p2m_ioreq_servertypes back top2m_ram_rwbefore detaching
2. Xen will refuse to set logdirty mode if there are any attached ioreqservers
Quoted 6 lines
Quoted 4 lines
The one problem with #1 is what to do if the ioreq server is buggy / killed, and forgets / is unable to clean up its
ioreq_serverentries?If we ever want to meaningfully migrate a VM with XenGT enabled then I
think it has to be possible to migrate the
p2m_ioreq_serverpage types as-is. I'd expect a new instance of the xengt emulator to claim them on the far and any emulator state be transferred in a similar way to which qemu state is transferred such that vgpu emulation can be continued after the migration.Quoted 1 line
After all, it's not like we magically reset the type of mmio-dm pages on
migration. It is just expected that a new instance of QEMU is spawned to take care of them on the far end when the VM is unpaused.
I don't see the implication you're trying to make regarding the attach/detach interface.
Quoted 10 lines
In any case, is it really not the case that the devicemodels on the far side have to re-register which IO ranges they're interested in? Shouldn't the devicemodel on the far side re-register the pfns it wants to watch as well? That again seems like the most robust solution, rather than assuming that the pfns you expect to have been marked are already marked. To do otherwise risks bugs where 1) pages you think were being watched aren't 2) pages being watched that you don't care about (and you don't think to un-watch them because you didn't think you'd watched them in the first place).
That sounds a little inefficient when there could be thousands of pages in play. If the p2m types were faithfully reproduced in the receiving domain then the new incarnation of the emulator just needs to claim the type rather than making thousands of set-mem-type hypercalls as well. I agree that the information would need to be transferred though, otherwise the new incarnation wouldn't be able reset the page types when it was done with them.
Quoted 4 lines
On a slightly different topic: come to think of it, there's no need to switch the p2m type for
ioreq_serverwhen we turn on logdirty mode; we just have to callpaging_mark_dirty()if it's a write, don't we?
That sounds right to me.
Paul
Quoted 1 line
-George
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
Quoted 11 lines · Paul Durrant
Quoted 10 lines
In any case, is it really not the case that the devicemodels on the far side have to re-register which IO ranges they're interested in? Shouldn't the devicemodel on the far side re-register the pfns it wants to watch as well? That again seems like the most robust solution, rather than assuming that the pfns you expect to have been marked are already marked. To do otherwise risks bugs where 1) pages you think were being watched aren't 2) pages being watched that you don't care about (and you don't think to un-watch them because you didn't think you'd watched them in the first place).
Quoted 1 line
That sounds a little inefficient when there could be thousands of pages in play. If the p2m types were faithfully reproduced in the receiving domain then the new incarnation of the emulator just needs to claim the type rather than making thousands of set-mem-type hypercalls as well. I agree that the information would need to be transferred though, otherwise the new incarnation wouldn't be able reset the page types when it was done with them.
The emulator could presumably go through and re-shadow the GPTs as they were used, rather than all at once, right?
I still think that flushing all types on disconnect and having the ioreq server on the far side re-protect things as it wants to is a more robust solution. But ultimately you're probably going to be the one who's going to have to deal with any bugs related to this, so I'd leave it between you and Yu Zhang.
-George
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
In reply to Paul DurrantQuoted 89 lines · Paul Durrant
Quoted 78 lines
-----Original Message-----
From: George Dunlap
Sent: 20 April 2016 16:38
To: Paul Durrant
Cc: Yu, Zhang; Kevin Tian; [email protected]; Andrew Cooper; Tim (Xen.org); [email protected]; Lv, Zhiyuan; Jan Beulich
Subject: Re: [Xen-devel] [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram withp2m_ioreq_serverto an ioreq serverQuoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: George Dunlap
Sent: 20 April 2016 15:50
To: Yu, Zhang
Cc: Paul Durrant; [email protected]; Kevin Tian; Jan Beulich;Andrew
Quoted 5 lines
Quoted 5 lines
Cooper; Tim (Xen.org); Lv, Zhiyuan; [email protected]
Subject: Re: [Xen-devel] [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram withp2m_ioreq_serverto an ioreq serverOn Tue, Apr 19, 2016 at 12:59 PM, Yu, Zhang
Quoted 11 lines
Quoted 11 lines
Quoted 1 line · wrote:
Quoted 1 line
Quoted 1 line
So what about the VM suspend case you mentioned above? Will that
trigger
Quoted 1 line
Quoted 1 line
Quoted 1 line
the unmapping of ioreq server? Could the device model also take the
role
Quoted 6 lines
Quoted 6 lines
Quoted 1 line
to change the p2m type back in such case?
Yes. The device model has to be told by the toolstack that the VM is suspending, otherwise it can't disable the ioreq server which puts the shared ioreq pages back into the guest p2m. If that's not done then
the
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
pages will be leaked.
Quoted 3 lines
It would be much simpler if hypervisor side does not need to provide the p2m resetting logic, and we can support live migration at the
same
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 7 lines
Quoted 2 lines
time then. :)
That really should not be hypervisor's job.
Paul
Oh. So let's just remove the p2m type recalculation code from this patch, no need to call
p2m_change_entry_type_global, and no need to worry about the log dirty part.Quoted 7 lines
Quoted 7 lines
Quoted 1 line
George, do you think this acceptable?
Sorry, just to make sure I understand your intentions:
1. The ioreq servers will be responsible for changing all the
p2m_ioreq_servertypes back top2m_ram_rwbefore detaching
2. Xen will refuse to set logdirty mode if there are any attached ioreqservers
Quoted 6 lines
Quoted 4 lines
The one problem with #1 is what to do if the ioreq server is buggy / killed, and forgets / is unable to clean up its
ioreq_serverentries?If we ever want to meaningfully migrate a VM with XenGT enabled then I
think it has to be possible to migrate the
p2m_ioreq_serverpage types as-is. I'd expect a new instance of the xengt emulator to claim them on the far and any emulator state be transferred in a similar way to which qemu state is transferred such that vgpu emulation can be continued after the migration.Quoted 1 line
After all, it's not like we magically reset the type of mmio-dm pages on
migration. It is just expected that a new instance of QEMU is spawned to take care of them on the far end when the VM is unpaused.
I don't see the implication you're trying to make regarding the attach/detach interface.
Quoted 10 lines
In any case, is it really not the case that the devicemodels on the far side have to re-register which IO ranges they're interested in? Shouldn't the devicemodel on the far side re-register the pfns it wants to watch as well? That again seems like the most robust solution, rather than assuming that the pfns you expect to have been marked are already marked. To do otherwise risks bugs where 1) pages you think were being watched aren't 2) pages being watched that you don't care about (and you don't think to un-watch them because you didn't think you'd watched them in the first place).
Quoted 2 lines
That sounds a little inefficient when there could be thousands of pages in play. If the p2m types were faithfully reproduced in the receiving domain then the new incarnation of the emulator just needs to claim the type rather than making thousands of set-mem-type hypercalls as well. I agree that the information would need to be transferred though, otherwise the new incarnation wouldn't be able reset the page types when it was done with them.
I agree. For XenGT to live migrate, device model may probably actively take role like this.
Quoted 4 lines
Quoted 4 lines
On a slightly different topic: come to think of it, there's no need to switch the p2m type for
ioreq_serverwhen we turn on logdirty mode; we just have to callpaging_mark_dirty()if it's a write, don't we?
Yes. Unlike the log dirty pages, which will be changed back to p2m_ram_rw after the first ept violation(to keep it simple, no intel PML considered), pages with p2m_ioreq_server will continue to be trapped. Since this patch series is only for the basic functionality of XenGT, I suggest we do not include this until we plan to support XenGT live migration in the future. And at that time, some kind optimization may be necessary(i.e. how to remove the redundant paging_mark_dirty for write protected pages).
Quoted 6 lines
That sounds right to me.
Paul
Quoted 1 line
-George
B.R.
Yu
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
In reply to George DunlapThank you, George.
Quoted 26 lines · George Dunlap
Quoted 25 lines · Zhang
Quoted 11 lines
Quoted 3 lines
So what about the VM suspend case you mentioned above? Will that trigger the unmapping of ioreq server? Could the device model also take the role to change the p2m type back in such case?
Yes. The device model has to be told by the toolstack that the VM is suspending, otherwise it can't disable the ioreq server which puts the shared ioreq pages back into the guest p2m. If that's not done then the pages will be leaked.
Quoted 1 line
Quoted 9 lines
Quoted 4 lines
It would be much simpler if hypervisor side does not need to provide the p2m resetting logic, and we can support live migration at the same time then. :)
That really should not be hypervisor's job.
Paul
Oh. So let's just remove the p2m type recalculation code from this patch, no need to call
p2m_change_entry_type_global, and no need to worry about the log dirty part.
Quoted 6 lines
Quoted 1 line
George, do you think this acceptable?
Sorry, just to make sure I understand your intentions:
1. The ioreq servers will be responsible for changing all the
p2m_ioreq_servertypes back top2m_ram_rwbefore detaching
In this version, this is done by calling p2m_change_entry_type_global() *after* the ioreq server detaching.
But Paul & I now agreed not to reset p2m type in hypervisor, it should be the device model's responsibility to do so. Even if buggy/malicious device model fails to do so, the only affected one is the HVM being serviced, neither hypervisor nor other VMs will be hurt.
Quoted 2 lines
2. Xen will refuse to set logdirty mode if there are any attached ioreq servers
In this version, I included p2m_ioreq_server to P2M_CHANGEABLE_TYPES, so that we can use p2m_change_entry_global() for the auto resetting of p2m_ioreq_server, yet later realized that if live migration happens during a normal emulation process(before the detachment of the ioreq server), entries with p2m_ioreq_server will be changed to p2m_log_dirty (later to p2m_ram_rw in ept violation), therefore write operations will not be able to forward to the device model.
I also realized it impossible to both keep the p2m auto resetting for ioreq server detachment, and also support the live migration. So I once suggested this option #2.
But it is not necessary now that we do not need the p2m resetting code.
Quoted 6 lines
The one problem with #1 is what to do if the ioreq server is buggy / killed, and forgets / is unable to clean up its
ioreq_serverentries?There's a certain symmetry with the idea of having the ioreq server responsible both for mapping and unmapping; and it would be nice to have this stuff work for shadow mode as well. But the automatic type
About shadow mode, it is not supported in this version, because routine p2m_change_entry_global() is only supported on HAP mode. But I still would like to keep shadow mode out in next version, because we have no such usage model and if there's any bug it would be hard for us to find.
Quoted 6 lines
change seems like a more robust option. (Still open to persuasion on this.)
On another note: the hard freeze is long past the already-extended deadline, so I was assuming this was 4.8 material at this point.
It is a pity. And I'm the one to be blamed for. Thank you very much for all the advice and help. I'll continue to work on this feature till no matter whichever version it is accepted to. :)
B.R.
Yu
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
On Thu, Apr 21, 2016 at 09:21:17PM +0800, Yu, Zhang wrote:
[...]
Quoted 1 line
It is a pity. And I'm the one to be blamed for. Thank you very much
Please don't blame yourself. I don't think anyone should be blamed here.
I can only speak for myself, but I feel grateful when other people want to collaborate with upstream projects. We just need to realise collaboration takes time and effort and things don't always come out as expected. I've been on both sides, both as contributor and maintainer so I understand the frustration.
I want to publicly thank you (and all other engineers at Intel) for your persistent effort for pushing things upstream and I believe things will work out in the end.
Wei.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
Quoted 5 lines · Wei Liu
On Thu, Apr 21, 2016 at 09:21:17PM +0800, Yu, Zhang wrote:
[...]Quoted 1 line
It is a pity. And I'm the one to be blamed for. Thank you very much
Please don't blame yourself. I don't think anyone should be blamed here.
There are lots of things that might have led to a different outcome:
1. Yu Zhang may have noticed the issues earlier
2. Paul or I may have noticed the issues earlier
3. One of the x86 maintainers might have given a review earlier and caught the issues
4. Yu Zhang, Paul, or I may have pinged one of the x86 maintainers to get the review earlier
We all tried, but we all could perhaps have done a bit better. It is a shame it missed it by so little, but that's part of the reason we're shortening the release cycles. :-)
-George
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
In reply to Yu, ZhangQuoted 92 lines
From: Yu, Zhang [mailto:[email protected]]
Sent: Thursday, April 14, 2016 6:45 PMQuoted 62 lines · Zhang
Quoted 35 lines · George Dunlap
On 08/04/16 11:10, Yu, Zhang wrote:
[snip]Quoted 2 lines
BTW, I noticed your reply has not be CCed to mailing list, and I also wonder if we should raise this last question in community?
Oops -- that was a mistake on my part. :-) I appreciate the discretion; just so you know in the future, if I'm purposely changing the CC list (removing xen-devel and/or adding extra people), I'll almost always say so at the top of the mail.
Quoted 25 lines
Quoted 5 lines
And then of course there's the
p2m_ioreq_server->p2m_ram_logdirtytransition -- I assume that live migration is incompatible with this functionality? Is there anything that prevents a live migration from being started when there are outstandingp2m_ioreq_serverentries?Another good question, and the answer is unfortunately yes. :-)
If live migration happens during the normal emulation process, entries marked with
p2m_ioreq_serverwill be changed top2m_log_dirtyinresolve_misconfig(), and later write operations will change them top2m_ram_rw, thereafter these pages can not be forwarded to device model.
From this point of view, this functionality is incompatible with live
migration.But for XenGT, I think this is acceptable, because, if live migration is to be supported in the future, intervention from backend device model will be necessary. At that time, we can guarantee from the device model side that there's no outdated
p2m_ioreq_serverentries, hence no need to reset the p2m type back top2m_ram_rw(and do not include p2m_ioreq_server in the P2M_CHANGEABLE_TYPES). By "outdated", I mean when an ioreq server is detached fromp2m_ioreq_server, or before an ioreq server is attached to this type, entries marked withp2m_ioreq_servershould be regarded as outdated.Quoted 9 lines
Quoted 1 line
Is this acceptible to you? Any suggestions?
So the question is, as of this series, what happens if someone tries to initiate a live migration while there are outstanding
p2m_ioreq_serverentries?If the answer is "the ioreq server suddenly loses all control of the memory", that's something that needs to be changed.
Sorry, for this patch series, I'm afraid the above description is the answer.
Besides, I find it's hard to change current code to both support the deferred resetting of
p2m_ioreq_serverand the live migration at the same time. One reason is that a page withp2m_ioreq_serverbehaves differently in different situations.My assumption of XenGT is that, for live migration to work, the device model should guarantee there's no outstanding
p2m_ioreq_serverpages in hypervisor(no need to use the deferred recalculation), and it is our device model who should be responsible for the copying of the write protected guest pages later.Quoted 7 lines
And another solution I can think of: when unmapping the ioreq server, we walk the p2m table and reset entries with
p2m_ioreq_serverback directly, instead of deferring the reset. And of course, this means performance impact. But since the mapping and unmapping of an ioreq server is not a frequent one, the performance penalty may be acceptable. How do you think about this approach?George, sorry to bother you. Any comments on above option? :)
Another choice might be to let live migration fail if there's outstanding
p2m_ioreq_serverentries. But I'm not quite inclined to do so, because:
1> I'd still like to keep live migration feature for XenGT. 2> Not easy to know if there's outstandingp2m_ioreq_serverentries. I mean, since p2m type change is not only triggered by hypercall, to keep a counter for remainingp2m_ioreq_serverentries means a lot code changes;Besides, I wonder whether the requirement to reset the
p2m_ioreq_serveris indispensable, could we let the device model side to be responsible for this? The worst case I can imagine for device model failing to do so is that operations of a gfn might be delivered to a wrong device model. I'm not clear what kind of damage would this cause to the hypervisor or other VM.
Quoted 2 lines
Does any other maintainers have any suggestions?
Thanks in advance! :)
I'm not sure how above is working. In pre-copy phase (where logdirty is concerned), the device model is still actively serving requests from guest, including initiating new write-protection requests. How can you guarantee draining of outstanding p2m_ioreq_server entries w/o actually freezing device model (while freezing device model means guest driver might be blocked with random errors)?
Thanks
Kevin
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
Quoted 95 lines · Kevin
Quoted 92 lines
From: Yu, Zhang [mailto:[email protected]]
Sent: Thursday, April 14, 2016 6:45 PMQuoted 62 lines · Zhang
Quoted 35 lines · George Dunlap
On 08/04/16 11:10, Yu, Zhang wrote:
[snip]Quoted 2 lines
BTW, I noticed your reply has not be CCed to mailing list, and I also wonder if we should raise this last question in community?
Oops -- that was a mistake on my part. :-) I appreciate the discretion; just so you know in the future, if I'm purposely changing the CC list (removing xen-devel and/or adding extra people), I'll almost always say so at the top of the mail.
Quoted 25 lines
Quoted 5 lines
And then of course there's the
p2m_ioreq_server->p2m_ram_logdirtytransition -- I assume that live migration is incompatible with this functionality? Is there anything that prevents a live migration from being started when there are outstandingp2m_ioreq_serverentries?Another good question, and the answer is unfortunately yes. :-)
If live migration happens during the normal emulation process, entries marked with
p2m_ioreq_serverwill be changed top2m_log_dirtyinresolve_misconfig(), and later write operations will change them top2m_ram_rw, thereafter these pages can not be forwarded to device model.
From this point of view, this functionality is incompatible with live
migration.But for XenGT, I think this is acceptable, because, if live migration is to be supported in the future, intervention from backend device model will be necessary. At that time, we can guarantee from the device model side that there's no outdated
p2m_ioreq_serverentries, hence no need to reset the p2m type back top2m_ram_rw(and do not include p2m_ioreq_server in the P2M_CHANGEABLE_TYPES). By "outdated", I mean when an ioreq server is detached fromp2m_ioreq_server, or before an ioreq server is attached to this type, entries marked withp2m_ioreq_servershould be regarded as outdated.Quoted 9 lines
Quoted 1 line
Is this acceptible to you? Any suggestions?
So the question is, as of this series, what happens if someone tries to initiate a live migration while there are outstanding
p2m_ioreq_serverentries?If the answer is "the ioreq server suddenly loses all control of the memory", that's something that needs to be changed.
Sorry, for this patch series, I'm afraid the above description is the answer.
Besides, I find it's hard to change current code to both support the deferred resetting of
p2m_ioreq_serverand the live migration at the same time. One reason is that a page withp2m_ioreq_serverbehaves differently in different situations.My assumption of XenGT is that, for live migration to work, the device model should guarantee there's no outstanding
p2m_ioreq_serverpages in hypervisor(no need to use the deferred recalculation), and it is our device model who should be responsible for the copying of the write protected guest pages later.Quoted 7 lines
And another solution I can think of: when unmapping the ioreq server, we walk the p2m table and reset entries with
p2m_ioreq_serverback directly, instead of deferring the reset. And of course, this means performance impact. But since the mapping and unmapping of an ioreq server is not a frequent one, the performance penalty may be acceptable. How do you think about this approach?George, sorry to bother you. Any comments on above option? :)
Another choice might be to let live migration fail if there's outstanding
p2m_ioreq_serverentries. But I'm not quite inclined to do so, because:
1> I'd still like to keep live migration feature for XenGT. 2> Not easy to know if there's outstandingp2m_ioreq_serverentries. I mean, since p2m type change is not only triggered by hypercall, to keep a counter for remainingp2m_ioreq_serverentries means a lot code changes;Besides, I wonder whether the requirement to reset the
p2m_ioreq_serveris indispensable, could we let the device model side to be responsible for this? The worst case I can imagine for device model failing to do so is that operations of a gfn might be delivered to a wrong device model. I'm not clear what kind of damage would this cause to the hypervisor or other VM.Quoted 2 lines
Does any other maintainers have any suggestions?
Thanks in advance! :)
Quoted 7 lines
I'm not sure how above is working. In pre-copy phase (where logdirty is concerned), the device model is still actively serving requests from guest, including initiating new write-protection requests. How can you guarantee draining of outstanding
p2m_ioreq_serverentries w/o actually freezing device model (while freezing device model means guest driver might be blocked with random errors)?
You are right, and I'm not suggesting to clear the p2m_ioreq_server entries when live migration happens. My suggestion is that either we guarantee there is no outstanding p2m_ioreq_server entries right after the ioreq server is unbounded, or do not support live migration for now. :)
B.R.
Yu
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
In reply to Yu ZhangQuoted 67 lines · 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 typep2m_ioreq_server. Users of this HVMOP can specify whether thep2m_ioreq_serveris supposed to handle write accesses or read ones or both in a parameter named flags. For now, we only support one ioreq server for this p2m type, so once an ioreq server has claimed its ownership, subsequent calls of theHVMOP_map_mem_type_to_ioreq_serverwill fail. Users can also disclaim the ownership of guest ram pages with this p2m type, by triggering this new HVMOP, with ioreq server id set to the current owner's and flags parameter set to 0.For now, both
HVMOP_map_mem_type_to_ioreq_serverandp2m_ioreq_serverare only supported for HVMs with HAP enabled.Note that flags parameter(if not 0) of this HVMOP only indicates which kind of memory accesses are to be forwarded to an ioreq server, it has impact on the access rights of guest ram pages, but are not the same. Due to hardware limitations, if only write operations are to be forwarded, read ones will be performed at full speed, with no hypervisor intervention. But if read ones are to be forwarded to an ioreq server, writes will inevitably be trapped into hypervisor, which means significant performance impact.
Also note that this
HVMOP_map_mem_type_to_ioreq_serverwill not change the p2m type of any guest ram page, untilHVMOP_set_mem_typeis triggered. So normally the steps should be the backend driver first claims its ownership of guest ram pages withp2m_ioreq_servertype, and then sets the memory type top2m_ioreq_serverfor specified guest ram pages.Signed-off-by Paul Durrant <[email protected]>Signed-off-by Yu Zhang <[email protected]>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 | 125 +++++++++++++++++++++++++++++++++++++-- xen/arch/x86/hvm/hvm.c | 95 +++++++++++++++++++++++++++-- xen/arch/x86/mm/hap/nested_hap.c | 2 +- xen/arch/x86/mm/p2m-ept.c | 14 ++++- xen/arch/x86/mm/p2m-pt.c | 25 +++++--- xen/arch/x86/mm/p2m.c | 82 +++++++++++++++++++++++++ xen/arch/x86/mm/shadow/multi.c | 3 +- xen/include/asm-x86/p2m.h | 36 +++++++++-- xen/include/public/hvm/hvm_op.h | 37 ++++++++++++ 9 files changed, 395 insertions(+), 24 deletions(-)xen/arch/x86/hvm/emulate.c +7
-0@@ -94,11 +94,69 @@ static const struct hvm_io_handler null_handler = { .ops = &null_ops }; +static int mem_read (const struct hvm_io_handler *io_handler, +uint64_t addr, +uint32_t size, +uint64_t *data) +{ +struct domain *currd = current->domain; +unsigned long gmfn =paddr_to_pfn (addr);
xen/arch/x86/hvm/emulate.c static const struct hvm_io_handler null_handler = { · line 113
Quoted 10 lines
xen/arch/x86/hvm/emulate.c +10
-0+unsigned long offset = addr & ~PAGE_MASK ; +struct page_info *page =get_page_from_gfn (currd, gmfn,NULL ,P2M_UNSHARE ); +uint8_t *p; + +if ( !page ) +return X86EMUL_UNHANDLEABLE ; + + p =__map_domain_page (page); + p += offset; +memcpy (data, p, size);
What happens when offset + size crosses the page boundary?
Quoted 17 lines
xen/include/public/hvm/hvm_op.h +9
-0@@ -489,6 +489,43 @@ struct xen_hvm_altp2m_op {typedef struct xen_hvm_altp2m_op xen_hvm_altp2m_op_t ;DEFINE_XEN_GUEST_HANDLE (xen_hvm_altp2m_op_t); +#if defined(__XEN__) || defined(__XEN_TOOLS__) + +/* +* HVMOP_map_mem_type_to_ioreq_server : map or unmap the IOREQ Server <id> +* to specific memroy type <type> +* for specific accesses <flags> +* +* Note that if only write operations are to be forwarded to an ioreq server, +* read operations will be performed with no hypervisor intervention. But if
xen/include/public/hvm/hvm_op.h struct xen_hvm_altp2m_op { · line 510
Quoted 10 lines
xen/include/public/hvm/hvm_op.h +10
-0+* flags indicates that read operations are to be forwarded to an ioreq server, +* write operations will inevitably be trapped into hypervisor, whether they +* are emulated by hypervisor or forwarded to ioreq server depends on the flags +* setting. This situation means significant performance impact. +*/ +#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 */ +hvmmem_type_t type;/* IN - memory type */
hvmmem_type_t is an enum and doesn't have a fixed width. It can't be used in the public API.
You also have some implicit padding holes as a result of the layout.
~Andrew
Quoted 11 lines
xen/include/public/hvm/hvm_op.h +11
-0+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) +};
xen/include/public/hvm/hvm_op.h struct xen_hvm_altp2m_op { · line 531
Quoted 10 lines
xen/include/public/hvm/hvm_op.h +7
-0+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__) */ + +#endif /* __XEN_PUBLIC_HVM_HVM_OP_H__ */ /*
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
Quoted 72 lines · Andrew Cooper
Quoted 71 lines · 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 typep2m_ioreq_server. Users of this HVMOP can specify whether thep2m_ioreq_serveris supposed to handle write accesses or read ones or both in a parameter named flags. For now, we only support one ioreq server for this p2m type, so once an ioreq server has claimed its ownership, subsequent calls of theHVMOP_map_mem_type_to_ioreq_serverwill fail. Users can also disclaim the ownership of guest ram pages with this p2m type, by triggering this new HVMOP, with ioreq server id set to the current owner's and flags parameter set to 0.For now, both
HVMOP_map_mem_type_to_ioreq_serverandp2m_ioreq_serverare only supported for HVMs with HAP enabled.Note that flags parameter(if not 0) of this HVMOP only indicates which kind of memory accesses are to be forwarded to an ioreq server, it has impact on the access rights of guest ram pages, but are not the same. Due to hardware limitations, if only write operations are to be forwarded, read ones will be performed at full speed, with no hypervisor intervention. But if read ones are to be forwarded to an ioreq server, writes will inevitably be trapped into hypervisor, which means significant performance impact.
Also note that this
HVMOP_map_mem_type_to_ioreq_serverwill not change the p2m type of any guest ram page, untilHVMOP_set_mem_typeis triggered. So normally the steps should be the backend driver first claims its ownership of guest ram pages withp2m_ioreq_servertype, and then sets the memory type top2m_ioreq_serverfor specified guest ram pages.Signed-off-by Paul Durrant <[email protected]>Signed-off-by Yu Zhang <[email protected]>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 | 125 +++++++++++++++++++++++++++++++++++++-- xen/arch/x86/hvm/hvm.c | 95 +++++++++++++++++++++++++++-- xen/arch/x86/mm/hap/nested_hap.c | 2 +- xen/arch/x86/mm/p2m-ept.c | 14 ++++- xen/arch/x86/mm/p2m-pt.c | 25 +++++--- xen/arch/x86/mm/p2m.c | 82 +++++++++++++++++++++++++ xen/arch/x86/mm/shadow/multi.c | 3 +- xen/include/asm-x86/p2m.h | 36 +++++++++-- xen/include/public/hvm/hvm_op.h | 37 ++++++++++++ 9 files changed, 395 insertions(+), 24 deletions(-)xen/arch/x86/hvm/emulate.c +11
-0@@ -94,11 +94,69 @@ static const struct hvm_io_handler null_handler = { .ops = &null_ops }; +static int mem_read (const struct hvm_io_handler *io_handler, +uint64_t addr, +uint32_t size, +uint64_t *data) +{ +struct domain *currd = current->domain; +unsigned long gmfn =paddr_to_pfn (addr); +unsigned long offset = addr & ~PAGE_MASK ; +struct page_info *page =get_page_from_gfn (currd, gmfn,NULL ,P2M_UNSHARE ); +uint8_t *p; +
Quoted 9 lines
xen/arch/x86/hvm/emulate.c static const struct hvm_io_handler null_handler = { · line 113
Quoted 6 lines
xen/arch/x86/hvm/emulate.c +6
-0+if ( !page ) +return X86EMUL_UNHANDLEABLE ; + + p =__map_domain_page (page); + p += offset; +memcpy (data, p, size);What happens when offset + size crosses the page boundary?
The 'size' is set in hvmemul_linear_mmio_access(), to insure offset + size will not cross the page boundary.
Quoted 32 lines
Quoted 18 lines
xen/include/public/hvm/hvm_op.h +9
-0@@ -489,6 +489,43 @@ struct xen_hvm_altp2m_op {typedef struct xen_hvm_altp2m_op xen_hvm_altp2m_op_t ;DEFINE_XEN_GUEST_HANDLE (xen_hvm_altp2m_op_t); +#if defined(__XEN__) || defined(__XEN_TOOLS__) + +/* +* HVMOP_map_mem_type_to_ioreq_server : map or unmap the IOREQ Server <id> +* to specific memroy type <type> +* for specific accesses <flags> +* +* Note that if only write operations are to be forwarded to an ioreq server, +* read operations will be performed with no hypervisor intervention. But if xen/include/public/hvm/hvm_op.h struct xen_hvm_altp2m_op { · line 510
Quoted 10 lines
xen/include/public/hvm/hvm_op.h +10
-0+* flags indicates that read operations are to be forwarded to an ioreq server, +* write operations will inevitably be trapped into hypervisor, whether they +* are emulated by hypervisor or forwarded to ioreq server depends on the flags +* setting. This situation means significant performance impact. +*/ +#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 */ +hvmmem_type_t type;/* IN - memory type */
hvmmem_type_tis an enum and doesn't have a fixed width. It can't be used in the public API.
Quoted 2 lines
You also have some implicit padding holes as a result of the layout.
Oh, guess I should use uint16_t hvmmem_type(any maybe some pad if necessary).
Thanks for pointing this out, Andrew. :)
Quoted 22 lines
~Andrew
Quoted 20 lines
xen/include/public/hvm/hvm_op.h +18
-0+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__) */ + +#endif /* __XEN_PUBLIC_HVM_HVM_OP_H__ */
Quoted 3 lines
xen/include/public/hvm/hvm_op.h struct xen_hvm_altp2m_op { · line 531
Quoted 1 line
xen/include/public/hvm/hvm_op.h +0
-0/*
B.R.
Yu
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
Quoted 87 lines · Zhang
Quoted 74 lines · Andrew Cooper
Quoted 73 lines · 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 typep2m_ioreq_server. Users of this HVMOP can specify whether thep2m_ioreq_serveris supposed to handle write accesses or read ones or both in a parameter named flags. For now, we only support one ioreq server for this p2m type, so once an ioreq server has claimed its ownership, subsequent calls of theHVMOP_map_mem_type_to_ioreq_serverwill fail. Users can also disclaim the ownership of guest ram pages with this p2m type, by triggering this new HVMOP, with ioreq server id set to the current owner's and flags parameter set to 0.For now, both
HVMOP_map_mem_type_to_ioreq_serverandp2m_ioreq_serverare only supported for HVMs with HAP enabled.Note that flags parameter(if not 0) of this HVMOP only indicates which kind of memory accesses are to be forwarded to an ioreq server, it has impact on the access rights of guest ram pages, but are not the same. Due to hardware limitations, if only write operations are to be forwarded, read ones will be performed at full speed, with no hypervisor intervention. But if read ones are to be forwarded to an ioreq server, writes will inevitably be trapped into hypervisor, which means significant performance impact.
Also note that this
HVMOP_map_mem_type_to_ioreq_serverwill not change the p2m type of any guest ram page, untilHVMOP_set_mem_typeis triggered. So normally the steps should be the backend driver first claims its ownership of guest ram pages withp2m_ioreq_servertype, and then sets the memory type top2m_ioreq_serverfor specified guest ram pages.Signed-off-by Paul Durrant <[email protected]>Signed-off-by Yu Zhang <[email protected]>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 | 125 +++++++++++++++++++++++++++++++++++++-- xen/arch/x86/hvm/hvm.c | 95 +++++++++++++++++++++++++++-- xen/arch/x86/mm/hap/nested_hap.c | 2 +- xen/arch/x86/mm/p2m-ept.c | 14 ++++- xen/arch/x86/mm/p2m-pt.c | 25 +++++--- xen/arch/x86/mm/p2m.c | 82 +++++++++++++++++++++++++ xen/arch/x86/mm/shadow/multi.c | 3 +- xen/include/asm-x86/p2m.h | 36 +++++++++-- xen/include/public/hvm/hvm_op.h | 37 ++++++++++++ 9 files changed, 395 insertions(+), 24 deletions(-)xen/arch/x86/hvm/emulate.c +11
-0@@ -94,11 +94,69 @@ static const struct hvm_io_handler null_handler = { .ops = &null_ops }; +static int mem_read (const struct hvm_io_handler *io_handler, +uint64_t addr, +uint32_t size, +uint64_t *data) +{ +struct domain *currd = current->domain; +unsigned long gmfn =paddr_to_pfn (addr); +unsigned long offset = addr & ~PAGE_MASK ; +struct page_info *page =get_page_from_gfn (currd, gmfn,NULL ,P2M_UNSHARE ); +uint8_t *p; +Quoted 9 lines
xen/arch/x86/hvm/emulate.c static const struct hvm_io_handler null_handler = { · line 113
Quoted 6 lines
xen/arch/x86/hvm/emulate.c +6
-0+if ( !page ) +return X86EMUL_UNHANDLEABLE ; + + p =__map_domain_page (page); + p += offset; +memcpy (data, p, size);What happens when offset + size crosses the page boundary?
Quoted 2 lines
The 'size' is set in
hvmemul_linear_mmio_access(), to insure offset + size will not cross the page boundary.
Ok, in which case please
ASSERT(offset + size < PAGE_SIZE)
So it is absolutely clear in this function that the caller is required to honour this restriction.
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
Quoted 89 lines
Quoted 1 line
Quoted 1 line · On 11.04.16 at 14:20, <[email protected]> wrote:
Quoted 87 lines · Zhang
Quoted 83 lines · Andrew Cooper
Quoted 69 lines · 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 typep2m_ioreq_server. Users of this HVMOP can specify whether thep2m_ioreq_serveris supposed to handle write accesses or read ones or both in a parameter named flags. For now, we only support one ioreq server for this p2m type, so once an ioreq server has claimed its ownership, subsequent calls of theHVMOP_map_mem_type_to_ioreq_serverwill fail. Users can also disclaim the ownership of guest ram pages with this p2m type, by triggering this new HVMOP, with ioreq server id set to the current owner's and flags parameter set to 0.For now, both
HVMOP_map_mem_type_to_ioreq_serverandp2m_ioreq_serverare only supported for HVMs with HAP enabled.Note that flags parameter(if not 0) of this HVMOP only indicates which kind of memory accesses are to be forwarded to an ioreq server, it has impact on the access rights of guest ram pages, but are not the same. Due to hardware limitations, if only write operations are to be forwarded, read ones will be performed at full speed, with no hypervisor intervention. But if read ones are to be forwarded to an ioreq server, writes will inevitably be trapped into hypervisor, which means significant performance impact.
Also note that this
HVMOP_map_mem_type_to_ioreq_serverwill not change the p2m type of any guest ram page, untilHVMOP_set_mem_typeis triggered. So normally the steps should be the backend driver first claims its ownership of guest ram pages withp2m_ioreq_servertype, and then sets the memory type top2m_ioreq_serverfor specified guest ram pages.Signed-off-by Paul Durrant <[email protected]>Signed-off-by Yu Zhang <[email protected]>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 | 125 +++++++++++++++++++++++++++++++++++++-- xen/arch/x86/hvm/hvm.c | 95 +++++++++++++++++++++++++++-- xen/arch/x86/mm/hap/nested_hap.c | 2 +- xen/arch/x86/mm/p2m-ept.c | 14 ++++- xen/arch/x86/mm/p2m-pt.c | 25 +++++--- xen/arch/x86/mm/p2m.c | 82 +++++++++++++++++++++++++ xen/arch/x86/mm/shadow/multi.c | 3 +- xen/include/asm-x86/p2m.h | 36 +++++++++-- xen/include/public/hvm/hvm_op.h | 37 ++++++++++++ 9 files changed, 395 insertions(+), 24 deletions(-)xen/arch/x86/hvm/emulate.c +8
-0@@ -94,11 +94,69 @@ static const struct hvm_io_handler null_handler = { .ops = &null_ops }; +static int mem_read (const struct hvm_io_handler *io_handler, +uint64_t addr, +uint32_t size, +uint64_t *data) +{ +struct domain *currd = current->domain; +unsigned long gmfn =paddr_to_pfn (addr); +unsigned long offset = addr & ~PAGE_MASK ;xen/arch/x86/hvm/emulate.c static const struct hvm_io_handler null_handler = { · line 114
Quoted 10 lines
xen/arch/x86/hvm/emulate.c +9
-0+struct page_info *page =get_page_from_gfn (currd, gmfn,NULL ,P2M_UNSHARE ); +uint8_t *p; + +if ( !page ) +return X86EMUL_UNHANDLEABLE ; + + p =__map_domain_page (page); + p += offset; +memcpy (data, p, size);What happens when offset + size crosses the page boundary?
Quoted 6 lines
Quoted 2 lines
The 'size' is set in
hvmemul_linear_mmio_access(), to insure offset + size will not cross the page boundary.Ok, in which case please
ASSERT(offset + size < PAGE_SIZE)
<=
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
In reply to Yu ZhangQuoted 8 lines
Quoted 1 line
Quoted 1 line · On 31.03.16 at 12:53, <[email protected]> wrote:
xen/arch/x86/hvm/emulate.c +7
-0+static int mem_write (const struct hvm_io_handler *handler, +uint64_t addr, +uint32_t size, +uint64_t data) +{ +struct domain *currd = current->domain; +unsigned long gmfn =paddr_to_pfn (addr);
xen/arch/x86/hvm/emulate.c static const struct hvm_io_handler null_handler = { · line 137
Quoted 10 lines
xen/arch/x86/hvm/emulate.c +10
-0+unsigned long offset = addr & ~PAGE_MASK ; +struct page_info *page =get_page_from_gfn (currd, gmfn,NULL ,P2M_UNSHARE ); +uint8_t *p; + +if ( !page ) +return X86EMUL_UNHANDLEABLE ; + + p =__map_domain_page (page); + p += offset; +memcpy (p, &data, size);
What if the page is a r/o one? Not having found an ioreq server, I'm not sure assumptions on the page being writable can validly be made.
Quoted 12 lines
xen/arch/x86/hvm/emulate.c +6
-2@@ -168,13 +226,72 @@ 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);
xen/arch/x86/hvm/emulate.c static int hvmemul_do_io( · line 244
Quoted 10 lines
xen/arch/x86/hvm/emulate.c +10
-0+ + (void )get_gfn_query_unlocked (currd, gmfn, &p2mt); + +switch ( p2mt ) + { +case p2m_ioreq_server: + { +unsigned long flags; + +p2m_get_ioreq_server (currd, &flags, &s);
As the function apparently returns no value right now, please avoid the indirection on both values you're after - one of the two (presumably s) can be the function's return value.
xen/arch/x86/hvm/emulate.c static int hvmemul_do_io( · line 252
Quoted 7 lines
xen/arch/x86/hvm/emulate.c +7
-0+if ( !s ) +break ; + +if ( (dir ==IOREQ_READ && + !(flags &P2M_IOREQ_HANDLE_READ_ACCESS )) || + (dir ==IOREQ_WRITE && + !(flags &P2M_IOREQ_HANDLE_WRITE_ACCESS )) )
I think this would be easier to read using a conditional expression with the condition being dir == IOREQ_<one-of-the-two>, just selecting either of the two possible bit masks.
xen/arch/x86/hvm/emulate.c static int hvmemul_do_io( · line 257
Quoted 5 lines
xen/arch/x86/hvm/emulate.c +5
-0+ s =NULL ; + +break ; + } +case p2m_ram_rw:
Blank line above here please.
Quoted 4 lines
xen/arch/x86/hvm/emulate.c +0
-1/* If there is no suitable backing DM, just ignore accesses */ if ( !s ) { - rc =hvm_process_io_intercept (&null_handler, &p);
xen/arch/x86/hvm/emulate.c static int hvmemul_do_io( · line 285
Quoted 10 lines
xen/arch/x86/hvm/emulate.c +10
-0+switch ( p2mt ) + { +case p2m_ioreq_server: +/* +* Race conditions may exist when access to a gfn with +* p2m_ioreq_server is intercepted by hypervisor, during +* which time p2m type of this gfn is recalculated back +* to p2m_ram_rw. mem_handler is used to handle this +* corner case. +*/
Now if there is such a race condition, the race could also be with a page changing first to ram_rw and then immediately further to e.g. ram_ro. See the earlier comment about assuming the page to be writable.
xen/arch/x86/hvm/emulate.c static int hvmemul_do_io( · line 291
Quoted 6 lines
xen/arch/x86/hvm/emulate.c +6
-0+case p2m_ram_rw: + rc =hvm_process_io_intercept (&mem_handler, &p); +break ; + +default : + rc =hvm_process_io_intercept (&null_handler, &p);
Along with the above, I doubt it is correct to have e.g. ram_ro come here.
Quoted 22 lines
xen/arch/x86/hvm/hvm.c +22
-0+static int hvm_map_mem_type_to_ioreq_server (struct domain *d, +ioservid_t id, +hvmmem_type_t type, +uint32_t flags) +{ +struct hvm_ioreq_server *s; +int rc; + +/* For now, only HVMMEM_ioreq_server is supported */ +if ( type != HVMMEM_ioreq_server ) +return -EINVAL ; + +if ( flags & ~(HVMOP_IOREQ_MEM_ACCESS_READ | +HVMOP_IOREQ_MEM_ACCESS_WRITE ) ) +return -EINVAL ; + +spin_lock (&d->arch.hvm_domain.ioreq_server.lock); + + rc = -ENOENT ; +list_for_each_entry ( s, + &d->arch.hvm_domain.ioreq_server.list, + list_entry )
xen/arch/x86/hvm/hvm.c static int hvm_unmap_io_range_from_ioreq_server(struct domain *d, ioservid_t id, · line 1447
Quoted 10 lines
xen/arch/x86/hvm/hvm.c +10
-0+ { +if ( s == d->arch.hvm_domain.default_ioreq_server ) +continue ; + +if ( s->id == id ) + { + rc =p2m_set_ioreq_server (d, flags, s); +if ( rc ==0 ) +gdprintk (XENLOG_DEBUG ,"%u %s type HVMMEM_ioreq_server.\n" , + s->id, (flags !=0 ) ?"mapped to" :"unmapped from" );
Why gdprintk()? I don't think the current domain is of much interest here. What would be of interest is the subject domain.
Quoted 7 lines
xen/arch/x86/mm/p2m-ept.c +0
-0@@ -132,6 +132,19 @@ 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 ;
xen/arch/x86/mm/p2m-ept.c static void ept_p2m_type_to_flags(struct p2m_domain · line 145
Quoted 10 lines
xen/arch/x86/mm/p2m-ept.c +10
-0+case p2m_ioreq_server: + entry->r = !(p2m->ioreq.flags &P2M_IOREQ_HANDLE_READ_ACCESS ); +/* +* write access right is disabled when entry->r is 0, but whether +* write accesses are emulated by hypervisor or forwarded to an +* ioreq server depends on the setting of p2m->ioreq.flags. +*/ + entry->w = (entry->r && + !(p2m->ioreq.flags &P2M_IOREQ_HANDLE_WRITE_ACCESS )); + entry->x = entry->r;
Why would we want to allow instruction execution from such pages? And with all three bits now possibly being clear, aren't we risking the entries to be mis-treated as not-present ones?
xen/arch/x86/mm/p2m-pt.c static const unsigned long pgt[] = { · line 75
Quoted 9 lines
xen/arch/x86/mm/p2m-pt.c +1
-2@@ -72,8 +72,8 @@ static const unsigned long pgt[] = {PGT_l3_page_table }; -static unsigned long p2m_type_to_flags (p2m_type_t t,mfn_t mfn, -unsigned int level) +static unsigned long p2m_type_to_flags(struct p2m_domain *p2m, p2m_type_t t,
const
Quoted 5 lines
xen/arch/x86/mm/p2m-pt.c +5
-0+int p2m_set_ioreq_server (struct domain *d, +unsigned long flags, +struct hvm_ioreq_server *s) +{ +struct p2m_domain *p2m =p2m_get_hostp2m (d);
xen/arch/x86/mm/p2m-pt.c static const unsigned long pgt[] = {
Quoted 10 lines
xen/arch/x86/mm/p2m-pt.c +10
-0+int rc; + +spin_lock (&p2m->ioreq.lock); + + rc = -EBUSY ; +if ( (flags !=0 ) && (p2m->ioreq.server !=NULL ) ) + goto out; + + rc = -EINVAL ; +/* unmap ioreq server from p2m type by passing flags with 0 */
Comment style (also elsewhere).
xen/arch/x86/mm/p2m-pt.c
Quoted 2 lines
xen/arch/x86/mm/p2m-pt.c +2
-0+if ( (flags ==0 ) && (p2m->ioreq.server != s) ) + goto out;
The two flags checks above are redundant with ...
xen/arch/x86/mm/p2m-pt.c
Quoted 10 lines
xen/arch/x86/mm/p2m-pt.c +10
-0+if ( flags ==0 ) + { + p2m->ioreq.server =NULL ; + p2m->ioreq.flags =0 ; + } +else + { + p2m->ioreq.server = s; + p2m->ioreq.flags = flags; + }
... this - I think the earlier ones should be folded into this.
xen/arch/x86/mm/p2m-pt.c
Quoted 6 lines
xen/arch/x86/mm/p2m-pt.c +6
-0+/* +* Each time we map/unmap an ioreq server to/from p2m_ioreq_server, +* we mark the p2m table to be recalculated, so that gfns which were +* previously marked with p2m_ioreq_server can be resynced. +*/ +p2m_change_entry_type_global (d, p2m_ioreq_server, p2m_ram_rw);
What does "resynced" here mean? I.e. I can see why this is wanted when unmapping a server, but when mapping a server there shouldn't be any such pages in the first place.
xen/arch/x86/mm/p2m-pt.c
Quoted 3 lines
xen/arch/x86/mm/p2m-pt.c +3
-0+ rc =0 ; + +out:
Labels indented by at least one space please.
Quoted 10 lines
xen/arch/x86/mm/p2m-pt.c +6
-0@@ -320,6 +321,27 @@ 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).
xen/arch/x86/mm/p2m-pt.c struct p2m_domain { · line 339
Quoted 10 lines
xen/arch/x86/mm/p2m-pt.c +10
-0+* Behaviors of gfns with p2m_ioreq_server set but no +* ioreq server mapped in advance should be the same as +* p2m_ram_rw. +*/ +struct hvm_ioreq_server *server; +/* +* flags specifies whether read, write or both operations +* are to be emulated by an ioreq server. +*/ +unsigned long flags;
unsigned int
xen/include/public/hvm/hvm_op.h struct xen_hvm_altp2m_op { · line 492
Quoted 7 lines
xen/include/public/hvm/hvm_op.h +1
-0@@ -489,6 +489,43 @@ struct xen_hvm_altp2m_op {typedef struct xen_hvm_altp2m_op xen_hvm_altp2m_op_t ;DEFINE_XEN_GUEST_HANDLE (xen_hvm_altp2m_op_t); +#if defined(__XEN__) || defined(__XEN_TOOLS__)
Instead of adding yet another such section, couldn't this be added to an already existing one?
xen/include/public/hvm/hvm_op.h struct xen_hvm_altp2m_op { · line 510
Quoted 4 lines
xen/include/public/hvm/hvm_op.h +4
-0+struct xen_hvm_map_mem_type_to_ioreq_server { +domid_t domid;/* IN - domain to be serviced */ +ioservid_t id;/* IN - ioreq server id */ +hvmmem_type_t type;/* IN - memory type */
You can't use this type for public interface structure fields - this must be uintXX_t.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
Quoted 40 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 31.03.16 at 12:53, <[email protected]> wrote:
xen/arch/x86/hvm/emulate.c +7
-0+static int mem_write (const struct hvm_io_handler *handler, +uint64_t addr, +uint32_t size, +uint64_t data) +{ +struct domain *currd = current->domain; +unsigned long gmfn =paddr_to_pfn (addr);xen/arch/x86/hvm/emulate.c static const struct hvm_io_handler null_handler = { · line 137
Quoted 10 lines
xen/arch/x86/hvm/emulate.c +10
-0+unsigned long offset = addr & ~PAGE_MASK ; +struct page_info *page =get_page_from_gfn (currd, gmfn,NULL ,P2M_UNSHARE ); +uint8_t *p; + +if ( !page ) +return X86EMUL_UNHANDLEABLE ; + + p =__map_domain_page (page); + p += offset; +memcpy (p, &data, size);What if the page is a r/o one? Not having found an ioreq server, I'm not sure assumptions on the page being writable can validly be made.
Quoted 18 lines
xen/arch/x86/hvm/emulate.c +12
-2@@ -168,13 +226,72 @@ 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); + +switch ( p2mt ) + { +case p2m_ioreq_server:
Quoted 9 lines
xen/arch/x86/hvm/emulate.c static int hvmemul_do_io( · line 244
Quoted 4 lines
xen/arch/x86/hvm/emulate.c +4
-0+ { +unsigned long flags; + +p2m_get_ioreq_server (currd, &flags, &s);As the function apparently returns no value right now, please avoid the indirection on both values you're after - one of the two (presumably s) can be the function's return value.
Well, current implementation of p2m_get_ioreq_server() has spin_lock/ spin_unlock surrounding the reading of flags and the s, but I believe we can also use the s as return value.
Quoted 35 lines
xen/arch/x86/hvm/emulate.c static int hvmemul_do_io( · line 252
Quoted 7 lines
xen/arch/x86/hvm/emulate.c +7
-0+if ( !s ) +break ; + +if ( (dir ==IOREQ_READ && + !(flags &P2M_IOREQ_HANDLE_READ_ACCESS )) || + (dir ==IOREQ_WRITE && + !(flags &P2M_IOREQ_HANDLE_WRITE_ACCESS )) )I think this would be easier to read using a conditional expression with the condition being dir == IOREQ_<one-of-the-two>, just selecting either of the two possible bit masks.
xen/arch/x86/hvm/emulate.c static int hvmemul_do_io( · line 257
Quoted 5 lines
xen/arch/x86/hvm/emulate.c +5
-0+ s =NULL ; + +break ; + } +case p2m_ram_rw:Blank line above here please.
Quoted 4 lines
xen/arch/x86/hvm/emulate.c +0
-1/* If there is no suitable backing DM, just ignore accesses */ if ( !s ) { - rc =hvm_process_io_intercept (&null_handler, &p);xen/arch/x86/hvm/emulate.c static int hvmemul_do_io( · line 285
Quoted 10 lines
xen/arch/x86/hvm/emulate.c +10
-0+switch ( p2mt ) + { +case p2m_ioreq_server: +/* +* Race conditions may exist when access to a gfn with +* p2m_ioreq_server is intercepted by hypervisor, during +* which time p2m type of this gfn is recalculated back +* to p2m_ram_rw. mem_handler is used to handle this +* corner case. +*/
Quoted 5 lines
Now if there is such a race condition, the race could also be with a page changing first to
ram_rwand then immediately further to e.g.ram_ro. See the earlier comment about assuming the page to be writable.
Thanks, Jan. After rechecking the code, I suppose the race condition will not happen. In hvmemul_do_io(), get_gfn_query_unlocked() is used to peek the p2mt for the gfn, but get_gfn_type_access() is called inside hvm_hap_nested_page_fault(), and this will guarantee no p2m change shall occur during the emulation.
Is this understanding correct?
Quoted 10 lines
xen/arch/x86/hvm/emulate.c static int hvmemul_do_io( · line 291
Quoted 6 lines
xen/arch/x86/hvm/emulate.c +6
-0+case p2m_ram_rw: + rc =hvm_process_io_intercept (&mem_handler, &p); +break ; + +default : + rc =hvm_process_io_intercept (&null_handler, &p);Along with the above, I doubt it is correct to have e.g.
ram_rocome here.
So if no race condition happens, no need to treat p2m_ram_rw specially.
Quoted 27 lines
Quoted 27 lines
xen/arch/x86/hvm/hvm.c +27
-0+static int hvm_map_mem_type_to_ioreq_server (struct domain *d, +ioservid_t id, +hvmmem_type_t type, +uint32_t flags) +{ +struct hvm_ioreq_server *s; +int rc; + +/* For now, only HVMMEM_ioreq_server is supported */ +if ( type != HVMMEM_ioreq_server ) +return -EINVAL ; + +if ( flags & ~(HVMOP_IOREQ_MEM_ACCESS_READ | +HVMOP_IOREQ_MEM_ACCESS_WRITE ) ) +return -EINVAL ; + +spin_lock (&d->arch.hvm_domain.ioreq_server.lock); + + rc = -ENOENT ; +list_for_each_entry ( s, + &d->arch.hvm_domain.ioreq_server.list, + list_entry ) + { +if ( s == d->arch.hvm_domain.default_ioreq_server ) +continue ; + +if ( s->id == id )
Quoted 9 lines
xen/arch/x86/hvm/hvm.c static int hvm_unmap_io_range_from_ioreq_server(struct domain *d, ioservid_t id, · line 1447
Quoted 5 lines
xen/arch/x86/hvm/hvm.c +5
-0+ { + rc =p2m_set_ioreq_server (d, flags, s); +if ( rc ==0 ) +gdprintk (XENLOG_DEBUG ,"%u %s type HVMMEM_ioreq_server.\n" , + s->id, (flags !=0 ) ?"mapped to" :"unmapped from" );Why
gdprintk()? I don't think the current domain is of much interest here. What would be of interest is the subject domain.
s->id is not the domain_id, but id of the ioreq server.
Quoted 13 lines
Quoted 13 lines
xen/arch/x86/mm/p2m-ept.c +6
-0@@ -132,6 +132,19 @@ 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 = !(p2m->ioreq.flags &P2M_IOREQ_HANDLE_READ_ACCESS ); +/* +* write access right is disabled when entry->r is 0, but whether +* write accesses are emulated by hypervisor or forwarded to an +* ioreq server depends on the setting of p2m->ioreq.flags.
Quoted 9 lines
xen/arch/x86/mm/p2m-ept.c static void ept_p2m_type_to_flags(struct p2m_domain *p2m, ept_entry_t *entry, · line 144
Quoted 4 lines
xen/arch/x86/mm/p2m-ept.c +4
-0+*/ + entry->w = (entry->r && + !(p2m->ioreq.flags &P2M_IOREQ_HANDLE_WRITE_ACCESS )); + entry->x = entry->r;Why would we want to allow instruction execution from such pages? And with all three bits now possibly being clear, aren't we risking the entries to be mis-treated as not-present ones?
Hah. You got me. Thanks! :)
Now I realized it would be difficult if we wanna to emulate the read operations for HVM. According to Intel mannual, entry->r is to be cleared, so should entry->w if we do not want ept misconfig. And with both read and write permissions being forbidden, entry->x can be set only on processors with EXECUTE_ONLY capability.
To avoid any entry to be mis-treated as not-present. We have several solutions:
a> do not support the read emulation for now - we have no such usage case;
b> add the check of p2m_t against p2m_ioreq_server in is_epte_present - a bit weird to me.
Which one do you prefer? or any other suggestions?
Quoted 46 lines
xen/arch/x86/mm/p2m-pt.c static const unsigned long pgt[] = { · line 75
Quoted 9 lines
xen/arch/x86/mm/p2m-pt.c +1
-2@@ -72,8 +72,8 @@ static const unsigned long pgt[] = {PGT_l3_page_table }; -static unsigned long p2m_type_to_flags (p2m_type_t t,mfn_t mfn, -unsigned int level) +static unsigned long p2m_type_to_flags(struct p2m_domain *p2m, p2m_type_t t,const
Quoted 5 lines
xen/arch/x86/mm/p2m-pt.c +5
-0+int p2m_set_ioreq_server (struct domain *d, +unsigned long flags, +struct hvm_ioreq_server *s) +{ +struct p2m_domain *p2m =p2m_get_hostp2m (d);xen/arch/x86/mm/p2m-pt.c static const unsigned long pgt[] = {
Quoted 10 lines
xen/arch/x86/mm/p2m-pt.c +10
-0+int rc; + +spin_lock (&p2m->ioreq.lock); + + rc = -EBUSY ; +if ( (flags !=0 ) && (p2m->ioreq.server !=NULL ) ) + goto out; + + rc = -EINVAL ; +/* unmap ioreq server from p2m type by passing flags with 0 */ Comment style (also elsewhere).
xen/arch/x86/mm/p2m-pt.c
Quoted 2 lines
xen/arch/x86/mm/p2m-pt.c +2
-0+if ( (flags ==0 ) && (p2m->ioreq.server != s) ) + goto out;The two flags checks above are redundant with ...
xen/arch/x86/mm/p2m-pt.c
Quoted 10 lines
xen/arch/x86/mm/p2m-pt.c +10
-0+if ( flags ==0 ) + { + p2m->ioreq.server =NULL ; + p2m->ioreq.flags =0 ; + } +else + { + p2m->ioreq.server = s; + p2m->ioreq.flags = flags; + }
Quoted 2 lines
... this - I think the earlier ones should be folded into this.
Ok. I'll have a try. :)
Quoted 11 lines
xen/arch/x86/mm/p2m-pt.c
Quoted 6 lines
xen/arch/x86/mm/p2m-pt.c +6
-0+/* +* Each time we map/unmap an ioreq server to/from p2m_ioreq_server, +* we mark the p2m table to be recalculated, so that gfns which were +* previously marked with p2m_ioreq_server can be resynced. +*/ +p2m_change_entry_type_global (d, p2m_ioreq_server, p2m_ram_rw);What does "resynced" here mean? I.e. I can see why this is wanted when unmapping a server, but when mapping a server there shouldn't be any such pages in the first place.
There shouldn't be. But if there is(misbehavior from the device model side), it can be recalculated back to p2m_ram_rw(which is not quite necessary as the unmapping case).
Quoted 35 lines
xen/arch/x86/mm/p2m-pt.c
Quoted 3 lines
xen/arch/x86/mm/p2m-pt.c +3
-0+ rc =0 ; + +out:Labels indented by at least one space please.
Quoted 10 lines
xen/arch/x86/mm/p2m-pt.c +6
-0@@ -320,6 +321,27 @@ 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). xen/arch/x86/mm/p2m-pt.c struct p2m_domain { · line 339
Quoted 10 lines
xen/arch/x86/mm/p2m-pt.c +10
-0+* Behaviors of gfns with p2m_ioreq_server set but no +* ioreq server mapped in advance should be the same as +* p2m_ram_rw. +*/ +struct hvm_ioreq_server *server; +/* +* flags specifies whether read, write or both operations +* are to be emulated by an ioreq server. +*/ +unsigned long flags;unsigned int
Quoted 6 lines
xen/include/public/hvm/hvm_op.h +0
-0@@ -489,6 +489,43 @@ struct xen_hvm_altp2m_op {typedef struct xen_hvm_altp2m_op xen_hvm_altp2m_op_t ;DEFINE_XEN_GUEST_HANDLE (xen_hvm_altp2m_op_t);
Quoted 5 lines
xen/include/public/hvm/hvm_op.h struct xen_hvm_altp2m_op { · line 492
Quoted 1 line
xen/include/public/hvm/hvm_op.h +1
-0+#if defined(__XEN__) || defined(__XEN_TOOLS__)Instead of adding yet another such section, couldn't this be added to an already existing one?
Yes.
Quoted 8 lines
xen/include/public/hvm/hvm_op.h struct xen_hvm_altp2m_op { · line 510
Quoted 4 lines
xen/include/public/hvm/hvm_op.h +4
-0+struct xen_hvm_map_mem_type_to_ioreq_server { +domid_t domid;/* IN - domain to be serviced */ +ioservid_t id;/* IN - ioreq server id */ +hvmmem_type_t type;/* IN - memory type */ You can't use this type for public interface structure fields - this must be
uintXX_t.
Got it.
Thanks
Yu
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
Quoted 30 lines
Quoted 1 line
Quoted 1 line · On 11.04.16 at 13:14, <[email protected]> wrote:
Quoted 19 lines · Jan Beulich
Quoted 19 lines
Quoted 1 line
Quoted 1 line · On 31.03.16 at 12:53, <[email protected]> wrote:
xen/arch/x86/hvm/emulate.c +12
-2@@ -168,13 +226,72 @@ 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); + +switch ( p2mt ) + { +case p2m_ioreq_server:Quoted 8 lines
xen/arch/x86/hvm/emulate.c static int hvmemul_do_io( · line 244
Quoted 4 lines
xen/arch/x86/hvm/emulate.c +4
-0+ { +unsigned long flags; + +p2m_get_ioreq_server (currd, &flags, &s);As the function apparently returns no value right now, please avoid the indirection on both values you're after - one of the two (presumably s) can be the function's return value.
Quoted 3 lines
Well, current implementation of
p2m_get_ioreq_server()has spin_lock/spin_unlocksurrounding the reading of flags and the s, but I believe we can also use the s as return value.
The use of a lock inside the function has nothing to do with how it returns values to the caller.
Quoted 21 lines
Quoted 15 lines
Quoted 4 lines
xen/arch/x86/hvm/emulate.c +0
-1/* If there is no suitable backing DM, just ignore accesses */ if ( !s ) { - rc =hvm_process_io_intercept (&null_handler, &p);xen/arch/x86/hvm/emulate.c static int hvmemul_do_io( · line 285
Quoted 10 lines
xen/arch/x86/hvm/emulate.c +10
-0+switch ( p2mt ) + { +case p2m_ioreq_server: +/* +* Race conditions may exist when access to a gfn with +* p2m_ioreq_server is intercepted by hypervisor, during +* which time p2m type of this gfn is recalculated back +* to p2m_ram_rw. mem_handler is used to handle this +* corner case. +*/ Quoted 5 lines
Now if there is such a race condition, the race could also be with a page changing first to
ram_rwand then immediately further to e.g.ram_ro. See the earlier comment about assuming the page to be writable.
Quoted 6 lines
Thanks, Jan. After rechecking the code, I suppose the race condition will not happen. In
hvmemul_do_io(),get_gfn_query_unlocked()is used to peek the p2mt for the gfn, butget_gfn_type_access()is called insidehvm_hap_nested_page_fault(), and this will guarantee no p2m change shall occur during the emulation.
Is this understanding correct?
Ah, yes, I think so. So the comment is misleading.
Quoted 37 lines
Quoted 27 lines
Quoted 27 lines
xen/arch/x86/hvm/hvm.c +27
-0+static int hvm_map_mem_type_to_ioreq_server (struct domain *d, +ioservid_t id, +hvmmem_type_t type, +uint32_t flags) +{ +struct hvm_ioreq_server *s; +int rc; + +/* For now, only HVMMEM_ioreq_server is supported */ +if ( type != HVMMEM_ioreq_server ) +return -EINVAL ; + +if ( flags & ~(HVMOP_IOREQ_MEM_ACCESS_READ | +HVMOP_IOREQ_MEM_ACCESS_WRITE ) ) +return -EINVAL ; + +spin_lock (&d->arch.hvm_domain.ioreq_server.lock); + + rc = -ENOENT ; +list_for_each_entry ( s, + &d->arch.hvm_domain.ioreq_server.list, + list_entry ) + { +if ( s == d->arch.hvm_domain.default_ioreq_server ) +continue ; + +if ( s->id == id )Quoted 9 lines
xen/arch/x86/hvm/hvm.c static int hvm_unmap_io_range_from_ioreq_server(struct domain *d, ioservid_t id, · line 1447
Quoted 5 lines
xen/arch/x86/hvm/hvm.c +5
-0+ { + rc =p2m_set_ioreq_server (d, flags, s); +if ( rc ==0 ) +gdprintk (XENLOG_DEBUG ,"%u %s type HVMMEM_ioreq_server.\n" , + s->id, (flags !=0 ) ?"mapped to" :"unmapped from" );Why
gdprintk()? I don't think the current domain is of much interest here. What would be of interest is the subject domain.
Quoted 1 line
s->idis not thedomain_id, but id of the ioreq server.
That's understood. But gdprintk() itself logs the current domain, which isn't as useful as the subject one.
Quoted 23 lines
Quoted 13 lines
Quoted 13 lines
xen/arch/x86/mm/p2m-ept.c +6
-0@@ -132,6 +132,19 @@ 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 = !(p2m->ioreq.flags &P2M_IOREQ_HANDLE_READ_ACCESS ); +/* +* write access right is disabled when entry->r is 0, but whether +* write accesses are emulated by hypervisor or forwarded to an +* ioreq server depends on the setting of p2m->ioreq.flags. Quoted 9 lines
xen/arch/x86/mm/p2m-ept.c static void ept_p2m_type_to_flags(struct p2m_domain *p2m, ept_entry_t *entry, · line 144
Quoted 4 lines
xen/arch/x86/mm/p2m-ept.c +4
-0+*/ + entry->w = (entry->r && + !(p2m->ioreq.flags &P2M_IOREQ_HANDLE_WRITE_ACCESS )); + entry->x = entry->r;Why would we want to allow instruction execution from such pages? And with all three bits now possibly being clear, aren't we risking the entries to be mis-treated as not-present ones?
Quoted 13 lines
Hah. You got me. Thanks! :)
Now I realized it would be difficult if we wanna to emulate the read operations for HVM. According to Intel mannual,entry->ris to be cleared, so shouldentry->wif we do not want ept misconfig. And with both read and write permissions being forbidden,entry->xcan be set only on processors withEXECUTE_ONLYcapability.
To avoid any entry to be mis-treated as not-present. We have several solutions:
a> do not support the read emulation for now - we have no such usage case;
b> add the check ofp2m_tagainstp2m_ioreq_serverinis_epte_present- a bit weird to me.
Which one do you prefer? or any other suggestions?
That question would also need to be asked to others who had suggested supporting both. I'd be fine with a, but I also don't view b as too awkward.
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
xen/arch/x86/mm/p2m-ept.c +6
-0+/* +* Each time we map/unmap an ioreq server to/from p2m_ioreq_server, +* we mark the p2m table to be recalculated, so that gfns which were +* previously marked with p2m_ioreq_server can be resynced. +*/ +p2m_change_entry_type_global (d, p2m_ioreq_server, p2m_ram_rw);
Quoted 8 lines
Quoted 4 lines
What does "resynced" here mean? I.e. I can see why this is wanted when unmapping a server, but when mapping a server there shouldn't be any such pages in the first place.
There shouldn't be. But if there is(misbehavior from the device model side), it can be recalculated back to
p2m_ram_rw(which is not quite necessary as the unmapping case).
DM misbehavior should not result in such a problem - the hypervisor should refuse any bad requests.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
Quoted 30 lines · Jan Beulich
Quoted 30 lines
Quoted 1 line
Quoted 1 line · On 11.04.16 at 13:14, <[email protected]> wrote:
Quoted 27 lines · Jan Beulich
Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 31.03.16 at 12:53, <[email protected]> wrote:
xen/arch/x86/hvm/emulate.c +6
-2@@ -168,13 +226,72 @@ 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);xen/arch/x86/hvm/emulate.c static int hvmemul_do_io( · line 244
Quoted 10 lines
xen/arch/x86/hvm/emulate.c +10
-0+ + (void )get_gfn_query_unlocked (currd, gmfn, &p2mt); + +switch ( p2mt ) + { +case p2m_ioreq_server: + { +unsigned long flags; + +p2m_get_ioreq_server (currd, &flags, &s);As the function apparently returns no value right now, please avoid the indirection on both values you're after - one of the two (presumably s) can be the function's return value.
Quoted 7 lines
Quoted 3 lines
Well, current implementation of
p2m_get_ioreq_server()has spin_lock/spin_unlocksurrounding the reading of flags and the s, but I believe we can also use the s as return value.The use of a lock inside the function has nothing to do with how it returns values to the caller.
Agree. I'll use s as return value then.
Quoted 21 lines
Quoted 21 lines
Quoted 20 lines
Quoted 4 lines
xen/arch/x86/hvm/emulate.c +0
-1/* If there is no suitable backing DM, just ignore accesses */ if ( !s ) { - rc =hvm_process_io_intercept (&null_handler, &p);xen/arch/x86/hvm/emulate.c static int hvmemul_do_io( · line 285
Quoted 10 lines
xen/arch/x86/hvm/emulate.c +10
-0+switch ( p2mt ) + { +case p2m_ioreq_server: +/* +* Race conditions may exist when access to a gfn with +* p2m_ioreq_server is intercepted by hypervisor, during +* which time p2m type of this gfn is recalculated back +* to p2m_ram_rw. mem_handler is used to handle this +* corner case. +*/ Now if there is such a race condition, the race could also be with a page changing first to
ram_rwand then immediately further to e.g.ram_ro. See the earlier comment about assuming the page to be writable.
Quoted 9 lines
Quoted 6 lines
Thanks, Jan. After rechecking the code, I suppose the race condition will not happen. In
hvmemul_do_io(),get_gfn_query_unlocked()is used to peek the p2mt for the gfn, butget_gfn_type_access()is called insidehvm_hap_nested_page_fault(), and this will guarantee no p2m change shall occur during the emulation.
Is this understanding correct?Ah, yes, I think so. So the comment is misleading.
I'll remove the comment, together with the p2m_ram_rw case. Thanks. :)
Quoted 37 lines
Quoted 37 lines
Quoted 36 lines
Quoted 22 lines
xen/arch/x86/hvm/hvm.c +22
-0+static int hvm_map_mem_type_to_ioreq_server (struct domain *d, +ioservid_t id, +hvmmem_type_t type, +uint32_t flags) +{ +struct hvm_ioreq_server *s; +int rc; + +/* For now, only HVMMEM_ioreq_server is supported */ +if ( type != HVMMEM_ioreq_server ) +return -EINVAL ; + +if ( flags & ~(HVMOP_IOREQ_MEM_ACCESS_READ | +HVMOP_IOREQ_MEM_ACCESS_WRITE ) ) +return -EINVAL ; + +spin_lock (&d->arch.hvm_domain.ioreq_server.lock); + + rc = -ENOENT ; +list_for_each_entry ( s, + &d->arch.hvm_domain.ioreq_server.list, + list_entry )xen/arch/x86/hvm/hvm.c static int hvm_unmap_io_range_from_ioreq_server(struct domain *d, ioservid_t id, · line 1447
Quoted 10 lines
xen/arch/x86/hvm/hvm.c +10
-0+ { +if ( s == d->arch.hvm_domain.default_ioreq_server ) +continue ; + +if ( s->id == id ) + { + rc =p2m_set_ioreq_server (d, flags, s); +if ( rc ==0 ) +gdprintk (XENLOG_DEBUG ,"%u %s type HVMMEM_ioreq_server.\n" , + s->id, (flags !=0 ) ?"mapped to" :"unmapped from" );Why
gdprintk()? I don't think the current domain is of much interest here. What would be of interest is the subject domain.
Quoted 5 lines
Quoted 1 line
s->idis not thedomain_id, but id of the ioreq server.That's understood. But
gdprintk()itself logs the current domain, which isn't as useful as the subject one.
Oh, I see. So the correct routine here should be dprintk(), right?
Quoted 37 lines
Quoted 23 lines
Quoted 13 lines
Quoted 13 lines
xen/arch/x86/mm/p2m-ept.c +6
-0@@ -132,6 +132,19 @@ 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 = !(p2m->ioreq.flags &P2M_IOREQ_HANDLE_READ_ACCESS ); +/* +* write access right is disabled when entry->r is 0, but whether +* write accesses are emulated by hypervisor or forwarded to an +* ioreq server depends on the setting of p2m->ioreq.flags. Quoted 9 lines
xen/arch/x86/mm/p2m-ept.c static void ept_p2m_type_to_flags(struct p2m_domain *p2m, ept_entry_t *entry, · line 144
Quoted 4 lines
xen/arch/x86/mm/p2m-ept.c +4
-0+*/ + entry->w = (entry->r && + !(p2m->ioreq.flags &P2M_IOREQ_HANDLE_WRITE_ACCESS )); + entry->x = entry->r;Why would we want to allow instruction execution from such pages? And with all three bits now possibly being clear, aren't we risking the entries to be mis-treated as not-present ones?
Quoted 13 lines
Hah. You got me. Thanks! :)
Now I realized it would be difficult if we wanna to emulate the read operations for HVM. According to Intel mannual,entry->ris to be cleared, so shouldentry->wif we do not want ept misconfig. And with both read and write permissions being forbidden,entry->xcan be set only on processors withEXECUTE_ONLYcapability.
To avoid any entry to be mis-treated as not-present. We have several solutions:
a> do not support the read emulation for now - we have no such usage case;
b> add the check ofp2m_tagainstp2m_ioreq_serverinis_epte_present- a bit weird to me.
Which one do you prefer? or any other suggestions?
Quoted 4 lines
That question would also need to be asked to others who had suggested supporting both. I'd be fine with a, but I also don't view b as too awkward.
According to Intel mannual, an entry is regarded as not present, if bit0:2 is 0. So adding a p2m type check in is_epte_present() means we will change its semantics, if this is acceptable(with no hurt to hypervisor). I'd prefer option b>
Does anyone else have different suggestions other than b> ?
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
xen/arch/x86/mm/p2m-ept.c static void ept_p2m_type_to_flags(struct p2m_domain
Quoted 6 lines
xen/arch/x86/mm/p2m-ept.c +6
-0+/* +* Each time we map/unmap an ioreq server to/from p2m_ioreq_server, +* we mark the p2m table to be recalculated, so that gfns which were +* previously marked with p2m_ioreq_server can be resynced. +*/ +p2m_change_entry_type_global (d, p2m_ioreq_server, p2m_ram_rw);What does "resynced" here mean? I.e. I can see why this is wanted when unmapping a server, but when mapping a server there shouldn't be any such pages in the first place.
Quoted 7 lines
Quoted 3 lines
There shouldn't be. But if there is(misbehavior from the device model side), it can be recalculated back to
p2m_ram_rw(which is not quite necessary as the unmapping case).DM misbehavior should not result in such a problem - the hypervisor should refuse any bad requests.
OK. I can add code to guarantee from hypervisor side no entries changed to p2m_ioreq_server before the mapping happens.
B.R.
Yu
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
Quoted 16 lines
Quoted 1 line
Quoted 1 line
"Yu, Zhang" <[email protected]> 04/12/16 11:47 AM >>>
Quoted 14 lines · Jan Beulich
Quoted 14 lines
Quoted 1 line
Quoted 1 line · On 11.04.16 at 13:14, <[email protected]> wrote:
Quoted 11 lines · Jan Beulich
xen/arch/x86/hvm/hvm.c static int hvm_unmap_io_range_from_ioreq_server(struct domain *d, ioservid_t id, · line 1447
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 31.03.16 at 12:53, <[email protected]> wrote:
xen/arch/x86/hvm/hvm.c +6
-0+if ( s->id == id ) + { + rc =p2m_set_ioreq_server (d, flags, s); +if ( rc ==0 ) +gdprintk (XENLOG_DEBUG ,"%u %s type HVMMEM_ioreq_server.\n" , + s->id, (flags !=0 ) ?"mapped to" :"unmapped from" );Why
gdprintk()? I don't think the current domain is of much interest here. What would be of interest is the subject domain.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
s->idis not thedomain_id, but id of the ioreq server.That's understood. But
gdprintk()itself logs the current domain, which isn't as useful as the subject one.Oh, I see. So the correct routine here should be
dprintk(), right?
Yes.
Quoted 17 lines
Quoted 17 lines
Quoted 16 lines
Quoted 2 lines
And with all three bits now possibly being clear, aren't we risking the entries to be mis-treated as not-present ones?
Hah. You got me. Thanks! :)
Now I realized it would be difficult if we wanna to emulate the read operations for HVM. According to Intel mannual,entry->ris to be cleared, so shouldentry->wif we do not want ept misconfig. And with both read and write permissions being forbidden,entry->xcan be set only on processors withEXECUTE_ONLYcapability.
To avoid any entry to be mis-treated as not-present. We have several solutions:
a> do not support the read emulation for now - we have no such usage case;
b> add the check ofp2m_tagainstp2m_ioreq_serverinis_epte_present- a bit weird to me.
Which one do you prefer? or any other suggestions?
Quoted 8 lines
Quoted 3 lines
That question would also need to be asked to others who had suggested supporting both. I'd be fine with a, but I also don't view b as too awkward.
According to Intel mannual, an entry is regarded as not present, if bit0:2 is 0. So adding a p2m type check in
is_epte_present()means we will change its semantics, if this is acceptable(with no hurt to hypervisor). I'd prefer option b>
Perhaps time for the VMX maintainers to chime in - such a change is acceptable only if it doesn't result in changed hardware behavior. I can't think of any such off the top of my head, but this really should be confirmed by the maintainers before deciding to go such a route.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
Quoted 51 lines · Jan Beulich
Quoted 16 lines
Quoted 1 line
Quoted 1 line
"Yu, Zhang" <[email protected]> 04/12/16 11:47 AM >>>
Quoted 14 lines · Jan Beulich
Quoted 14 lines
Quoted 1 line
Quoted 1 line · On 11.04.16 at 13:14, <[email protected]> wrote:
Quoted 11 lines · Jan Beulich
xen/arch/x86/hvm/hvm.c static int hvm_unmap_io_range_from_ioreq_server(struct domain *d, ioservid_t id, · line 1447
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 31.03.16 at 12:53, <[email protected]> wrote:
xen/arch/x86/hvm/hvm.c +6
-0+if ( s->id == id ) + { + rc =p2m_set_ioreq_server (d, flags, s); +if ( rc ==0 ) +gdprintk (XENLOG_DEBUG ,"%u %s type HVMMEM_ioreq_server.\n" , + s->id, (flags !=0 ) ?"mapped to" :"unmapped from" );Why
gdprintk()? I don't think the current domain is of much interest here. What would be of interest is the subject domain.Quoted 6 lines
Quoted 4 lines
Quoted 1 line
s->idis not thedomain_id, but id of the ioreq server.That's understood. But
gdprintk()itself logs the current domain, which isn't as useful as the subject one.Oh, I see. So the correct routine here should be
dprintk(), right?Yes.
Quoted 17 lines
Quoted 17 lines
Quoted 16 lines
Quoted 2 lines
And with all three bits now possibly being clear, aren't we risking the entries to be mis-treated as not-present ones?
Hah. You got me. Thanks! :)
Now I realized it would be difficult if we wanna to emulate the read operations for HVM. According to Intel mannual,entry->ris to be cleared, so shouldentry->wif we do not want ept misconfig. And with both read and write permissions being forbidden,entry->xcan be set only on processors withEXECUTE_ONLYcapability.
To avoid any entry to be mis-treated as not-present. We have several solutions:
a> do not support the read emulation for now - we have no such usage case;
b> add the check ofp2m_tagainstp2m_ioreq_serverinis_epte_present- a bit weird to me.
Which one do you prefer? or any other suggestions?Quoted 8 lines
Quoted 3 lines
That question would also need to be asked to others who had suggested supporting both. I'd be fine with a, but I also don't view b as too awkward.
According to Intel mannual, an entry is regarded as not present, if bit0:2 is 0. So adding a p2m type check in
is_epte_present()means we will change its semantics, if this is acceptable(with no hurt to hypervisor). I'd prefer option b>
Quoted 5 lines
Perhaps time for the VMX maintainers to chime in - such a change is acceptable only if it doesn't result in changed hardware behavior. I can't think of any such off the top of my head, but this really should be confirmed by the maintainers before deciding to go such a route.
Thanks, Jan. :)
Jun & Kevin, any suggestions?
Yu
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
Quoted 28 lines
From: Yu, Zhang [mailto:[email protected]]
Sent: Thursday, April 14, 2016 5:57 PMQuoted 26 lines
Quoted 25 lines
Quoted 17 lines
Quoted 16 lines
Quoted 2 lines
And with all three bits now possibly being clear, aren't we risking the entries to be mis-treated as not-present ones?
Hah. You got me. Thanks! :)
Now I realized it would be difficult if we wanna to emulate the read operations for HVM. According to Intel mannual,entry->ris to be cleared, so shouldentry->wif we do not want ept misconfig. And with both read and write permissions being forbidden,entry->xcan be set only on processors withEXECUTE_ONLYcapability.
To avoid any entry to be mis-treated as not-present. We have several solutions:
a> do not support the read emulation for now - we have no such usage case;
b> add the check ofp2m_tagainstp2m_ioreq_serverinis_epte_present- a bit weird to me.
Which one do you prefer? or any other suggestions?Quoted 3 lines
That question would also need to be asked to others who had suggested supporting both. I'd be fine with a, but I also don't view b as too awkward.
According to Intel mannual, an entry is regarded as not present, if bit0:2 is 0. So adding a p2m type check in
is_epte_present()means we will change its semantics, if this is acceptable(with no hurt to hypervisor). I'd prefer option b>
Quoted 9 lines
Quoted 5 lines
Perhaps time for the VMX maintainers to chime in - such a change is acceptable only if it doesn't result in changed hardware behavior. I can't think of any such off the top of my head, but this really should be confirmed by the maintainers before deciding to go such a route.
Thanks, Jan. :)
Jun & Kevin, any suggestions?
I'm a bit worried about this change, since it's a fundamental EPT interface. Can we avoid supporting read emulation now?
Thanks
Kevin
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
Quoted 49 lines
-----Original Message-----
From: Tian, Kevin [mailto:[email protected]]
Sent: 19 April 2016 05:51
To: Yu, Zhang; Jan Beulich; Paul Durrant; Nakajima, Jun
Cc: Andrew Cooper; George Dunlap; Lv, Zhiyuan; [email protected]; Keir (Xen.org); Tim (Xen.org)
Subject: RE: [Xen-devel] [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram withp2m_ioreq_serverto an ioreq serverQuoted 10 lines
From: Yu, Zhang [mailto:[email protected]]
Sent: Thursday, April 14, 2016 5:57 PMQuoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
And with all three bits now possibly being clear, aren't we risking the entries to be mis-treated as not-present ones?
Hah. You got me. Thanks! :)
Now I realized it would be difficult if we wanna to emulate the read operations for HVM. According to Intel mannual,entry->ris to be cleared, so shouldentry->wif we do not want ept misconfig. And with both read and write permissions being forbidden,entry->xcanbe
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
set only on processors with
EXECUTE_ONLYcapability.
To avoid any entry to be mis-treated as not-present. We have several solutions:
a> do not support the read emulation for now - we have no suchusage
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
case;
b> add the check ofp2m_tagainstp2m_ioreq_serverin
is_epte_present-Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
a bit weird to me.
Which one do you prefer? or any other suggestions?That question would also need to be asked to others who had suggested supporting both. I'd be fine with a, but I also don't view b as too awkward.
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
According to Intel mannual, an entry is regarded as not present, if bit0:2 is 0. So adding a p2m type check in
is_epte_present()means we will change its semantics, if this is acceptable(with no hurt to hypervisor). I'd prefer option b>Perhaps time for the VMX maintainers to chime in - such a change is
acceptable
Quoted 1 line
Quoted 1 line
only if it doesn't result in changed hardware behavior. I can't think of any
such off
Quoted 1 line
Quoted 1 line
the top of my head, but this really should be confirmed by the
maintainers before
Quoted 3 lines
Quoted 2 lines
deciding to go such a route.
Quoted 7 lines
Quoted 3 lines
Thanks, Jan. :)
Jun & Kevin, any suggestions?I'm a bit worried about this change, since it's a fundamental EPT interface. Can we avoid supporting read emulation now?
I'm happy to drop the implementation of read emulation for the moment to keep things simple, as long as it is kept in the interface.
Paul
Quoted 2 lines
Thanks
Kevin
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
Quoted 53 lines · Paul Durrant
Quoted 53 lines
-----Original Message-----
From: Tian, Kevin [mailto:[email protected]]
Sent: 19 April 2016 05:51
To: Yu, Zhang; Jan Beulich; Paul Durrant; Nakajima, Jun
Cc: Andrew Cooper; George Dunlap; Lv, Zhiyuan; [email protected]; Keir (Xen.org); Tim (Xen.org)
Subject: RE: [Xen-devel] [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram withp2m_ioreq_serverto an ioreq serverQuoted 10 lines
From: Yu, Zhang [mailto:[email protected]]
Sent: Thursday, April 14, 2016 5:57 PMQuoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
And with all three bits now possibly being clear, aren't we risking the entries to be mis-treated as not-present ones?
Hah. You got me. Thanks! :)
Now I realized it would be difficult if we wanna to emulate the read operations for HVM. According to Intel mannual,entry->ris to be cleared, so shouldentry->wif we do not want ept misconfig. And with both read and write permissions being forbidden,entry->xcanbe
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
set only on processors with
EXECUTE_ONLYcapability.
To avoid any entry to be mis-treated as not-present. We have several solutions:
a> do not support the read emulation for now - we have no suchusage
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
case;
b> add the check ofp2m_tagainstp2m_ioreq_serverin
is_epte_present-Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
a bit weird to me.
Which one do you prefer? or any other suggestions?That question would also need to be asked to others who had suggested supporting both. I'd be fine with a, but I also don't view b as too awkward.
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
According to Intel mannual, an entry is regarded as not present, if bit0:2 is 0. So adding a p2m type check in
is_epte_present()means we will change its semantics, if this is acceptable(with no hurt to hypervisor). I'd prefer option b>Perhaps time for the VMX maintainers to chime in - such a change is
acceptable
Quoted 1 line
Quoted 1 line
only if it doesn't result in changed hardware behavior. I can't think of any
such off
Quoted 1 line
Quoted 1 line
the top of my head, but this really should be confirmed by the
maintainers before
Quoted 6 lines
Quoted 2 lines
deciding to go such a route.
Thanks, Jan. :)
Jun & Kevin, any suggestions?
Quoted 6 lines
Quoted 3 lines
I'm a bit worried about this change, since it's a fundamental EPT interface. Can we avoid supporting read emulation now?
I'm happy to drop the implementation of read emulation for the moment to keep things simple, as long as it is kept in the interface.
Thanks, Paul.
So what's the benefit to keep the read in the interface, if we can not support its emulation?
It could be easier to change the is_epte_present definition than to remove the read emulation code, but either way would not be difficult.
Yu
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
Quoted 74 lines
-----Original Message-----
From: Yu, Zhang [mailto:[email protected]]
Sent: 19 April 2016 10:27
To: Paul Durrant; Kevin Tian; Jan Beulich; Nakajima, Jun
Cc: Keir (Xen.org); Andrew Cooper; Tim (Xen.org); George Dunlap; xen- [email protected]; Lv, Zhiyuan
Subject: Re: [Xen-devel] [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram withp2m_ioreq_serverto an ioreq serverQuoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Tian, Kevin [mailto:[email protected]]
Sent: 19 April 2016 05:51
To: Yu, Zhang; Jan Beulich; Paul Durrant; Nakajima, Jun
Cc: Andrew Cooper; George Dunlap; Lv, Zhiyuan; xen-Quoted 7 lines
Quoted 7 lines
Keir (Xen.org); Tim (Xen.org)
Subject: RE: [Xen-devel] [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram withp2m_ioreq_serverto an ioreq serverQuoted 3 lines
From: Yu, Zhang [mailto:[email protected]]
Sent: Thursday, April 14, 2016 5:57 PMQuoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
And with all three bits now possibly being clear, aren't we risking
the
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
entries to be mis-treated as not-present ones?
Hah. You got me. Thanks! :)
Now I realized it would be difficult if we wanna to emulate the read operations for HVM. According to Intel mannual,entry->ris to be cleared, so shouldentry->wif we do not want ept misconfig. And with both read and write permissions being forbidden,entry->xcan
Quoted 3 lines
Quoted 3 lines
be
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
set only on processors with
EXECUTE_ONLYcapability. To avoid any entry to be mis-treated as not-present. We haveseveral
Quoted 13 lines
Quoted 13 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
solutions:
a> do not support the read emulation for now - we have no suchusage
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
case;
b> add the check ofp2m_tagainstp2m_ioreq_serverin
is_epte_present-Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
a bit weird to me.
Which one do you prefer? or any other suggestions?That question would also need to be asked to others who had suggested supporting both. I'd be fine with a, but I also don't view b as too awkward.
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
According to Intel mannual, an entry is regarded as not present, if bit0:2 is 0. So adding a p2m type check in
is_epte_present()means we will change its semantics, if this is acceptable(with no hurt to hypervisor). I'd prefer option b>Perhaps time for the VMX maintainers to chime in - such a change is
acceptable
Quoted 1 line
Quoted 1 line
only if it doesn't result in changed hardware behavior. I can't think of
any
Quoted 14 lines
Quoted 13 lines
such off
Quoted 1 line
Quoted 1 line
the top of my head, but this really should be confirmed by the
maintainers before
Quoted 6 lines
Quoted 2 lines
deciding to go such a route.
Thanks, Jan. :)
Jun & Kevin, any suggestions?I'm a bit worried about this change, since it's a fundamental EPT interface. Can we avoid supporting read emulation now?
Quoted 8 lines
Quoted 1 line
I'm happy to drop the implementation of read emulation for the moment
to keep things simple, as long as it is kept in the interface.
Quoted 1 line
Thanks, Paul.
So what's the benefit to keep the read in the interface, if we can not support its emulation?
Well, if it's in the interface then support can be added in future. If it's not in the interface then it needs to be added later and that makes things more awkward compatibility-wise.
Paul
Quoted 5 lines
It could be easier to change the
is_epte_presentdefinition than to remove the read emulation code, but either way would not be difficult.Yu
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
Quoted 78 lines · Paul Durrant
Quoted 78 lines
-----Original Message-----
From: Yu, Zhang [mailto:[email protected]]
Sent: 19 April 2016 10:27
To: Paul Durrant; Kevin Tian; Jan Beulich; Nakajima, Jun
Cc: Keir (Xen.org); Andrew Cooper; Tim (Xen.org); George Dunlap; xen- [email protected]; Lv, Zhiyuan
Subject: Re: [Xen-devel] [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram withp2m_ioreq_serverto an ioreq serverQuoted 5 lines · Paul Durrant
Quoted 5 lines
-----Original Message-----
From: Tian, Kevin [mailto:[email protected]]
Sent: 19 April 2016 05:51
To: Yu, Zhang; Jan Beulich; Paul Durrant; Nakajima, Jun
Cc: Andrew Cooper; George Dunlap; Lv, Zhiyuan; xen-Quoted 7 lines
Quoted 7 lines
Keir (Xen.org); Tim (Xen.org)
Subject: RE: [Xen-devel] [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram withp2m_ioreq_serverto an ioreq serverQuoted 3 lines
From: Yu, Zhang [mailto:[email protected]]
Sent: Thursday, April 14, 2016 5:57 PMQuoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
And with all three bits now possibly being clear, aren't we risking
the
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
entries to be mis-treated as not-present ones?
Hah. You got me. Thanks! :)
Now I realized it would be difficult if we wanna to emulate the read operations for HVM. According to Intel mannual,entry->ris to be cleared, so shouldentry->wif we do not want ept misconfig. And with both read and write permissions being forbidden,entry->xcan
Quoted 3 lines
Quoted 3 lines
be
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
set only on processors with
EXECUTE_ONLYcapability. To avoid any entry to be mis-treated as not-present. We haveseveral
Quoted 13 lines
Quoted 13 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
solutions:
a> do not support the read emulation for now - we have no suchusage
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
case;
b> add the check ofp2m_tagainstp2m_ioreq_serverin
is_epte_present-Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
a bit weird to me.
Which one do you prefer? or any other suggestions?That question would also need to be asked to others who had suggested supporting both. I'd be fine with a, but I also don't view b as too awkward.
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
According to Intel mannual, an entry is regarded as not present, if bit0:2 is 0. So adding a p2m type check in
is_epte_present()means we will change its semantics, if this is acceptable(with no hurt to hypervisor). I'd prefer option b>Perhaps time for the VMX maintainers to chime in - such a change is
acceptable
Quoted 1 line
Quoted 1 line
only if it doesn't result in changed hardware behavior. I can't think of
any
Quoted 10 lines
Quoted 10 lines
such off
Quoted 1 line
Quoted 1 line
the top of my head, but this really should be confirmed by the
maintainers before
Quoted 6 lines
Quoted 2 lines
deciding to go such a route.
Thanks, Jan. :)
Jun & Kevin, any suggestions?Quoted 5 lines
Quoted 3 lines
I'm a bit worried about this change, since it's a fundamental EPT interface. Can we avoid supporting read emulation now?
I'm happy to drop the implementation of read emulation for the moment
to keep things simple, as long as it is kept in the interface.
Quoted 1 line
Quoted 9 lines
Quoted 4 lines
Thanks, Paul.
So what's the benefit to keep the read in the interface, if we can not support its emulation?Well, if it's in the interface then support can be added in future. If it's not in the interface then it needs to be added later and that makes things more awkward compatibility-wise.
Paul
But if we need to support read emulation in the future, we'll have to clear bit0:2 in ept pte, which is the same situation we are facing now. So why do we not support it now?
Sorry for seeming so stubborn, I just want to have some more convincing explanations. :)
Yu
Quoted 10 lines
Quoted 5 lines
It could be easier to change the
is_epte_presentdefinition than to remove the read emulation code, but either way would not be difficult.Yu
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
Quoted 109 lines
-----Original Message-----
From: Yu, Zhang [mailto:[email protected]]
Sent: 19 April 2016 10:49
To: Paul Durrant; Kevin Tian; Jan Beulich; Nakajima, Jun
Cc: Keir (Xen.org); Andrew Cooper; Tim (Xen.org); George Dunlap; xen- [email protected]; Lv, Zhiyuan
Subject: Re: [Xen-devel] [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram withp2m_ioreq_serverto an ioreq serverQuoted 12 lines · Paul Durrant
Quoted 12 lines
-----Original Message-----
From: Yu, Zhang [mailto:[email protected]]
Sent: 19 April 2016 10:27
To: Paul Durrant; Kevin Tian; Jan Beulich; Nakajima, Jun
Cc: Keir (Xen.org); Andrew Cooper; Tim (Xen.org); George Dunlap; xen- [email protected]; Lv, Zhiyuan
Subject: Re: [Xen-devel] [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram withp2m_ioreq_serverto an ioreq serverOn 4/19/2016 4:46 PM, Paul Durrant wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
-----Original Message-----
From: Tian, Kevin [mailto:[email protected]]
Sent: 19 April 2016 05:51
To: Yu, Zhang; Jan Beulich; Paul Durrant; Nakajima, Jun
Cc: Andrew Cooper; George Dunlap; Lv, Zhiyuan; xen-Quoted 2 lines
Quoted 2 lines
Keir (Xen.org); Tim (Xen.org)
Subject: RE: [Xen-devel] [PATCH v2 3/3] x86/ioreq server: Add HVMOPto
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
map guest ram with
p2m_ioreq_serverto an ioreq serverQuoted 3 lines
From: Yu, Zhang [mailto:[email protected]]
Sent: Thursday, April 14, 2016 5:57 PMQuoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
And with all three bits now possibly being clear, aren't we
risking
Quoted 5 lines
Quoted 5 lines
the
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
entries to be mis-treated as not-present ones?
Hah. You got me. Thanks! :)
Now I realized it would be difficult if we wanna to emulate theread
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
operations for HVM. According to Intel mannual,
entry->ris tobe
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
cleared, so should
entry->wif we do not want ept misconfig.And
Quoted 15 lines
Quoted 15 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
with both read and write permissions being forbidden,
entry->xcan
Quoted 3 lines
Quoted 3 lines
be
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
set only on processors with
EXECUTE_ONLYcapability. To avoid any entry to be mis-treated as not-present. We haveseveral
Quoted 9 lines
Quoted 9 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
solutions:
a> do not support the read emulation for now - we have no suchusage
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
case;
b> add the check ofp2m_tagainstp2m_ioreq_serverin
is_epte_present-Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
a bit weird to me.
Which one do you prefer? or any other suggestions?Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
That question would also need to be asked to others who had suggested supporting both. I'd be fine with a, but I also don't view b as too awkward.
According to Intel mannual, an entry is regarded as not present, if bit0:2 is 0. So adding a p2m type check in
is_epte_present()meanswe
Quoted 17 lines
Quoted 17 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
will change its semantics, if this is acceptable(with no hurt to hypervisor). I'd prefer option b>
Perhaps time for the VMX maintainers to chime in - such a change is
acceptable
Quoted 1 line
Quoted 1 line
only if it doesn't result in changed hardware behavior. I can't think of
any
Quoted 10 lines
Quoted 10 lines
such off
Quoted 1 line
Quoted 1 line
the top of my head, but this really should be confirmed by the
maintainers before
Quoted 6 lines
Quoted 2 lines
deciding to go such a route.
Thanks, Jan. :)
Jun & Kevin, any suggestions?Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
I'm a bit worried about this change, since it's a fundamental EPT interface. Can we avoid supporting read emulation now?
I'm happy to drop the implementation of read emulation for the
moment
Quoted 9 lines
Quoted 7 lines
to keep things simple, as long as it is kept in the interface.
Quoted 1 line
Thanks, Paul.
So what's the benefit to keep the read in the interface, if we can not support its emulation?Well, if it's in the interface then support can be added in future. If it's not in
the interface then it needs to be added later and that makes things more awkward compatibility-wise.
Quoted 3 lines
Paul
Quoted 7 lines
But if we need to support read emulation in the future, we'll have to clear bit0:2 in ept pte, which is the same situation we are facing now. So why do we not support it now?
Sorry for seeming so stubborn, I just want to have some more convincing explanations. :)
That's an argument you need to have with Kevin. If he thinks the risk of making the change now is small then go ahead. All I'm saying is that 4.7 is about to go out of the door so whatever happens now needs to be as low risk and as minimally disruptive as possible.
Paul
Quoted 12 lines
Yu
Quoted 10 lines
Quoted 5 lines
It could be easier to change the
is_epte_presentdefinition than to remove the read emulation code, but either way would not be difficult.Yu
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
Quoted 113 lines · Paul Durrant
Quoted 113 lines
-----Original Message-----
From: Yu, Zhang [mailto:[email protected]]
Sent: 19 April 2016 10:49
To: Paul Durrant; Kevin Tian; Jan Beulich; Nakajima, Jun
Cc: Keir (Xen.org); Andrew Cooper; Tim (Xen.org); George Dunlap; xen- [email protected]; Lv, Zhiyuan
Subject: Re: [Xen-devel] [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram withp2m_ioreq_serverto an ioreq serverQuoted 12 lines · Paul Durrant
Quoted 12 lines
-----Original Message-----
From: Yu, Zhang [mailto:[email protected]]
Sent: 19 April 2016 10:27
To: Paul Durrant; Kevin Tian; Jan Beulich; Nakajima, Jun
Cc: Keir (Xen.org); Andrew Cooper; Tim (Xen.org); George Dunlap; xen- [email protected]; Lv, Zhiyuan
Subject: Re: [Xen-devel] [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram withp2m_ioreq_serverto an ioreq serverOn 4/19/2016 4:46 PM, Paul Durrant wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
-----Original Message-----
From: Tian, Kevin [mailto:[email protected]]
Sent: 19 April 2016 05:51
To: Yu, Zhang; Jan Beulich; Paul Durrant; Nakajima, Jun
Cc: Andrew Cooper; George Dunlap; Lv, Zhiyuan; xen-Quoted 2 lines
Quoted 2 lines
Keir (Xen.org); Tim (Xen.org)
Subject: RE: [Xen-devel] [PATCH v2 3/3] x86/ioreq server: Add HVMOPto
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
map guest ram with
p2m_ioreq_serverto an ioreq serverQuoted 3 lines
From: Yu, Zhang [mailto:[email protected]]
Sent: Thursday, April 14, 2016 5:57 PMQuoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
And with all three bits now possibly being clear, aren't we
risking
Quoted 5 lines
Quoted 5 lines
the
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
entries to be mis-treated as not-present ones?
Hah. You got me. Thanks! :)
Now I realized it would be difficult if we wanna to emulate theread
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
operations for HVM. According to Intel mannual,
entry->ris tobe
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
cleared, so should
entry->wif we do not want ept misconfig.And
Quoted 15 lines
Quoted 15 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
with both read and write permissions being forbidden,
entry->xcan
Quoted 3 lines
Quoted 3 lines
be
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
set only on processors with
EXECUTE_ONLYcapability. To avoid any entry to be mis-treated as not-present. We haveseveral
Quoted 9 lines
Quoted 9 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
solutions:
a> do not support the read emulation for now - we have no suchusage
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
case;
b> add the check ofp2m_tagainstp2m_ioreq_serverin
is_epte_present-Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
a bit weird to me.
Which one do you prefer? or any other suggestions?Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
That question would also need to be asked to others who had suggested supporting both. I'd be fine with a, but I also don't view b as too awkward.
According to Intel mannual, an entry is regarded as not present, if bit0:2 is 0. So adding a p2m type check in
is_epte_present()meanswe
Quoted 17 lines
Quoted 17 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
will change its semantics, if this is acceptable(with no hurt to hypervisor). I'd prefer option b>
Perhaps time for the VMX maintainers to chime in - such a change is
acceptable
Quoted 1 line
Quoted 1 line
only if it doesn't result in changed hardware behavior. I can't think of
any
Quoted 10 lines
Quoted 10 lines
such off
Quoted 1 line
Quoted 1 line
the top of my head, but this really should be confirmed by the
maintainers before
Quoted 6 lines
Quoted 2 lines
deciding to go such a route.
Thanks, Jan. :)
Jun & Kevin, any suggestions?Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
I'm a bit worried about this change, since it's a fundamental EPT interface. Can we avoid supporting read emulation now?
I'm happy to drop the implementation of read emulation for the
moment
Quoted 9 lines
Quoted 7 lines
to keep things simple, as long as it is kept in the interface.
Quoted 1 line
Thanks, Paul.
So what's the benefit to keep the read in the interface, if we can not support its emulation?Well, if it's in the interface then support can be added in future. If it's not in
the interface then it needs to be added later and that makes things more awkward compatibility-wise.
Quoted 3 lines
Paul
But if we need to support read emulation in the future, we'll have to clear bit0:2 in ept pte, which is the same situation we are facing now. So why do we not support it now?
Quoted 6 lines
Quoted 3 lines
Sorry for seeming so stubborn, I just want to have some more convincing explanations. :)
That's an argument you need to have with Kevin. If he thinks the risk of making the change now is small then go ahead. All I'm saying is that 4.7 is about to go out of the door so whatever happens now needs to be as low risk and as minimally disruptive as possible.
Got it. Thank you, Paul. :)
Yu
Quoted 14 lines
Paul
Quoted 12 lines
Yu
Quoted 10 lines
Quoted 5 lines
It could be easier to change the
is_epte_presentdefinition than to remove the read emulation code, but either way would not be difficult.Yu
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
In reply to Tian, KevinQuoted 34 lines · Kevin
Quoted 34 lines
From: Yu, Zhang [mailto:[email protected]]
Sent: Thursday, April 14, 2016 5:57 PMQuoted 31 lines
Quoted 17 lines
Quoted 17 lines
Quoted 16 lines
Quoted 2 lines
And with all three bits now possibly being clear, aren't we risking the entries to be mis-treated as not-present ones?
Hah. You got me. Thanks! :)
Now I realized it would be difficult if we wanna to emulate the read operations for HVM. According to Intel mannual,entry->ris to be cleared, so shouldentry->wif we do not want ept misconfig. And with both read and write permissions being forbidden,entry->xcan be set only on processors withEXECUTE_ONLYcapability.
To avoid any entry to be mis-treated as not-present. We have several solutions:
a> do not support the read emulation for now - we have no such usage case;
b> add the check ofp2m_tagainstp2m_ioreq_serverinis_epte_present- a bit weird to me.
Which one do you prefer? or any other suggestions?Quoted 8 lines
Quoted 3 lines
That question would also need to be asked to others who had suggested supporting both. I'd be fine with a, but I also don't view b as too awkward.
According to Intel mannual, an entry is regarded as not present, if bit0:2 is 0. So adding a p2m type check in
is_epte_present()means we will change its semantics, if this is acceptable(with no hurt to hypervisor). I'd prefer option b>Perhaps time for the VMX maintainers to chime in - such a change is acceptable only if it doesn't result in changed hardware behavior. I can't think of any such off the top of my head, but this really should be confirmed by the maintainers before deciding to go such a route.
Quoted 7 lines
Quoted 3 lines
Thanks, Jan. :)
Jun & Kevin, any suggestions?I'm a bit worried about this change, since it's a fundamental EPT interface. Can we avoid supporting read emulation now?
Thanks for your reply, Kevin.
For XenGT, either waY would be fine. But I do not think changing is_epte_present will introduce any bug.
Paul, do you have any preference?
Yu
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server
Quoted 62 lines
-----Original Message-----
From: Yu, Zhang [mailto:[email protected]]
Sent: 19 April 2016 10:15
To: Kevin Tian; Jan Beulich; Paul Durrant; Nakajima, Jun
Cc: Keir (Xen.org); George Dunlap; Andrew Cooper; Tim (Xen.org); xen- [email protected]; Lv, Zhiyuan
Subject: Re: [Xen-devel] [PATCH v2 3/3] x86/ioreq server: Add HVMOP to map guest ram withp2m_ioreq_serverto an ioreq serverQuoted 3 lines · Kevin
Quoted 3 lines
From: Yu, Zhang [mailto:[email protected]]
Sent: Thursday, April 14, 2016 5:57 PMQuoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
And with all three bits now possibly being clear, aren't we risking
the
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
entries to be mis-treated as not-present ones?
Hah. You got me. Thanks! :)
Now I realized it would be difficult if we wanna to emulate the read operations for HVM. According to Intel mannual,entry->ris to be cleared, so shouldentry->wif we do not want ept misconfig. And with both read and write permissions being forbidden,entry->xcanbe
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
set only on processors with
EXECUTE_ONLYcapability. To avoid any entry to be mis-treated as not-present. We haveseveral
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
solutions:
a> do not support the read emulation for now - we have no suchusage
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
case;
b> add the check ofp2m_tagainstp2m_ioreq_serverin
is_epte_present-Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
a bit weird to me.
Which one do you prefer? or any other suggestions?That question would also need to be asked to others who had suggested supporting both. I'd be fine with a, but I also don't view b as too awkward.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
According to Intel mannual, an entry is regarded as not present, if bit0:2 is 0. So adding a p2m type check in
is_epte_present()means we will change its semantics, if this is acceptable(with no hurt to hypervisor). I'd prefer option b>Perhaps time for the VMX maintainers to chime in - such a change is
acceptable
Quoted 1 line
Quoted 1 line
Quoted 1 line
only if it doesn't result in changed hardware behavior. I can't think of any
such off
Quoted 1 line
Quoted 1 line
Quoted 1 line
the top of my head, but this really should be confirmed by the
maintainers before
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines
deciding to go such a route.
Thanks, Jan. :)
Jun & Kevin, any suggestions?I'm a bit worried about this change, since it's a fundamental EPT interface. Can we avoid supporting read emulation now?
Quoted 6 lines
Thanks for your reply, Kevin.
For XenGT, either waY would be fine. But I do not think changingis_epte_presentwill introduce any bug.Paul, do you have any preference?
Unless the code is nailed down in the next couple of days then I don't think any implementation is going to make it into 4.7 so I'd prefer to go with the simplest option, and not supporting read emulation makes things a lot simpler.
Paul
Quoted 1 line
Yu
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel