From mboxrd@z Thu Jan 1 00:00:00 1970 From: Zoltan Kiss Subject: Re: RING_HAS_UNCONSUMED_REQUESTS oddness Date: Thu, 6 Mar 2014 16:31:20 +0000 Message-ID: <5318A2D8.3090808@citrix.com> References: <5318987C.3030303@citrix.com> <1394121221.13270.10.camel@hastur.hellion.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WLbCg-0005jR-GE for xen-devel@lists.xenproject.org; Thu, 06 Mar 2014 16:31:26 +0000 In-Reply-To: <1394121221.13270.10.camel@hastur.hellion.org.uk> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: "xen-devel@lists.xenproject.org" , Wei Liu List-Id: xen-devel@lists.xenproject.org On 06/03/14 15:53, Ian Campbell wrote: > On Thu, 2014-03-06 at 15:47 +0000, Zoltan Kiss wrote: >> By my understanding, there is no way rsp could be smaller than req, so >> there is no point having this. Am I missing something? > > It happens during wraparound, i.e. after req has wrapped but rsp hasn't > yet. The name of the macro suggest we are interested whether the ring has unconsumed requests, and netback uses it that way. The answer to that question is req_prod - req_cons. And it works if prod wrapped but cons didn't. rsp calculates the number of "consumed but not responded" requests (it also works well if req_cons wrapped but rsp_prod_pvt didn't), then subtract it from the ring size. So it gives the number of unconsumed responses + unconsumed requests + unused slots. Why do we care about it? And as it includes the number of unconsumed requests, it couldn't be smaller than that, could it? Zoli