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

[Xen-changelog] [xen-unstable] xenpaging: Open paging file only if xenpaging_init() succeeds



# HG changeset patch
# User Keir Fraser <keir@xxxxxxx>
# Date 1290780959 0
# Node ID 7818ea9045fd1aa9dd7ef2e1b6a6281e296ae9d9
# Parent  0d0a18cd416f55921a686c32a1a8955d80907545
xenpaging: Open paging file only if xenpaging_init() succeeds

Open paging file only if xenpaging_init() succeeds. It can fail if the
host does not support the required virtualization features such as EPT
or if xenpaging was already started for this domain_id.

Signed-off-by: Olaf Hering <olaf@xxxxxxxxx>
Already-Acked-by: Patrick Colp <pjcolp@xxxxxxxxx>
Already-Acked-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 tools/xenpaging/xenpaging.c |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)

diff -r 0d0a18cd416f -r 7818ea9045fd tools/xenpaging/xenpaging.c
--- a/tools/xenpaging/xenpaging.c       Fri Nov 26 14:15:21 2010 +0000
+++ b/tools/xenpaging/xenpaging.c       Fri Nov 26 14:15:59 2010 +0000
@@ -502,6 +502,17 @@ int main(int argc, char *argv[])
 
     victims = calloc(num_pages, sizeof(xenpaging_victim_t));
 
+    /* Seed random-number generator */
+    srand(time(NULL));
+
+    /* Initialise domain paging */
+    paging = xenpaging_init(&xch, domain_id);
+    if ( paging == NULL )
+    {
+        ERROR("Error initialising paging");
+        goto out;
+    }
+
     /* Open file */
     sprintf(filename, "page_cache_%d", domain_id);
     fd = open(filename, open_flags, open_mode);
@@ -509,17 +520,6 @@ int main(int argc, char *argv[])
     {
         perror("failed to open file");
         return -1;
-    }
-
-    /* Seed random-number generator */
-    srand(time(NULL));
-
-    /* Initialise domain paging */
-    paging = xenpaging_init(&xch, domain_id);
-    if ( paging == NULL )
-    {
-        ERROR("Error initialising paging");
-        goto out;
     }
 
     /* Evict pages */

_______________________________________________
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®.