]> xenbits.xensource.com Git - people/iwj/xen.git/commitdiff
tools/oxenstored: port XS_INTRODUCE evtchn rebind function from cxenstored
authorIgor Druzhinin <igor.druzhinin@citrix.com>
Mon, 19 Aug 2019 18:45:35 +0000 (19:45 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 23 Aug 2019 12:34:36 +0000 (13:34 +0100)
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>
Acked-by: Christian Lindig <christian.lindig@citrix.com>
tools/ocaml/xenstored/domain.ml
tools/ocaml/xenstored/process.ml

index b0a01b06faadcee9b66e3d5051a28e7169fa9fb4..aeb185ff7e4e82592bb47489cda6b4b93bd1e72f 100644 (file)
@@ -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)
 
index 8a7e538893cea10c4445054908da9cc190018134..ff5c9484fc1d2c8d19ac3dd0cb40efd176610333 100644 (file)
@@ -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;