From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 91DD8A0524;
	Fri, 27 Nov 2020 13:54:20 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 12FE8C930;
	Fri, 27 Nov 2020 13:54:18 +0100 (CET)
Received: from mga06.intel.com (mga06.intel.com [134.134.136.31])
 by dpdk.org (Postfix) with ESMTP id A6495C92A;
 Fri, 27 Nov 2020 13:54:15 +0100 (CET)
IronPort-SDR: 13XIuUWZK6PI8JetEEamdrYntNbxBophmv+8qSxQtekHs99aMuDDIEpL1mX4A+qv2MxjFrQysM
 AVJ8IJ5b+NIQ==
X-IronPort-AV: E=McAfee;i="6000,8403,9817"; a="233997084"
X-IronPort-AV: E=Sophos;i="5.78,374,1599548400"; d="scan'208";a="233997084"
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from orsmga005.jf.intel.com ([10.7.209.41])
 by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 27 Nov 2020 04:54:13 -0800
IronPort-SDR: 71kDaV4L/UGZxv4Pwxt1bk+y3wQ79MtD+S8xtq8Bizl0pXxuG+ymgMGp7KOt6Go91iEJ2Sn0/y
 V7M0uSk6H+gQ==
X-IronPort-AV: E=Sophos;i="5.78,374,1599548400"; d="scan'208";a="548041720"
Received: from aburakov-mobl.ger.corp.intel.com (HELO [10.213.211.232])
 ([10.213.211.232])
 by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 27 Nov 2020 04:54:11 -0800
To: Thomas Monjalon <thomas@monjalon.net>,
 Yunjian Wang <wangyunjian@huawei.com>
Cc: dev@dpdk.org, david.marchand@redhat.com, jerry.lilijun@huawei.com,
 xudingke@huawei.com, stable@dpdk.org
References: <1595515713-24640-1-git-send-email-wangyunjian@huawei.com>
 <1602840525-8848-1-git-send-email-wangyunjian@huawei.com>
 <1768774.JEQ3pMzOXi@thomas>
From: "Burakov, Anatoly" <anatoly.burakov@intel.com>
Message-ID: <fe3f3798-6d9d-40bc-8270-656422ac213a@intel.com>
Date: Fri, 27 Nov 2020 12:54:09 +0000
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101
 Thunderbird/68.12.0
MIME-Version: 1.0
In-Reply-To: <1768774.JEQ3pMzOXi@thomas>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
Subject: Re: [dpdk-dev] [PATCH v3] eal: fix create user mem map repeatedly
 when it exists
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>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

On 20-Oct-20 3:09 PM, Thomas Monjalon wrote:
> 16/10/2020 11:28, wangyunjian:
>> From: Yunjian Wang <wangyunjian@huawei.com>
>>
>> Currently, a issue that a container has many devices and the
>> application will map the same memory many times. The kernel
>> driver returns EEXIST as long as there are overlapping memory
>> areas. As a result, we repeatedly create new user mem map entry
>> for the same memory segment and this will lead to no more space
>> for other user mem maps.
>>
>> To resolve the issue, add support to remove the same entry in
>> the function compact_user_maps().
> 
> Sorry I don't understand the explanations above.
> Anatoly, please could you help in rewording?
> 
> 
> 

Apologies for delay, fell through the cracks.

Suggested rewording:

Currently, user mem maps will check if the newly mapped area is adjacent 
to any existing mapping, but will not check if the mapping is identical 
because it assumes that the API will never get called with the same 
mapping twice. This will result in duplicate entries in the user mem 
maps list.

Fix it by also checking for duplicate mappings, and skipping them if 
they are found.

-- 
Thanks,
Anatoly