[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen master] tools/oxenstored: Implement Domain.rebind_evtchn



commit aecdc28d9538ca2a1028ef9bc6550cb171dbbed4
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Wed Nov 30 11:55:58 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Thu Dec 1 16:07:17 2022 +0000

    tools/oxenstored: Implement Domain.rebind_evtchn
    
    Generally speaking, the event channel local/remote port is fixed for the
    lifetime of the associated domain object.  The exception to this is a
    secondary XS_INTRODUCE (defined to re-bind to a new event channel) which 
pokes
    around at the domain object's internal state.
    
    We need to refactor the evtchn handling to support live update, so start by
    moving the relevant manipulation into Domain.
    
    No practical change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Edwin Török <edvin.torok@xxxxxxxxxx>
    Acked-by: Christian Lindig <christian.lindig@xxxxxxxxxx>
---
 tools/ocaml/xenstored/domain.ml  | 12 ++++++++++++
 tools/ocaml/xenstored/process.ml |  3 +--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/tools/ocaml/xenstored/domain.ml b/tools/ocaml/xenstored/domain.ml
index ab08dcf37f..d59a9401e2 100644
--- a/tools/ocaml/xenstored/domain.ml
+++ b/tools/ocaml/xenstored/domain.ml
@@ -63,6 +63,18 @@ let string_of_port = function
 let dump d chan =
        fprintf chan "dom,%d,%nd,%d\n" d.id d.mfn d.remote_port
 
+let rebind_evtchn d remote_port =
+       begin match d.port with
+       | None -> ()
+       | Some p -> Event.unbind d.eventchn p
+       end;
+       let local = Event.bind_interdomain d.eventchn d.id remote_port in
+       debug "domain %d rebind (l %s, r %d) => (l %d, r %d)"
+             d.id (string_of_port d.port) d.remote_port
+             (Xeneventchn.to_int local) remote_port;
+       d.remote_port <- remote_port;
+       d.port <- Some (local)
+
 let notify dom =
        match dom.port with
        | None -> warn "domain %d: attempt to notify on unknown port" dom.id
diff --git a/tools/ocaml/xenstored/process.ml b/tools/ocaml/xenstored/process.ml
index b2973aca2a..1c80e7198d 100644
--- a/tools/ocaml/xenstored/process.ml
+++ b/tools/ocaml/xenstored/process.ml
@@ -569,8 +569,7 @@ let do_introduce con t domains cons data =
                        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 <- remote_port;
-                               Domain.bind_interdomain edom;
+                               Domain.rebind_evtchn edom remote_port;
                        end;
                        edom
                else try
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.