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

Re: [Xen-devel] [PATCH] tools/oxenstored: port XS_INTRODUCE evtchn rebind function from cxenstored


  • To: Igor Druzhinin <igor.druzhinin@xxxxxxxxxx>
  • From: Christian Lindig <christian.lindig@xxxxxxxxxx>
  • Date: Tue, 20 Aug 2019 08:21:29 +0000
  • Accept-language: en-GB, en-US
  • Authentication-results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=christian.lindig@xxxxxxxxxx; spf=Pass smtp.mailfrom=christian.lindig@xxxxxxxxxx; spf=None smtp.helo=postmaster@xxxxxxxxxxxxxxx
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Ian Jackson <Ian.Jackson@xxxxxxxxxx>, "wl@xxxxxxx" <wl@xxxxxxx>, David Scott <dave@xxxxxxxxxx>
  • Delivery-date: Tue, 20 Aug 2019 08:21:53 +0000
  • Ironport-sdr: nvGiC/RxAdsIO3ddDrWKIzVgpZ0IY2RIhZMXoIbmgy/S05oZtq/I1NXp7fmd0QgJMD2w4yo3ib B4eiKL/vgSr0ErDL6nF63Gd3D3sEC3+Ejp/E37IMw7s91HXOAraqgzUJE2stb2wOK5OdWzNSQz YiWS618EbX7Fjq+604HFK9ydijBhB7XLTm8CmN4UlVCm7QjIOe93oUCrUugD5nwAfyL7U+0Nom gpsffXgOO0Q777KggaEpbQkKaA1P+Js3rbe4FZFp5awoXzxnHNY30iyZCoE7Aji0Pins8XN0oL sUQ=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHVVr5MK6au/yYrc0WquZUXd0SG76cDkYSA
  • Thread-topic: [PATCH] tools/oxenstored: port XS_INTRODUCE evtchn rebind function from cxenstored

> +                     if (Domain.get_mfn edom) = mfn && 
> (Connections.find_domain cons domid) != con then begin

This should use <> instead of != because != is pointer inequality in OCaml. The 
parentheses are not strictly necessary because function application has 
precedence. So:

        if Domain.get_mfn edom = mfn && Connections.find_domain cons domid <> 
con then begin

— Christian

> On 19 Aug 2019, at 19:45, Igor Druzhinin <igor.druzhinin@xxxxxxxxxx> wrote:
> 
> 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@xxxxxxxxxx>
> ---
> 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@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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