WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

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

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] mem_event: check capabilities only once
From: Xen patchbot-unstable <patchbot@xxxxxxx>
Date: Fri, 11 Nov 2011 04:33:36 +0000
Delivery-date: Thu, 10 Nov 2011 20:39:38 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# 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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] mem_event: check capabilities only once, Xen patchbot-unstable <=