From: Wei Liu Subject: Re: [Minios-devel] [PATCH MINI-OS v2] xenbus: notify the other end when necessary Date: Tue, 27 Oct 2015 10:32:18 +0000 Message-ID: <20151027103218.GQ18674@zion.uk.xensource.com> 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> <20151026171104.GJ18602@var.bordeaux.inria.fr> <20151026183459.GO18674@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: <20151026183459.GO18674@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: Samuel Thibault , Wei Liu , Ian Jackson , minios-devel@lists.xenproject.org, Xen-devel , Ian Campbell List-Id: xen-devel@lists.xenproject.org On Mon, Oct 26, 2015 at 06:34:59PM +0000, Wei Liu wrote: > On Mon, Oct 26, 2015 at 06:11:04PM +0100, Samuel Thibault wrote: > > 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 > = > I'm now running a slightly modified version of this diff (to fix > compilation) and a mini-os only notifies the other end when it consumes > message. > = > The result is looking good, but I will let it run overnight to be sure. > = The test ran overnight without issue. I think it would be sensible to take my v2 patch for mini-os and work on fixes for xenstored. I haven't checked if cxenstored behaves the same, though. Wei.