Re: [Xen-devel] [PATCH v2 1/1] tools/ocaml: Re-introduce Xenctrl.with_intf wrapper [and 1 more messages]

2018-10-31 Thread Ian Jackson
Christian Lindig writes ("Re: [PATCH v2 1/1] tools/ocaml: Re-introduce 
Xenctrl.with_intf wrapper [and 1 more messages]"):
> On 31/10/18 16:01, Ian Jackson wrote:
> > IMO the bug is that spong calls close_handle which has a distant
> > destructive action, without being able to know that it is safe to do
> > so.
> 
> I will add add more words or caution. Thanks for pointing it out.

YW, thank you.

Ian.

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

Re: [Xen-devel] [PATCH v2 1/1] tools/ocaml: Re-introduce Xenctrl.with_intf wrapper [and 1 more messages]

2018-10-31 Thread Christian Lindig


On 31/10/18 16:01, Ian Jackson wrote:

IMO the bug is that spong calls close_handle which has a distant
destructive action, without being able to know that it is safe to do
so.

I will add add more words or caution. Thanks for pointing it out.

-- C

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

Re: [Xen-devel] [PATCH v2 1/1] tools/ocaml: Re-introduce Xenctrl.with_intf wrapper [and 1 more messages]

2018-10-31 Thread Ian Jackson
Christian Lindig writes ("Re: [PATCH v2 1/1] tools/ocaml: Re-introduce 
Xenctrl.with_intf wrapper [and 1 more messages]"):
> On 31/10/18 15:41, Ian Jackson wrote:
> > this needs a stronger warning against anyone ever calling it, or a
> > clearer explanation of the consquences (whose scope is very broad).
> 
> The consequence is that the global handle is closed but it would be 
> opened again if
> one called with_intf again. So I'm not sure that this would be 
> dangerous. Maybe a warning
> that is should be if at all called before process termination? I'm hapy 
> to make such a change.

 with_intf
do some stuff with get_handle (1)
spong
do some stuff with get_handle (2)

 let spong = with_intf
do some stuff with handle
close_handle

(forgive my syntax but I hope you get the idea).  This will crash in
(2)'s call to get_handle.

IMO the bug is that spong calls close_handle which has a distant
destructive action, without being able to know that it is safe to do
so.

Ian.

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

Re: [Xen-devel] [PATCH v2 1/1] tools/ocaml: Re-introduce Xenctrl.with_intf wrapper [and 1 more messages]

2018-10-31 Thread Christian Lindig

On 31/10/18 15:41, Ian Jackson wrote:

this needs a stronger warning against anyone ever calling it, or a
clearer explanation of the consquences (whose scope is very broad).


The consequence is that the global handle is closed but it would be 
opened again if
one called with_intf again. So I'm not sure that this would be 
dangerous. Maybe a warning
that is should be if at all called before process termination? I'm hapy 
to make such a change.


-- C

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

Re: [Xen-devel] [PATCH v2 1/1] tools/ocaml: Re-introduce Xenctrl.with_intf wrapper [and 1 more messages]

2018-10-31 Thread Ian Jackson
Christian Lindig writes ("[PATCH 1/1] tools/ocaml: Re-introduce 
Xenctrl.with_intf wrapper"):
> Commit 81946a73dc975a7dafe9017a8e61d1e64fdbedbf removed
> Xenctrl.with_intf based on its undesirable behaviour of opening and
> closing a Xenctrl connection with every invocation. This commit
> re-introduces with_intf but with an updated behaviour: it maintains a
> global Xenctrl connection which is opened upon first usage and kept
> open. This handle can be obtained by clients using new functions
> get_handle() and close_handle().

Thanks, I like the changes you made.

I still think

> +(** [close handle] closes the handle maintained by [with_intf] *)
> +val close_handle: unit -> unit

this needs a stronger warning against anyone ever calling it, or a
clearer explanation of the consquences (whose scope is very broad).

Ian.

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