* [PATCH V3] vm_event: Remove xc_mem_access_enable_emulate() and friends
@ 2016-02-14 8:38 Razvan Cojocaru
2016-02-14 8:40 ` Razvan Cojocaru
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Razvan Cojocaru @ 2016-02-14 8:38 UTC (permalink / raw)
To: xen-devel
Cc: tamas, wei.liu2, ian.campbell, Razvan Cojocaru,
stefano.stabellini, andrew.cooper3, ian.jackson,
stefano.stabellini, jbeulich, keir
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.
Signed-off-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
---
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(-)
diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h
index 1a5f4ec..42eafa4 100644
--- a/tools/libxc/include/xenctrl.h
+++ b/tools/libxc/include/xenctrl.h
@@ -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.
*
diff --git a/tools/libxc/xc_mem_access.c b/tools/libxc/xc_mem_access.c
index 3634c39..eee088c 100644
--- a/tools/libxc/xc_mem_access.c
+++ b/tools/libxc/xc_mem_access.c
@@ -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
diff --git a/xen/common/mem_access.c b/xen/common/mem_access.c
index 159c036..0fb6699 100644
--- a/xen/common/mem_access.c
+++ b/xen/common/mem_access.c
@@ -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;
diff --git a/xen/include/asm-arm/p2m.h b/xen/include/asm-arm/p2m.h
index 4c62725..433952a 100644
--- a/xen/include/asm-arm/p2m.h
+++ b/xen/include/asm-arm/p2m.h
@@ -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)
{
diff --git a/xen/include/asm-x86/domain.h b/xen/include/asm-x86/domain.h
index 4072e27..4fad638 100644
--- a/xen/include/asm-x86/domain.h
+++ b/xen/include/asm-x86/domain.h
@@ -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. */
diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h
index fa46dd9..2a90491 100644
--- a/xen/include/asm-x86/p2m.h
+++ b/xen/include/asm-x86/p2m.h
@@ -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,
diff --git a/xen/include/public/memory.h b/xen/include/public/memory.h
index 4df38d6..f69e92f 100644
--- a/xen/include/public/memory.h
+++ b/xen/include/public/memory.h
@@ -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,
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH V3] vm_event: Remove xc_mem_access_enable_emulate() and friends
2016-02-14 8:38 [PATCH V3] vm_event: Remove xc_mem_access_enable_emulate() and friends Razvan Cojocaru
@ 2016-02-14 8:40 ` Razvan Cojocaru
2016-02-14 18:00 ` Tamas K Lengyel
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Razvan Cojocaru @ 2016-02-14 8:40 UTC (permalink / raw)
To: xen-devel
Cc: tamas, wei.liu2, ian.campbell, stefano.stabellini, andrew.cooper3,
ian.jackson, stefano.stabellini, jbeulich, keir
On 02/14/2016 10:38 AM, Razvan Cojocaru wrote:
> 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.
>
> Signed-off-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
>
> ---
> 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.
I apologize for the typo, it's obviously V2.
Thanks,
Razvan
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH V3] vm_event: Remove xc_mem_access_enable_emulate() and friends
2016-02-14 8:38 [PATCH V3] vm_event: Remove xc_mem_access_enable_emulate() and friends Razvan Cojocaru
2016-02-14 8:40 ` Razvan Cojocaru
@ 2016-02-14 18:00 ` Tamas K Lengyel
2016-02-15 11:15 ` Jan Beulich
2016-02-15 11:34 ` Wei Liu
3 siblings, 0 replies; 6+ messages in thread
From: Tamas K Lengyel @ 2016-02-14 18:00 UTC (permalink / raw)
To: Razvan Cojocaru
Cc: wei.liu2@citrix.com, Ian Campbell, Stefano Stabellini,
Andrew Cooper, Ian Jackson, Xen-devel, Stefano Stabellini,
Jan Beulich, Keir Fraser
[-- Attachment #1.1: Type: text/plain, Size: 668 bytes --]
On Sun, Feb 14, 2016 at 1:38 AM, Razvan Cojocaru <rcojocaru@bitdefender.com>
wrote:
> 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.
>
> Signed-off-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
>
Looks good, thanks!
Acked-by: Tamas K Lengyel <tamas@tklengyel.com>
[-- Attachment #1.2: Type: text/html, Size: 1201 bytes --]
[-- Attachment #2: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH V3] vm_event: Remove xc_mem_access_enable_emulate() and friends
2016-02-14 8:38 [PATCH V3] vm_event: Remove xc_mem_access_enable_emulate() and friends Razvan Cojocaru
2016-02-14 8:40 ` Razvan Cojocaru
2016-02-14 18:00 ` Tamas K Lengyel
@ 2016-02-15 11:15 ` Jan Beulich
2016-02-15 11:21 ` Stefano Stabellini
2016-02-15 11:34 ` Wei Liu
3 siblings, 1 reply; 6+ messages in thread
From: Jan Beulich @ 2016-02-15 11:15 UTC (permalink / raw)
To: Razvan Cojocaru
Cc: tamas, wei.liu2, ian.campbell, stefano.stabellini, andrew.cooper3,
ian.jackson, xen-devel, stefano.stabellini, keir
>>> On 14.02.16 at 09:38, <rcojocaru@bitdefender.com> wrote:
> 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.
>
> Signed-off-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
Non-ARM hypervisor bits:
Acked-by: Jan Beulich <jbeulich@suse.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH V3] vm_event: Remove xc_mem_access_enable_emulate() and friends
2016-02-15 11:15 ` Jan Beulich
@ 2016-02-15 11:21 ` Stefano Stabellini
0 siblings, 0 replies; 6+ messages in thread
From: Stefano Stabellini @ 2016-02-15 11:21 UTC (permalink / raw)
To: Jan Beulich
Cc: tamas, wei.liu2, ian.campbell, Razvan Cojocaru,
stefano.stabellini, andrew.cooper3, ian.jackson, xen-devel,
stefano.stabellini, keir
On Mon, 15 Feb 2016, Jan Beulich wrote:
> >>> On 14.02.16 at 09:38, <rcojocaru@bitdefender.com> wrote:
> > 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.
> >
> > Signed-off-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
>
> Non-ARM hypervisor bits:
> Acked-by: Jan Beulich <jbeulich@suse.com>
>
ARM hypervisor bits:
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH V3] vm_event: Remove xc_mem_access_enable_emulate() and friends
2016-02-14 8:38 [PATCH V3] vm_event: Remove xc_mem_access_enable_emulate() and friends Razvan Cojocaru
` (2 preceding siblings ...)
2016-02-15 11:15 ` Jan Beulich
@ 2016-02-15 11:34 ` Wei Liu
3 siblings, 0 replies; 6+ messages in thread
From: Wei Liu @ 2016-02-15 11:34 UTC (permalink / raw)
To: Razvan Cojocaru
Cc: tamas, wei.liu2, ian.campbell, stefano.stabellini, andrew.cooper3,
ian.jackson, xen-devel, stefano.stabellini, jbeulich, keir
On Sun, Feb 14, 2016 at 10:38:58AM +0200, Razvan Cojocaru wrote:
> 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.
>
> Signed-off-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
>
> ---
> 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 ------------------------
Acked-by: Wei Liu <wei.liu2@citrix.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-02-15 11:34 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-14 8:38 [PATCH V3] vm_event: Remove xc_mem_access_enable_emulate() and friends Razvan Cojocaru
2016-02-14 8:40 ` Razvan Cojocaru
2016-02-14 18:00 ` Tamas K Lengyel
2016-02-15 11:15 ` Jan Beulich
2016-02-15 11:21 ` Stefano Stabellini
2016-02-15 11:34 ` Wei Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).