From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <anatoly.burakov@intel.com>
Received: from mga11.intel.com (mga11.intel.com [192.55.52.93])
 by dpdk.org (Postfix) with ESMTP id 166C42C54
 for <dev@dpdk.org>; Tue, 30 Oct 2018 11:19:01 +0100 (CET)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from fmsmga001.fm.intel.com ([10.253.24.23])
 by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 30 Oct 2018 03:19:00 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.54,444,1534834800"; d="scan'208";a="103733441"
Received: from aburakov-mobl1.ger.corp.intel.com (HELO [10.237.220.72])
 ([10.237.220.72])
 by fmsmga001.fm.intel.com with ESMTP; 30 Oct 2018 03:18:59 -0700
To: Alejandro Lucero <alejandro.lucero@netronome.com>,
 Thomas Monjalon <thomas@monjalon.net>
Cc: lei.a.yao@intel.com, dev <dev@dpdk.org>, "Xu, Qian Q"
 <qian.q.xu@intel.com>, xueqin.lin@intel.com,
 Ferruh Yigit <ferruh.yigit@intel.com>
References: <1538743527-8285-1-git-send-email-alejandro.lucero@netronome.com>
 <1593678.TTmrtHRuFR@xps>
 <2DBBFF226F7CF64BAFCA79B681719D954502B7E1@shsmsx102.ccr.corp.intel.com>
 <1651382.pnTT7vZl36@xps>
 <CAD+H990PQAvQc+HHE+6fv9JLJbVKVwTpViLotnE72=8RHM8JEA@mail.gmail.com>
 <CAD+H992DCBMX9m65gK92t5p4aFTJA9jOJRBz7qOzPnwqMEfK0A@mail.gmail.com>
 <CAD+H990H1WQZiHZYd5jwEWQX+4RFM+_8c0MF2vZKRxb2fsRX8g@mail.gmail.com>
From: "Burakov, Anatoly" <anatoly.burakov@intel.com>
Message-ID: <c05b9144-f0df-cfbb-9069-78330bacb590@intel.com>
Date: Tue, 30 Oct 2018 10:18:58 +0000
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101
 Thunderbird/52.9.1
MIME-Version: 1.0
In-Reply-To: <CAD+H990H1WQZiHZYd5jwEWQX+4RFM+_8c0MF2vZKRxb2fsRX8g@mail.gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
Subject: Re: [dpdk-dev] [PATCH v3 0/6] use IOVAs check based on DMA mask
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Tue, 30 Oct 2018 10:19:02 -0000

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,
Anatoly