From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <olivier.matz@6wind.com>
Received: from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com
 [62.23.145.76]) by dpdk.org (Postfix) with ESMTP id D0DF15584
 for <dev@dpdk.org>; Mon, 27 Jun 2016 17:58:57 +0200 (CEST)
Received: from glumotte.dev.6wind.com (unknown [10.16.0.195])
 by proxy.6wind.com (Postfix) with ESMTP id A826E26371;
 Mon, 27 Jun 2016 17:58:57 +0200 (CEST)
From: Olivier Matz <olivier.matz@6wind.com>
To: dev@dpdk.org, sergio.gonzalez.monroy@intel.com, david.marchand@6wind.com,
 pmatilai@redhat.com, thomas.monjalon@6wind.com
Date: Mon, 27 Jun 2016 17:58:51 +0200
Message-Id: <1467043131-24658-1-git-send-email-olivier.matz@6wind.com>
X-Mailer: git-send-email 2.8.1
In-Reply-To: <1465813577-13780-1-git-send-email-olivier.matz@6wind.com>
References: <1465813577-13780-1-git-send-email-olivier.matz@6wind.com>
Subject: [dpdk-dev] [PATCH v2] mem: revert page locking when not using
	hugepages
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Mon, 27 Jun 2016 15:58:57 -0000

This reverts commit 593a084afc2b441895aeca78a2c4465e450d0ef5.

Since recently [1], it is not possible to run the dpdk with
non-root privileges and the --no-huge option. This is because the eal
layer tries to lock the memory. Using locked memory is mandatory for
physical devices because they reference physical addresses.

But a user may want to start the dpdk without locked memory, because he
does not have the permission to do so, and/or does not have this need,
for instance because he uses virtual drivers.

So this commit reverts the use of MAP_LOCKED in mmap() flags.

[1] http://www.dpdk.org/ml/archives/dev/2016-May/039404.html

Fixes: 593a084afc2b ("mem: lock pages when not using hugepages")
Reported-by: Panu Matilainen <pmatilai@redhat.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
 lib/librte_eal/linuxapp/eal/eal_memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c
index 9251a5b..1fc7545 100644
--- a/lib/librte_eal/linuxapp/eal/eal_memory.c
+++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
@@ -1074,7 +1074,7 @@ rte_eal_hugepage_init(void)
 	/* hugetlbfs can be disabled */
 	if (internal_config.no_hugetlbfs) {
 		addr = mmap(NULL, internal_config.memory, PROT_READ | PROT_WRITE,
-			MAP_LOCKED | MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
+				MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
 		if (addr == MAP_FAILED) {
 			RTE_LOG(ERR, EAL, "%s: mmap() failed: %s\n", __func__,
 					strerror(errno));
-- 
2.8.1