* [PATCH 3 of 7] REDO2: mem_access & mem_access 2: access listener can be required
@ 2011-01-06 3:53 Joe Epstein
0 siblings, 0 replies; only message in thread
From: Joe Epstein @ 2011-01-06 3:53 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1.1: Type: text/plain, Size: 2700 bytes --]
* Adds the ability to set that a domain that an access listener;
that is, it pauses the VCPU if there is no memory event listener.
Signed-off-by: Joe Epstein <jepstein98@gmail.com>
diff -r 253cc5185fb5 -r 281e5488ee97 xen/arch/x86/domctl.c
--- a/xen/arch/x86/domctl.c Wed Jan 05 18:49:34 2011 -0800
+++ b/xen/arch/x86/domctl.c Wed Jan 05 18:50:54 2011 -0800
@@ -1566,6 +1566,26 @@ long arch_do_domctl(
break;
#endif /* __x86_64__ */
+ case XEN_DOMCTL_set_access_required:
+ {
+ struct domain *d;
+ struct p2m_domain* p2m;
+
+ ret = -EPERM;
+ if ( current->domain->domain_id == domctl->domain )
+ break;
+
+ ret = -ESRCH;
+ d = rcu_lock_domain_by_id(domctl->domain);
+ if ( d != NULL )
+ {
+ p2m = p2m_get_hostp2m(d);
+ p2m->access_required =
domctl->u.access_required.access_required;
+ rcu_unlock_domain(d);
+ }
+ }
+ break;
+
default:
ret = -ENOSYS;
break;
diff -r 253cc5185fb5 -r 281e5488ee97 xen/include/public/domctl.h
--- a/xen/include/public/domctl.h Wed Jan 05 18:49:34 2011 -0800
+++ b/xen/include/public/domctl.h Wed Jan 05 18:50:54 2011 -0800
@@ -820,6 +820,16 @@ typedef struct xen_domctl_vcpuextstate x
DEFINE_XEN_GUEST_HANDLE(xen_domctl_vcpuextstate_t);
#endif
+/* XEN_DOMCTL_set_access_required: sets whether a memory event listener
+ * must be present to handle page access events: if false, the page
+ * access will revert to full permissions if no one is listening;
+ * */
+struct xen_domctl_set_access_required {
+ uint8_t access_required;
+};
+typedef struct xen_domctl_set_access_required
xen_domctl_set_access_required_t;
+DEFINE_XEN_GUEST_HANDLE(xen_domctl_set_access_required_t);
+
struct xen_domctl {
uint32_t cmd;
#define XEN_DOMCTL_createdomain 1
@@ -882,6 +892,7 @@ struct xen_domctl {
#define XEN_DOMCTL_getpageframeinfo3 61
#define XEN_DOMCTL_setvcpuextstate 62
#define XEN_DOMCTL_getvcpuextstate 63
+#define XEN_DOMCTL_set_access_required 64
#define XEN_DOMCTL_gdbsx_guestmemio 1000
#define XEN_DOMCTL_gdbsx_pausevcpu 1001
#define XEN_DOMCTL_gdbsx_unpausevcpu 1002
@@ -934,6 +945,7 @@ struct xen_domctl {
struct xen_domctl_cpuid cpuid;
struct xen_domctl_vcpuextstate vcpuextstate;
#endif
+ struct xen_domctl_set_access_required access_required;
struct xen_domctl_gdbsx_memio gdbsx_guest_memio;
struct xen_domctl_gdbsx_pauseunp_vcpu gdbsx_pauseunp_vcpu;
struct xen_domctl_gdbsx_domstatus gdbsx_domstatus;
[-- Attachment #1.2: Type: text/html, Size: 3083 bytes --]
[-- Attachment #2: 3.patch --]
[-- Type: text/x-patch, Size: 2513 bytes --]
diff -r 253cc5185fb5 -r 281e5488ee97 xen/arch/x86/domctl.c
--- a/xen/arch/x86/domctl.c Wed Jan 05 18:49:34 2011 -0800
+++ b/xen/arch/x86/domctl.c Wed Jan 05 18:50:54 2011 -0800
@@ -1566,6 +1566,26 @@ long arch_do_domctl(
break;
#endif /* __x86_64__ */
+ case XEN_DOMCTL_set_access_required:
+ {
+ struct domain *d;
+ struct p2m_domain* p2m;
+
+ ret = -EPERM;
+ if ( current->domain->domain_id == domctl->domain )
+ break;
+
+ ret = -ESRCH;
+ d = rcu_lock_domain_by_id(domctl->domain);
+ if ( d != NULL )
+ {
+ p2m = p2m_get_hostp2m(d);
+ p2m->access_required = domctl->u.access_required.access_required;
+ rcu_unlock_domain(d);
+ }
+ }
+ break;
+
default:
ret = -ENOSYS;
break;
diff -r 253cc5185fb5 -r 281e5488ee97 xen/include/public/domctl.h
--- a/xen/include/public/domctl.h Wed Jan 05 18:49:34 2011 -0800
+++ b/xen/include/public/domctl.h Wed Jan 05 18:50:54 2011 -0800
@@ -820,6 +820,16 @@ typedef struct xen_domctl_vcpuextstate x
DEFINE_XEN_GUEST_HANDLE(xen_domctl_vcpuextstate_t);
#endif
+/* XEN_DOMCTL_set_access_required: sets whether a memory event listener
+ * must be present to handle page access events: if false, the page
+ * access will revert to full permissions if no one is listening;
+ * */
+struct xen_domctl_set_access_required {
+ uint8_t access_required;
+};
+typedef struct xen_domctl_set_access_required xen_domctl_set_access_required_t;
+DEFINE_XEN_GUEST_HANDLE(xen_domctl_set_access_required_t);
+
struct xen_domctl {
uint32_t cmd;
#define XEN_DOMCTL_createdomain 1
@@ -882,6 +892,7 @@ struct xen_domctl {
#define XEN_DOMCTL_getpageframeinfo3 61
#define XEN_DOMCTL_setvcpuextstate 62
#define XEN_DOMCTL_getvcpuextstate 63
+#define XEN_DOMCTL_set_access_required 64
#define XEN_DOMCTL_gdbsx_guestmemio 1000
#define XEN_DOMCTL_gdbsx_pausevcpu 1001
#define XEN_DOMCTL_gdbsx_unpausevcpu 1002
@@ -934,6 +945,7 @@ struct xen_domctl {
struct xen_domctl_cpuid cpuid;
struct xen_domctl_vcpuextstate vcpuextstate;
#endif
+ struct xen_domctl_set_access_required access_required;
struct xen_domctl_gdbsx_memio gdbsx_guest_memio;
struct xen_domctl_gdbsx_pauseunp_vcpu gdbsx_pauseunp_vcpu;
struct xen_domctl_gdbsx_domstatus gdbsx_domstatus;
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-01-06 3:53 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-06 3:53 [PATCH 3 of 7] REDO2: mem_access & mem_access 2: access listener can be required Joe Epstein
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).