vm_event: Remove xc_mem_access_enable_emulate() and friends
PATCH 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.
--- 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 | 2 -- 7 files changed, 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 +0 -2
@@ -390,8 +390,6 @@ 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 typedef enum { XENMEM_access_n,
Signature · 1 line
1.9.1
xen/include/public/memory.h DEFINE_XEN_GUEST_HANDLE(xen_mem_paging_op_t); · line 394
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 12.02.16 at 10:04, <[email protected]> wrote:
xen/include/public/memory.h +0
-2@@ -390,8 +390,6 @@ 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
Considering that the interface isn't versioned, I think you should just comment those out instead of entirely removing them, to make obvious for the next one to add an operation here that these two values may not be re-used.
Jan
Quoted 14 lines · Jan Beulich
xen/include/public/memory.h DEFINE_XEN_GUEST_HANDLE(xen_mem_paging_op_t); · line 394
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 12.02.16 at 10:04, <[email protected]> wrote:
xen/include/public/memory.h +0
-2@@ -390,8 +390,6 @@ 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 3Considering that the interface isn't versioned, I think you should just comment those out instead of entirely removing them, to make obvious for the next one to add an operation here that these two values may not be re-used.
Right, I'll do that in V2.
Thanks,
Razvan
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 4 lines
Signed-off-by Razvan Cojocaru <[email protected]>--- tools/libxc/include/xenctrl.h | 11 ----------- tools/libxc/xc_mem_access.c | 24 ------------------------
The changes to libxc look good to me.
I'm waiting for v2 to actually ack it.
Wei.