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-devel

[Xen-devel] [PATCH RFC 3/5] Grant table for console, xenstore pages

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH RFC 3/5] Grant table for console, xenstore pages
From: Diego Ongaro <diego.ongaro@xxxxxxxxxx>
Date: Fri, 11 Jul 2008 20:16:27 +0100
Delivery-date: Fri, 11 Jul 2008 12:16:32 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4877B09E.5000909@xxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <4877B09E.5000909@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla-Thunderbird 2.0.0.14 (X11/20080509)
This patch modifies the console daemon to use xc_gnttab_map_grant_ref
instead of xc_map_foreign_range.

Make sure you have linux-2.6.18-xen.hg changeset 600:1bd3dbfdaf0f before
running this.

Signed-off-by: Diego Ongaro <diego.ongaro@xxxxxxxxxx>
---
diff -r e0be727aa133 tools/console/daemon/io.c
--- a/tools/console/daemon/io.c Thu Jul 10 19:30:51 2008 +0100
+++ b/tools/console/daemon/io.c Thu Jul 10 19:50:47 2008 +0100
@@ -25,6 +25,7 @@
 #include <xs.h>
 #include <xen/io/console.h>
 #include <xenctrl.h>
+#include <xen/grant_table.h>
 
 #include <stdlib.h>
 #include <errno.h>
@@ -540,10 +541,9 @@
        if (ring_ref != dom->ring_ref) {
                if (dom->interface != NULL)
                        munmap(dom->interface, getpagesize());
-               dom->interface = xc_map_foreign_range(
-                       xc, dom->domid, getpagesize(),
-                       PROT_READ|PROT_WRITE,
-                       (unsigned long)ring_ref);
+               dom->interface = xc_gnttab_map_grant_ref(xcg, dom->domid,
+                                                        
GNTTAB_RESERVED_CONSOLE,
+                                                        PROT_READ|PROT_WRITE);
                if (dom->interface == NULL) {
                        err = EINVAL;
                        goto out;
diff -r e0be727aa133 tools/console/daemon/utils.c
--- a/tools/console/daemon/utils.c      Thu Jul 10 19:30:51 2008 +0100
+++ b/tools/console/daemon/utils.c      Thu Jul 10 19:50:47 2008 +0100
@@ -37,8 +37,9 @@
 #include "xenctrl.h"
 #include "utils.h"
 
-struct xs_handle *xs;
-int xc;
+struct xs_handle *xs = NULL;
+int xc = -1;
+int xcg = -1;
 
 static void child_exit(int sig)
 {
@@ -122,6 +123,12 @@
                goto out;
        }
 
+       xcg = xc_gnttab_open();
+       if (xcg == -1) {
+               dolog(LOG_ERR, "Failed to open gnttab (%m)");
+               goto out;
+       }
+
        if (!xs_watch(xs, "@introduceDomain", "domlist")) {
                dolog(LOG_ERR, "xenstore watch on @introduceDomain fails.");
                goto out;
@@ -139,6 +146,8 @@
                xs_daemon_close(xs);
        if (xc != -1)
                xc_interface_close(xc);
+       if (xcg != -1)
+               xc_gnttab_close(xcg);
        return false;
 }
 
diff -r e0be727aa133 tools/console/daemon/utils.h
--- a/tools/console/daemon/utils.h      Thu Jul 10 19:30:51 2008 +0100
+++ b/tools/console/daemon/utils.h      Thu Jul 10 19:50:47 2008 +0100
@@ -32,6 +32,7 @@
 
 extern struct xs_handle *xs;
 extern int xc;
+extern int xcg;
 
 #if 1
 #define dolog(val, fmt, ...) do {                              \

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