From mboxrd@z Thu Jan 1 00:00:00 1970 From: Keir Fraser Subject: Re: [PATCH v3] io/ring.h: new macro to detect whether there are too many requests on the ring Date: Tue, 11 Jun 2013 11:10:05 +0100 Message-ID: References: <51B6FA9702000078000DCFE8@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <51B6FA9702000078000DCFE8@nat28.tlf.novell.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: Jan Beulich , xen-devel Cc: Konrad Rzeszutek Wilk List-Id: xen-devel@lists.xenproject.org On 11/06/2013 09:23, "Jan Beulich" wrote: > Backends may need to protect themselves against an insane number of > produced requests stored by a frontend, in case they iterate over > requests until reaching the req_prod value. There can't be more > requests on the ring than the difference between produced requests > and produced (but possibly not yet published) responses. > > This is a more strict alternative to a patch previously posted by > Konrad Rzeszutek Wilk . > > Signed-off-by: Jan Beulich Acked-by: Keir Fraser > --- a/xen/include/public/io/ring.h > +++ b/xen/include/public/io/ring.h > @@ -234,6 +234,10 @@ typedef struct __name##_back_ring __name > #define RING_REQUEST_CONS_OVERFLOW(_r, _cons) \ > (((_cons) - (_r)->rsp_prod_pvt) >= RING_SIZE(_r)) > > +/* Ill-behaved frontend determination: Can there be this many requests? */ > +#define RING_REQUEST_PROD_OVERFLOW(_r, _prod) \ > + (((_prod) - (_r)->rsp_prod_pvt) > RING_SIZE(_r)) > + > #define RING_PUSH_REQUESTS(_r) do { \ > xen_wmb(); /* back sees requests /before/ updated producer index */ \ > (_r)->sring->req_prod = (_r)->req_prod_pvt; \ > > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel