From: Samuel Thibault Subject: Re: [PATCH RFC] tools/ocaml/xb: Correct calculations of data/space the ring Date: Wed, 28 Oct 2015 17:56:25 +0100 Message-ID: <20151028165625.GI2924@var.bordeaux.inria.fr> References: <1446048336-19154-1-git-send-email-andrew.cooper3@citrix.com> <20151028161813.GU2924@var.bordeaux.inria.fr> <5630FB4A.6090403@citrix.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: <5630FB4A.6090403@citrix.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: Andrew Cooper Cc: Wei Liu , David Scott , Ian Jackson , Ian Campbell , Xen-devel List-Id: xen-devel@lists.xenproject.org Andrew Cooper, le Wed 28 Oct 2015 16:43:54 +0000, a =E9crit : > > 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) >=3D XENSTORE_RING_SIZE checks for the prod getting more > than a ring's worth ahead of cons. > = > (cons - prod) < -XENSTORE_RING_SIZE is supposed to check for cons > getting ahead of prod If cons is a ahead of prod, prod-cons is way bigger than XENSTORE_RING_SIZE, and thus the first test already catches that. In the 2^32 wrap case, the difference will still be correct. Samuel