[Xen-devel] [PATCH RFC] tools/ocaml/xb: Correct calculations of data/space the ring

2015-10-28 Thread Andrew Cooper
ml_interface_{read,write}() would miscalculate the quantity of data/space in the ring if it crossed the ring boundary, and incorrectly return a short read/write. This causes a protocol stall, as either side of the ring ends up waiting for what they believe to be the other side needing to take the

Re: [Xen-devel] [PATCH RFC] tools/ocaml/xb: Correct calculations of data/space the ring

2015-10-28 Thread Samuel Thibault
Andrew Cooper, le Wed 28 Oct 2015 16:05:36 +, a écrit : > @@ -62,22 +62,32 @@ CAMLprim value ml_interface_read(value ml_interface, > > xen_mb(); > > - if ((prod - cons) > XENSTORE_RING_SIZE) > + if (((prod - cons) > XENSTORE_RING_SIZE) || > +((cons - prod) < -XENST

Re: [Xen-devel] [PATCH RFC] tools/ocaml/xb: Correct calculations of data/space the ring

2015-10-28 Thread Andrew Cooper
On 28/10/15 16:18, Samuel Thibault wrote: > Andrew Cooper, le Wed 28 Oct 2015 16:05:36 +, a écrit : >> @@ -62,22 +62,32 @@ CAMLprim value ml_interface_read(value ml_interface, >> >> xen_mb(); >> >> -if ((prod - cons) > XENSTORE_RING_SIZE) >> +if (((prod - cons) > XENSTORE_RING_

Re: [Xen-devel] [PATCH RFC] tools/ocaml/xb: Correct calculations of data/space the ring

2015-10-28 Thread Samuel Thibault
Andrew Cooper, le Wed 28 Oct 2015 16:43:54 +, a écrit : > > IIRC the test is not bogus even when prod wraps around, (prod - cons) > > will still correctly be the difference between both, modulo 2^32. > > (prod - cons) >= XENSTORE_RING_SIZE checks for the prod getting more > than a ring's worth

Re: [Xen-devel] [PATCH RFC] tools/ocaml/xb: Correct calculations of data/space the ring

2015-10-28 Thread Andrew Cooper
On 28/10/15 16:56, Samuel Thibault wrote: > Andrew Cooper, le Wed 28 Oct 2015 16:43:54 +, a écrit : >>> IIRC the test is not bogus even when prod wraps around, (prod - cons) >>> will still correctly be the difference between both, modulo 2^32. >> (prod - cons) >= XENSTORE_RING_SIZE checks for t