From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 87051A0351 for ; Mon, 10 Jan 2022 14:25:27 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 707E641158; Mon, 10 Jan 2022 14:25:27 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id 7C82F40041; Mon, 10 Jan 2022 14:25:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1641821125; x=1673357125; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=PFBJJhRVsGv/JmqeoZ4vqy+Urwc2S5FkyGGXutMDd54=; b=nwntJM5/PeG0yJKq9JotD8ZY8aDgvuxEjaL7flLo7eZ8CxYMy8H4wadS UE/o6Lkd8FwxUTmAb69IZEujnWzJmOERmJZoGt+PVhHU2sv3HPRNNpA0k 4GiH6bIhEtJ0RWJ2P9MrI2J5dDyaCVMJBYUIrNricZ1ATGG10S25nDaLq 5foXOVJ5nfdbxOol6pupbxSRaQqo4BJH883MFZA0MrsrdLywaG1wZHTeF RWibqsyf9pa6gOV8pdfPr9hfZf7bhB+NZsnCIup1AyjBUF08ElEV7AY4N DFUivn6DIvTpAiZisow7sin8juQ/hXznZ2ERR3NhUBY3q51BttdAhLJDS Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10222"; a="240773528" X-IronPort-AV: E=Sophos;i="5.88,277,1635231600"; d="scan'208";a="240773528" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jan 2022 05:25:23 -0800 X-IronPort-AV: E=Sophos;i="5.88,277,1635231600"; d="scan'208";a="557982773" Received: from bricha3-mobl.ger.corp.intel.com ([10.252.15.55]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-SHA; 10 Jan 2022 05:25:21 -0800 Date: Mon, 10 Jan 2022 13:25:18 +0000 From: Bruce Richardson To: "Pai G, Sunil" Cc: "dev@dpdk.org" , "Laatz, Kevin" , "stable@dpdk.org" , "Hu, Jiayu" Subject: Re: [PATCH] dma/idxd: fix burst capacity calculation Message-ID: References: <20211220170514.736732-1-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org On Mon, Jan 10, 2022 at 01:09:02PM +0000, Pai G, Sunil wrote: > Hi Bruce, Kevin > > This patch seems to have uncovered a bug in the driver. > On applying, the idxd_burst_capacity API seems to return 0 for cases even when there are batch descriptors and ring space available. > Seems like there is a wraparound missing when calculating the descriptor ring space, causing this behavior. > > Below change seems to fix the issue. > > @@ -483,7 +496,7 @@ idxd_burst_capacity(const void *dev_private, uint16_t vchan __rte_unused) > /* For descriptors, check for wrap-around on write but not read */ > if (idxd->ids_returned > write_idx) > write_idx += idxd->desc_ring_mask + 1; > - used_space = write_idx - idxd->ids_returned; > + used_space = (write_idx - idxd->ids_returned)&idxd->desc_ring_mask; > > > > Could we include this fix in the current patch ? > Hi Sunil, what values for the write_idx and ids_returned vars give this error, and how does masking help? I'd expect masking to increase the number of times the function returns zero, rather than decreasing it. /Bruce