From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alejandro Lucero Subject: Re: [PATCH v3 0/6] use IOVAs check based on DMA mask Date: Tue, 30 Oct 2018 10:23:31 +0000 Message-ID: References: <1538743527-8285-1-git-send-email-alejandro.lucero@netronome.com> <1593678.TTmrtHRuFR@xps> <2DBBFF226F7CF64BAFCA79B681719D954502B7E1@shsmsx102.ccr.corp.intel.com> <1651382.pnTT7vZl36@xps> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Cc: Thomas Monjalon , lei.a.yao@intel.com, dev , "Xu, Qian Q" , xueqin.lin@intel.com, Ferruh Yigit To: "Burakov, Anatoly" Return-path: Received: from mail-ed1-f68.google.com (mail-ed1-f68.google.com [209.85.208.68]) by dpdk.org (Postfix) with ESMTP id EBB164CA0 for ; Tue, 30 Oct 2018 11:23:42 +0100 (CET) Received: by mail-ed1-f68.google.com with SMTP id x31-v6so9967983edd.8 for ; Tue, 30 Oct 2018 03:23:42 -0700 (PDT) In-Reply-To: List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Tue, Oct 30, 2018 at 10:19 AM Burakov, Anatoly wrote: > On 29-Oct-18 11:39 AM, Alejandro Lucero wrote: > > I got a patch that solves a bug when calling rte_eal_dma_mask using the > > mask instead of the maskbits. However, this does not solves the deadlock. > > > > Interestingly, the problem looks like a compiler one. Calling > > rte_memseg_walk does not return when calling inside rt_eal_dma_mask, but > > if you modify the call like this: > > > > *diff --git a/lib/librte_eal/common/eal_common_memory.c > > b/lib/librte_eal/common/eal_common_memory.c* > > > > *index 12dcedf5c..69b26e464 100644* > > > > *--- a/lib/librte_eal/common/eal_common_memory.c* > > > > *+++ b/lib/librte_eal/common/eal_common_memory.c* > > > > @@ -462,7 +462,7 @@rte_eal_check_dma_mask(uint8_t maskbits) > > > > /* create dma mask */ > > > > mask = ~((1ULL << maskbits) - 1); > > > > - if (rte_memseg_walk(check_iova, &mask)) > > > > +if (!rte_memseg_walk(check_iova, &mask)) > > > > /* > > > > * Dma mask precludes hugepage usage. > > > > * This device can not be used and we do not need to keep > > > > > > it works, although the value returned to the invoker changes, of course. > > But the point here is it should be the same behaviour when calling > > rte_memseg_walk than before and it is not. > > > > > > Anatoly, maybe you can see something I can not. > > > > memseg walk will return 0 only when each callback returned 0 and there > were no more segments left to call callbacks on. If your code always > returns 0, then return value of memseg_walk will always be zero. > > If your code returns 1 or -1 in some cases, then this error condition > will trigger. If it doesn't, then your condition by which you decide to > return 1 or 0, is incorrect :) I couldn't spot any obvious issues there, > but i'll recheck. > > Thanks for looking at this, but I was wrong. The return code changes everything so it does not make sense to compare both. -- > Thanks, > Anatoly >