vm_event: Remove xc_mem_access_enable_emulate() and friends
PATCH v3 1/1 vm_event: Remove xc_mem_access_enable_emulate() and friends
xc_mem_access_enable_emulate() and xc_mem_access_disable_emulate() are currently no-ops, that is all they do is set a flag that nobody else checks. The user can already set the EMULATE flags in the vm_event response if emulation is desired, and having an extra check above that is not inherently safer, but it does complicate (currenly unnecessarily) the API. This patch removes these functions and the corresponding hypervisor code.
---
Changes since V1:
- Commented-out the XENMEM_access_op_enable_emulate and XENMEM_access_op_disable_emulate #defines instead of simply removing them to prevent their reuse, as requested by Jan Beulich.
--- tools/libxc/include/xenctrl.h | 11 ----------- tools/libxc/xc_mem_access.c | 24 ------------------------ xen/common/mem_access.c | 8 -------- xen/include/asm-arm/p2m.h | 14 -------------- xen/include/asm-x86/domain.h | 1 - xen/include/asm-x86/p2m.h | 24 ------------------------ xen/include/public/memory.h | 9 +++++++-- 7 files changed, 7 insertions(+), 84 deletions(-)
tools/libxc/include/xenctrl.h +0 -11
@@ -2101,17 +2101,6 @@ int xc_set_mem_access(xc_interface *xch, domid_t domain_id,int xc_get_mem_access (xc_interface *xch,domid_t domain_id,uint64_t pfn,xenmem_access_t *access); -/* -* Instructions causing a mem_access violation can be emulated by Xen -* to progress the execution without having to relax the mem_access -* permissions. -* This feature has to be first enabled, then in the vm_event -* response to a mem_access event it can be indicated if the instruction -* should be emulated. -*/ -int xc_mem_access_enable_emulate (xc_interface *xch,domid_t domain_id); -int xc_mem_access_disable_emulate (xc_interface *xch,domid_t domain_id); -/*** * Monitor control operations. *
tools/libxc/xc_mem_access.c +0 -24
@@ -62,30 +62,6 @@ int xc_get_mem_access(xc_interface *xch,return rc; } -int xc_mem_access_enable_emulate (xc_interface *xch, -domid_t domain_id) -{ -xen_mem_access_op_t mao = - { - .op = XENMEM_access_op_enable_emulate, - .domid = domain_id, - }; - -return do_memory_op (xch, XENMEM_access_op, &mao,sizeof (mao)); -} - -int xc_mem_access_disable_emulate (xc_interface *xch, -domid_t domain_id) -{ -xen_mem_access_op_t mao = - { - .op = XENMEM_access_op_disable_emulate, - .domid = domain_id, - }; - -return do_memory_op (xch, XENMEM_access_op, &mao,sizeof (mao)); -} -/* * Local variables: * mode: C
xen/common/mem_access.c +0 -8
@@ -98,14 +98,6 @@ int mem_access_memop(unsigned long cmd,break ; } -case XENMEM_access_op_enable_emulate: - rc =p2m_mem_access_enable_emulate (d); -break ; - -case XENMEM_access_op_disable_emulate: - rc =p2m_mem_access_disable_emulate (d); -break ; -default : rc = -ENOSYS ;break ;
xen/include/asm-arm/p2m.h +0 -14
@@ -89,20 +89,6 @@ typedef enum { } p2m_type_t;static inline -int p2m_mem_access_enable_emulate (struct domain *d) -{ -/* Not supported on ARM */ -return -ENOSYS ; -} - -static inline -int p2m_mem_access_disable_emulate (struct domain *d) -{ -/* Not supported on ARM */ -return -ENOSYS ; -} - -static inline void p2m_mem_access_emulate_check (struct vcpu *v,const vm_event_response_t *rsp) {
xen/include/asm-x86/domain.h +0 -1
@@ -390,7 +390,6 @@ struct arch_domain } monitor;/* Mem_access emulation control */ -bool_t mem_access_emulate_enabled;bool_t mem_access_emulate_each_rep;/* Emulated devices enabled bitmap. */
xen/include/asm-x86/p2m.h +0 -24
@@ -647,30 +647,6 @@ bool_t p2m_mem_access_check(paddr_t gpa, unsigned long gla,struct npfec npfec, vm_event_request_t **req_ptr); -/* -* Emulating a memory access requires custom handling. These non-atomic -* functions should be called under domctl lock. -*/ -static inline -int p2m_mem_access_enable_emulate (struct domain *d) -{ -if ( d->arch.mem_access_emulate_enabled ) -return -EEXIST ; - - d->arch.mem_access_emulate_enabled =1 ; -return 0 ; -} - -static inline -int p2m_mem_access_disable_emulate (struct domain *d) -{ -if ( !d->arch.mem_access_emulate_enabled ) -return -EEXIST ; - - d->arch.mem_access_emulate_enabled =0 ; -return 0 ; -} -/* Check for emulation and mark vcpu for skipping one instruction * upon rescheduling if required. */ void p2m_mem_access_emulate_check(struct vcpu *v,
xen/include/public/memory.h +7 -2
@@ -390,8 +390,13 @@ DEFINE_XEN_GUEST_HANDLE(xen_mem_paging_op_t);#define XENMEM_access_op 21#define XENMEM_access_op_set_access 0#define XENMEM_access_op_get_access 1 -#define XENMEM_access_op_enable_emulate 2 -#define XENMEM_access_op_disable_emulate 3 +/* +* XENMEM_access_op_enable_emulate and XENMEM_access_op_disable_emulate are +* currently unused, but since they have been in use please do not reuse them. +* +* #define XENMEM_access_op_enable_emulate 2 +* #define XENMEM_access_op_disable_emulate 3 +*/ typedef enum { XENMEM_access_n,
Signature · 1 line
1.9.1
Quoted 8 lines · Razvan Cojocaru
xc_mem_access_enable_emulate()andxc_mem_access_disable_emulate()are currently no-ops, that is all they do is set a flag that nobody else checks. The user can already set the EMULATE flags in thevm_eventresponse if emulation is desired, and having an extra check above that is not inherently safer, but it does complicate (currenly unnecessarily) the API. This patch removes these functions and the corresponding hypervisor code.
Quoted 8 lines
Signed-off-by Razvan Cojocaru <[email protected]>---
Changes since V1:
- Commented-out theXENMEM_access_op_enable_emulateandXENMEM_access_op_disable_emulate#defines instead of simply removing them to prevent their reuse, as requested by Jan Beulich.
I apologize for the typo, it's obviously V2.
Thanks,
Razvan
Quoted 10 lines · Razvan Cojocaru
xc_mem_access_enable_emulate()andxc_mem_access_disable_emulate()are currently no-ops, that is all they do is set a flag that nobody else checks. The user can already set the EMULATE flags in thevm_eventresponse if emulation is desired, and having an extra check above that is not inherently safer, but it does complicate (currenly unnecessarily) the API. This patch removes these functions and the corresponding hypervisor code.Signed-off-by Razvan Cojocaru <[email protected]>
Looks good, thanks!
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 14.02.16 at 09:38, <[email protected]> wrote:
xc_mem_access_enable_emulate()andxc_mem_access_disable_emulate()are currently no-ops, that is all they do is set a flag that nobody else checks. The user can already set the EMULATE flags in thevm_eventresponse if emulation is desired, and having an extra check above that is not inherently safer, but it does complicate (currenly unnecessarily) the API. This patch removes these functions and the corresponding hypervisor code.Signed-off-by Razvan Cojocaru <[email protected]>
Non-ARM hypervisor bits:
Stefano Stabellini
Acked-byQuoted 9 lines · Jan Beulich
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 14.02.16 at 09:38, <[email protected]> wrote:
xc_mem_access_enable_emulate()andxc_mem_access_disable_emulate()are currently no-ops, that is all they do is set a flag that nobody else checks. The user can already set the EMULATE flags in thevm_eventresponse if emulation is desired, and having an extra check above that is not inherently safer, but it does complicate (currenly unnecessarily) the API. This patch removes these functions and the corresponding hypervisor code.
Quoted 5 lines
Quoted 1 line
Signed-off-by Razvan Cojocaru <[email protected]>Non-ARM hypervisor bits:
Acked-by Jan Beulich <[email protected]>
ARM hypervisor bits:
Quoted 16 lines · Razvan Cojocaru
xc_mem_access_enable_emulate()andxc_mem_access_disable_emulate()are currently no-ops, that is all they do is set a flag that nobody else checks. The user can already set the EMULATE flags in thevm_eventresponse if emulation is desired, and having an extra check above that is not inherently safer, but it does complicate (currenly unnecessarily) the API. This patch removes these functions and the corresponding hypervisor code.Signed-off-by Razvan Cojocaru <[email protected]>---
Changes since V1:
- Commented-out theXENMEM_access_op_enable_emulateandXENMEM_access_op_disable_emulate#defines instead of simply removing them to prevent their reuse, as requested by Jan Beulich.
Quoted 3 lines
--- tools/libxc/include/xenctrl.h | 11 ----------- tools/libxc/xc_mem_access.c | 24 ------------------------