xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Colp <pjcolp@cs.ubc.ca>
To: xen-devel@lists.xensource.com
Subject: [PATCH 2 of 3] xenpaging: Fix-up xenpaging tool code
Date: Tue, 27 Jul 2010 14:21:26 -0700	[thread overview]
Message-ID: <5a5bfb95a437cd860ab2.1280265686@talisker.cs.ubc.ca> (raw)
In-Reply-To: <patchbomb.1280265684@talisker.cs.ubc.ca>

# HG changeset patch
# User Patrick Colp <pjcolp@cs.ubc.ca>
# Date 1280265109 25200
# Node ID 5a5bfb95a437cd860ab2da71c6534a2bef8fa558
# Parent  6cb61775657f6ea362b3ff45ed22e67b00ad3ea5
xenpaging: Fix-up xenpaging tool code.

This isn't directly related to EPT checking, but does some general fix-ups
to the xenpaging code (adds some extra frees, etc.)

Signed-off-by: Patrick Colp <pjcolp@cs.ubc.ca>

diff -r 6cb61775657f -r 5a5bfb95a437 tools/xenpaging/xenpaging.c
--- a/tools/xenpaging/xenpaging.c	Tue Jul 27 14:11:49 2010 -0700
+++ b/tools/xenpaging/xenpaging.c	Tue Jul 27 14:11:49 2010 -0700
@@ -73,8 +73,9 @@
     xc_interface *xch;
     int rc;
 
-    xch = xc_interface_open(0,0,0);
-    if ( !xch ) return NULL;
+    xch = xc_interface_open(NULL, NULL, 0);
+    if ( !xch )
+        goto err_iface;
 
     DPRINTF("xenpaging init\n");
     *xch_r = xch;
@@ -101,7 +102,7 @@
     paging->mem_event.ring_page = init_page();
     if ( paging->mem_event.ring_page == NULL )
     {
-        ERROR("Error initialising shared page");
+        ERROR("Error initialising ring page");
         goto err;
     }
 
@@ -199,13 +200,33 @@
     return paging;
 
  err:
-    if ( paging->bitmap )
-        free(paging->bitmap);
-    if ( paging->platform_info )
-        free(paging->platform_info);
     if ( paging )
+    {
+        if ( paging->bitmap )
+            free(paging->bitmap);
+
+        if ( paging->platform_info )
+            free(paging->platform_info);
+
+        if ( paging->domain_info )
+            free(paging->domain_info);
+
+        if ( paging->mem_event.shared_page )
+        {
+            munlock(paging->mem_event.shared_page, PAGE_SIZE);
+            free(paging->mem_event.shared_page);
+        }
+
+        if ( paging->mem_event.ring_page )
+        {
+            munlock(paging->mem_event.ring_page, PAGE_SIZE);
+            free(paging->mem_event.ring_page);
+        }
+
         free(paging);
+    }
 
+ err_iface: 
     return NULL;
 }
 
@@ -619,6 +640,8 @@
     if ( rc == 0 )
         rc = rc1;
 
+    xc_interface_close(xch);
+
     return rc;
 }

  parent reply	other threads:[~2010-07-27 21:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-27 21:21 [PATCH 0 of 3] xenpaging: Check that EPT is enabled for target guest Patrick Colp
2010-07-27 21:21 ` [PATCH 1 of 3] xenpaging: Add a check to Xen for EPT Patrick Colp
2010-07-28 13:58   ` Ian Jackson
2010-07-28 13:59     ` Ian Jackson
2010-07-28 14:35       ` Patrick Colp
2010-07-28 15:19         ` Ian Jackson
2010-07-27 21:21 ` Patrick Colp [this message]
2010-07-28 14:00   ` [PATCH 2 of 3] xenpaging: Fix-up xenpaging tool code Ian Jackson
2010-07-28 14:57     ` Patrick Colp
2010-07-28 15:01       ` Gianni Tedesco
2010-07-28 15:28         ` Patrick Colp
2010-07-28 16:27           ` Patrick Colp
2010-07-28 15:06       ` Keir Fraser
2010-07-27 21:21 ` [PATCH 3 of 3] xenpaging: Add check to xenpaging tool for EPT error from Xen Patrick Colp
2010-09-15  8:37   ` Jiang, Yunhong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5a5bfb95a437cd860ab2.1280265686@talisker.cs.ubc.ca \
    --to=pjcolp@cs.ubc.ca \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).