[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] mem_event: check capabilities only once



# HG changeset patch
# User Olaf Hering <olaf@xxxxxxxxx>
# Date 1320780942 0
# Node ID 2af5bfbc9fdee08af184d9dfc48c368619719e0f
# Parent  89efd82620ec72d0a6dad5b977d1cdd45a1d701a
mem_event: check capabilities only once

It is not required to check the system capabilities during every domctl.
Rearrange the code to check them only once.

Signed-off-by: Olaf Hering <olaf@xxxxxxxxx>
Committed-by: Keir Fraser <keir@xxxxxxx>
---


diff -r 89efd82620ec -r 2af5bfbc9fde xen/arch/x86/mm/mem_event.c
--- a/xen/arch/x86/mm/mem_event.c       Tue Nov 08 19:35:01 2011 +0000
+++ b/xen/arch/x86/mm/mem_event.c       Tue Nov 08 19:35:42 2011 +0000
@@ -253,32 +253,35 @@
     case XEN_DOMCTL_MEM_EVENT_OP_PAGING:
     {
         struct mem_event_domain *med = &d->mem_paging;
-        struct p2m_domain *p2m = p2m_get_hostp2m(d);
-        rc = -ENODEV;
-        /* Only HAP is supported */
-        if ( !hap_enabled(d) )
-            break;
-
-        /* Currently only EPT is supported */
-        if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
-            break;
-
-        rc = -EXDEV;
-        /* Disallow paging in a PoD guest */
-        if ( p2m->pod.entry_count )
-            break;
+        rc = -EINVAL;
 
         switch( mec->op )
         {
         case XEN_DOMCTL_MEM_EVENT_OP_PAGING_ENABLE:
         {
+            struct p2m_domain *p2m = p2m_get_hostp2m(d);
+            rc = -ENODEV;
+            /* Only HAP is supported */
+            if ( !hap_enabled(d) )
+                break;
+
+            /* Currently only EPT is supported */
+            if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
+                break;
+
+            rc = -EXDEV;
+            /* Disallow paging in a PoD guest */
+            if ( p2m->pod.entry_count )
+                break;
+
             rc = mem_event_enable(d, mec, med);
         }
         break;
 
         case XEN_DOMCTL_MEM_EVENT_OP_PAGING_DISABLE:
         {
-            rc = mem_event_disable(med);
+            if ( med->ring_page )
+                rc = mem_event_disable(med);
         }
         break;
 
@@ -295,26 +298,29 @@
     case XEN_DOMCTL_MEM_EVENT_OP_ACCESS: 
     {
         struct mem_event_domain *med = &d->mem_access;
-        rc = -ENODEV;
-        /* Only HAP is supported */
-        if ( !hap_enabled(d) )
-            break;
-
-        /* Currently only EPT is supported */
-        if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
-            break;
+        rc = -EINVAL;
 
         switch( mec->op )
         {
         case XEN_DOMCTL_MEM_EVENT_OP_ACCESS_ENABLE:
         {
+            rc = -ENODEV;
+            /* Only HAP is supported */
+            if ( !hap_enabled(d) )
+                break;
+
+            /* Currently only EPT is supported */
+            if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
+                break;
+
             rc = mem_event_enable(d, mec, med);
         }
         break;
 
         case XEN_DOMCTL_MEM_EVENT_OP_ACCESS_DISABLE:
         {
-            rc = mem_event_disable(&d->mem_access);
+            if ( med->ring_page )
+                rc = mem_event_disable(&d->mem_access);
         }
         break;
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.