From: Alex Zeffertt <alex.zeffertt@eu.citrix.com>
To: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: [PATCH 11/24] [xen-unstable.hg] xenstored cmdline opts to tell it what port and grant ref to use to access dom0's xenstore page
Date: Mon, 23 Mar 2009 15:21:03 +0000 [thread overview]
Message-ID: <49C7A8DF.7050603@eu.citrix.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 2 bytes --]
[-- Attachment #2: xenstored_dom0_init_to_local_dom_init --]
[-- Type: text/plain, Size: 3786 bytes --]
Adds three flags to xenstored for it to initialize dom0's connection
from another domain.
TODO: This doesn't make too much sense anymore becuase we're not doing a
local_dom_init for stubdoms anyway. It also makes the local_domid flag
redundant.
Signed-off-by: Diego Ongaro <diego.ongaro@citrix.com>
Signed-off-by: Alex Zeffertt <alex.zeffertt@eu.citrix.com>
---
diff -r e9bc9e4ab2fb tools/xenstore/xenstored_core.c
--- a/tools/xenstore/xenstored_core.c Fri Aug 01 16:50:37 2008 +0100
+++ b/tools/xenstore/xenstored_core.c Fri Aug 01 16:50:39 2008 +0100
@@ -55,6 +55,10 @@
#include "hashtable.h"
extern int xce_handle; /* in xenstored_domain.c */
+
+unsigned int local_domid = 0;
+int dom0_grant_ref = -1;
+evtchn_port_t dom0_port = -1;
static bool verbose = false;
LIST_HEAD(connections);
@@ -1753,6 +1757,9 @@
{ "preserve-local", 0, NULL, 'L' },
{ "verbose", 0, NULL, 'V' },
{ "watch-nb", 1, NULL, 'W' },
+ { "local-domid", 1, NULL, 'x' },
+ { "dom0-grant-ref", 1, NULL, 'y' },
+ { "dom0-port", 1, NULL, 'z' },
{ NULL, 0, NULL, 0 } };
extern void dump_conn(struct connection *conn);
@@ -1813,6 +1820,15 @@
break;
case 'W':
quota_nb_watch_per_domain = strtol(optarg, NULL, 10);
+ break;
+ case 'x':
+ local_domid = strtol(optarg, NULL, 10);
+ break;
+ case 'y':
+ dom0_grant_ref = strtol(optarg, NULL, 10);
+ break;
+ case 'z':
+ dom0_port = strtol(optarg, NULL, 10);
break;
}
}
diff -r e9bc9e4ab2fb tools/xenstore/xenstored_domain.c
--- a/tools/xenstore/xenstored_domain.c Fri Aug 01 16:50:37 2008 +0100
+++ b/tools/xenstore/xenstored_domain.c Fri Aug 01 16:50:39 2008 +0100
@@ -578,26 +578,75 @@
{
}
+static int local_dom_init(void)
+{
+ extern unsigned int local_domid;
+ evtchn_port_t port;
+ struct domain *domain;
+
+ port = xenbus_evtchn();
+ if (port == -1) {
+ barf_perror("xenbus_evtchn()");
+ return -1;
+ }
+
+ domain = new_domain(NULL, local_domid, port);
+ if (domain == NULL) {
+ barf_perror("new_domain");
+ return -1;
+ }
+
+ domain->interface = xenbus_map();
+ if (domain->interface == NULL) {
+ barf_perror("xenbus_map()");
+ return -1;
+ }
+
+ talloc_steal(domain->conn, domain);
+
+ if (xc_evtchn_notify(xce_handle, domain->port) == -1) {
+ barf_perror("notify local domain failed");
+ return -1;
+ }
+
+ return 0;
+}
+
static int dom0_init(void)
{
- evtchn_port_t port;
+ extern unsigned int local_domid;
+ extern evtchn_port_t dom0_port;
+ extern int dom0_grant_ref;
struct domain *dom0;
- port = xenbus_evtchn();
- if (port == -1)
+ /* if we're in dom0, local_dom_init() has already done this */
+ if (local_domid == 0)
+ return 0;
+
+ if (dom0_port == -1 || dom0_grant_ref == -1)
return -1;
- dom0 = new_domain(NULL, 0, port);
- if (dom0 == NULL)
+ dom0 = new_domain(NULL, 0, dom0_port);
+ if (dom0 == NULL) {
+ barf_perror("new_domain dom0");
return -1;
+ }
- dom0->interface = xenbus_map();
- if (dom0->interface == NULL)
+ dom0->interface = xc_gnttab_map_grant_ref(*xcg_handle,
+ 0,
+ dom0_grant_ref,
+ PROT_READ|PROT_WRITE);
+ if (dom0->interface == NULL) {
+ barf_perror("xc_gnttab_map_grant_ref dom0");
return -1;
+ }
- talloc_steal(dom0->conn, dom0);
+ talloc_steal(dom0->conn, dom0);
- xc_evtchn_notify(xce_handle, dom0->port);
+ if (xc_evtchn_notify(xce_handle, dom0->port) == -1) {
+ barf_perror("notify dom0 failed");
+ return -1;
+ }
return 0;
}
@@ -633,6 +682,9 @@
if (xce_handle < 0)
barf_perror("Failed to open evtchn device");
+
+ if (local_dom_init() != 0)
+ barf_perror("Failed to initialize local domain's state");
if (dom0_init() != 0)
barf_perror("Failed to initialize dom0 state");
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
reply other threads:[~2009-03-23 15:21 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=49C7A8DF.7050603@eu.citrix.com \
--to=alex.zeffertt@eu.citrix.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.