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

[PATCH v2 4/6] tools/oxenstored: Implement Domain.rebind_evtchn


  • To: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Wed, 30 Nov 2022 16:54:53 +0000
  • Authentication-results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Christian Lindig <christian.lindig@xxxxxxxxxx>, David Scott <dave@xxxxxxxxxx>, Edwin Torok <edvin.torok@xxxxxxxxxx>, Rob Hoes <Rob.Hoes@xxxxxxxxxx>
  • Delivery-date: Wed, 30 Nov 2022 16:55:14 +0000
  • Ironport-data: A9a23:U5sKI62u7wZwXFuKhvbD5d5xkn2cJEfYwER7XKvMYLTBsI5bpzUFm GEaWTiGO/fZZDSnLYskaonn9xwE6JHTmNZqGgJlpC1hF35El5HIVI+TRqvS04F+DeWYFR46s J9OAjXkBJppJpMJjk71atANlVEliefTAOK5ULSfUsxIbVcMYD87jh5+kPIOjIdtgNyoayuAo tq3qMDEULOf82cc3lk8tuTS9nuDgNyo4GlC5wVlPagQ1LPjvyJ94Kw3dPnZw0TQGuG4LsbiL 87fwbew+H/u/htFIrtJRZ6iLyXm6paLVeS/oiI+t5qK23CulQRrukoPD9IOaF8/ttm8t4sZJ OOhF3CHYVxB0qXkwIzxWvTDes10FfUuFLTveRBTvSEPpqFvnrSFL/hGVSkL0YMkFulfAnlV1 qEZAS80aBXS3bmPwI2lYdl2v5F2RCXrFNt3VnBIyDjYCbAtQIzZQrWM7thdtNsyrpkQR7CEP ZNfMGcxKkSbC/FMEg5/5JYWteGknHTgNRZfr0qYv/Ef6GnP1g1hlrPqNbI5f/TaGJkJwRzE9 goq+UzyHDNDFuHB4wCH43mTmsnskSH6B9I7QejQGvlC3wTImz175ActfVeyv/SRkEO1XNNbb UsO9UIGvaU0sUCmUNT5dxm5u2Kf+A4RXcJKFO834x3LzbDbizt1HUBdEGQHMoZ/8pZrG3p6j Tdlgu8FGxRsqKa2FHO06Y6SqGLoYhEVEnEpVTU9GF5tD8bYnKk/iRfGT9BGGaGzj8HoFTyY/ w1mvBTSlJ1I05dVivzTEUTvxmv1+8OXFlJdChD/BDrN0+9vWGKyi2VEA3D/5O0IEouWR0LpU JMsy5nHt7Bm4X1geUWwrAQx8FOBva7t3N702wQH83wdG9OFpRaekXh4um0WGauQGp9slcXVS EHSoxhNw5RYIWGna6R6C6roVZp7kvS+S4m7CqyKBjarXnSXXFXflM2JTRfAt10BbWB2yf1vU XtlWZnE4Ykm5VRPk2PtGrZ1PU4DzSEi32LDLa0XPDz+uYdykEW9EO9fWHPXN7BR0U9xiFmNm zqpH5fQmko3vSyXSnW/zLP/2nhTdilhXM+m9pQOHgNBSyI/cFwc5zbq6etJU+RYc259z48kI lnVtpdk9WfC
  • Ironport-hdrordr: A9a23:B5XRNaO4lEXGs8BcTvCjsMiBIKoaSvp037By7TEUdfUnSL3+qy nOpoVi6faaslYssR0b9OxofZPwJE80lqQFmrX5X43SPzUO0VHAROoJ0WKh+UyDJ8SUzIFgPN JbEpSWf+efMbEVt6rHCUKDYrAdKZG8gdmVuds=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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>
---
CC: Christian Lindig <christian.lindig@xxxxxxxxxx>
CC: David Scott <dave@xxxxxxxxxx>
CC: Edwin Torok <edvin.torok@xxxxxxxxxx>
CC: Rob Hoes <Rob.Hoes@xxxxxxxxxx>

Note: This change deliberately doesn't reuse Domain.bind_interdomain, which is
removed by the end of the refactoring.

v2:
 * New.
---
 tools/ocaml/xenstored/domain.ml  | 12 ++++++++++++
 tools/ocaml/xenstored/process.ml |  6 ++----
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/tools/ocaml/xenstored/domain.ml b/tools/ocaml/xenstored/domain.ml
index ab08dcf37f62..d59a9401e211 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 b2973aca2a82..2ea940d7e2d5 100644
--- a/tools/ocaml/xenstored/process.ml
+++ b/tools/ocaml/xenstored/process.ml
@@ -567,11 +567,9 @@ let do_introduce con t domains cons data =
        let dom =
                if Domains.exist domains domid then
                        let edom = Domains.find domains domid in
-                       if (Domain.get_mfn edom) = mfn && 
(Connections.find_domain cons domid) != con then begin
+                       if (Domain.get_mfn edom) = mfn && 
(Connections.find_domain cons domid) != con then
                                (* Use XS_INTRODUCE for recreating the xenbus 
event-channel. *)
-                               edom.remote_port <- remote_port;
-                               Domain.bind_interdomain edom;
-                       end;
+                               Domain.rebind_evtchn edom remote_port;
                        edom
                else try
                        let ndom = Domains.create domains domid mfn remote_port 
in
-- 
2.11.0




 


Rackspace

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