From mboxrd@z Thu Jan 1 00:00:00 1970 From: Samuel Thibault Subject: Re: [Minios-devel] [PATCH MINI-OS v2] xenbus: notify the other end when necessary Date: Mon, 26 Oct 2015 18:11:04 +0100 Message-ID: <20151026171104.GJ18602@var.bordeaux.inria.fr> References: <1445863676-14874-1-git-send-email-wei.liu2@citrix.com> <20151026125247.GP19459@var.bordeaux.inria.fr> <20151026135531.GG13118@zion.uk.xensource.com> <20151026163001.GF18602@var.bordeaux.inria.fr> <22062.21898.162478.153744@mariner.uk.xensource.com> <20151026163751.GH18602@var.bordeaux.inria.fr> <20151026164115.GE19925@zion.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline In-Reply-To: <20151026164115.GE19925@zion.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Wei Liu Cc: minios-devel@lists.xenproject.org, Xen-devel , Ian Jackson , Ian Campbell List-Id: xen-devel@lists.xenproject.org Wei Liu, le Mon 26 Oct 2015 16:41:15 +0000, a =E9crit : > The oxenstored in staging. Ok. For a first, one fishy thing at quick sight is that the only occurence of rsp_cons (except at closure) is when writing, and not when going to sleep. One issue there is that ml_interface_write only writes a contiguous piece of data, so when crossing the ring bound, it will return a short write while there *is* room! One quick test you could do is calling Xs_ring.write a second time in tools/ocaml/libs/xb/xb.ml's write_mmap, something like below (untested, and my caml is old, so it's ugly, but you get the idea). Samuel diff --git a/tools/ocaml/libs/xb/xb.ml b/tools/ocaml/libs/xb/xb.ml index 50944b5..33298d2 100644 --- a/tools/ocaml/libs/xb/xb.ml +++ b/tools/ocaml/libs/xb/xb.ml @@ -91,10 +91,12 @@ let write_fd back con s len =3D Unix.write back.fd s 0 len = let write_mmap back con s len =3D - let ws =3D Xs_ring.write back.mmap s len in - if ws > 0 then + let ws =3D ref (Xs_ring.write back.mmap s len) in + if !ws < len then + ws :=3D !ws + Xs_ring.write back.mmap (String.sub s !ws (len-!ws)) (len-= !ws); + if !ws > 0 then back.eventchn_notify (); - ws + !ws = let write con s len =3D match con.backend with