xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [Xen-devel] [PATCH] tools/oxenstored: port XS_INTRODUCE evtchn rebind function from cxenstored
@ 2019-08-19 18:45 Igor Druzhinin
  2019-08-20  8:21 ` Christian Lindig
  0 siblings, 1 reply; 6+ messages in thread
From: Igor Druzhinin @ 2019-08-19 18:45 UTC (permalink / raw)
  To: xen-devel; +Cc: Igor Druzhinin, ian.jackson, christian.lindig, wl, dave

C version of xenstored had this ability since 61aaed0d5 ("Allow
XS_INTRODUCE to be used for rebinding the xenstore evtchn.") from 2007.
Copy it as is to Ocaml version.

Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
---
 tools/ocaml/xenstored/domain.ml  | 6 +++++-
 tools/ocaml/xenstored/process.ml | 8 +++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/tools/ocaml/xenstored/domain.ml b/tools/ocaml/xenstored/domain.ml
index b0a01b0..aeb185f 100644
--- a/tools/ocaml/xenstored/domain.ml
+++ b/tools/ocaml/xenstored/domain.ml
@@ -23,9 +23,9 @@ type t =
 {
 	id: Xenctrl.domid;
 	mfn: nativeint;
-	remote_port: int;
 	interface: Xenmmap.mmap_interface;
 	eventchn: Event.t;
+	mutable remote_port: int;
 	mutable port: Xeneventchn.t option;
 	mutable bad_client: bool;
 	mutable io_credit: int; (* the rounds of ring process left to do, default is 0,
@@ -71,6 +71,10 @@ let notify dom = match dom.port with
 	Event.notify dom.eventchn port
 
 let bind_interdomain dom =
+	begin match dom.port with
+	| None -> ()
+	| Some port -> Event.unbind dom.eventchn port
+	end;
 	dom.port <- Some (Event.bind_interdomain dom.eventchn dom.id dom.remote_port);
 	debug "bound domain %d remote port %d to local port %s" dom.id dom.remote_port (string_of_port dom.port)
 
diff --git a/tools/ocaml/xenstored/process.ml b/tools/ocaml/xenstored/process.ml
index 8a7e538..ff5c948 100644
--- a/tools/ocaml/xenstored/process.ml
+++ b/tools/ocaml/xenstored/process.ml
@@ -408,7 +408,13 @@ let do_introduce con _t domains cons data =
 		in
 	let dom =
 		if Domains.exist domains domid then
-			Domains.find domains domid
+			let edom = Domains.find domains domid in
+			if (Domain.get_mfn edom) = mfn && (Connections.find_domain cons domid) != con then begin
+				(* Use XS_INTRODUCE for recreating the xenbus event-channel. *)
+				edom.remote_port <- port;
+				Domain.bind_interdomain edom;
+			end;
+			edom
 		else try
 			let ndom = Domains.create domains domid mfn port in
 			Connections.add_domain cons ndom;
-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-08-20 13:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-19 18:45 [Xen-devel] [PATCH] tools/oxenstored: port XS_INTRODUCE evtchn rebind function from cxenstored Igor Druzhinin
2019-08-20  8:21 ` Christian Lindig
2019-08-20 10:45   ` Igor Druzhinin
2019-08-20 12:11     ` Christian Lindig
2019-08-20 12:45       ` Igor Druzhinin
2019-08-20 13:09         ` Christian Lindig

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).