From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 206CF595A for ; Mon, 2 Mar 2015 17:34:23 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 02 Mar 2015 08:34:23 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,676,1418112000"; d="scan'208";a="685630448" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga002.fm.intel.com with ESMTP; 02 Mar 2015 08:34:21 -0800 Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id t22GYK8f024031; Mon, 2 Mar 2015 16:34:20 GMT Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id t22GYKtG002110; Mon, 2 Mar 2015 16:34:20 GMT Received: (from bricha3@localhost) by sivswdev01.ir.intel.com with id t22GYKOI002106; Mon, 2 Mar 2015 16:34:20 GMT From: Bruce Richardson To: dev@dpdk.org Date: Mon, 2 Mar 2015 16:34:20 +0000 Message-Id: <1425314060-2072-1-git-send-email-bruce.richardson@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dpdk-dev] [PATCH] eal/bsd: enable contigmem blocks >1GB in size X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Mar 2015 16:34:24 -0000 The contigmem module was using an "int" type for specifying the size of blocks of memory to be reserved. A 2GB block was therefore overflowing the signed 32-bit value, making 1GB the largest block size that could be reserved as a single unit. The fix is to change the type used for the buffer/block size to an "int64_t" value. Signed-off-by: Bruce Richardson --- lib/librte_eal/bsdapp/contigmem/contigmem.c | 8 ++++---- lib/librte_eal/bsdapp/eal/eal_hugepage_info.c | 9 +++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/librte_eal/bsdapp/contigmem/contigmem.c b/lib/librte_eal/bsdapp/contigmem/contigmem.c index b1a23fa..6634daa 100644 --- a/lib/librte_eal/bsdapp/contigmem/contigmem.c +++ b/lib/librte_eal/bsdapp/contigmem/contigmem.c @@ -63,20 +63,20 @@ static d_mmap_single_t contigmem_mmap_single; static d_open_t contigmem_open; static int contigmem_num_buffers = RTE_CONTIGMEM_DEFAULT_NUM_BUFS; -static int contigmem_buffer_size = RTE_CONTIGMEM_DEFAULT_BUF_SIZE; +static int64_t contigmem_buffer_size = RTE_CONTIGMEM_DEFAULT_BUF_SIZE; static eventhandler_tag contigmem_eh_tag; static void *contigmem_buffers[RTE_CONTIGMEM_MAX_NUM_BUFS]; static struct cdev *contigmem_cdev = NULL; TUNABLE_INT("hw.contigmem.num_buffers", &contigmem_num_buffers); -TUNABLE_INT("hw.contigmem.buffer_size", &contigmem_buffer_size); +TUNABLE_QUAD("hw.contigmem.buffer_size", &contigmem_buffer_size); static SYSCTL_NODE(_hw, OID_AUTO, contigmem, CTLFLAG_RD, 0, "contigmem"); SYSCTL_INT(_hw_contigmem, OID_AUTO, num_buffers, CTLFLAG_RD, &contigmem_num_buffers, 0, "Number of contigmem buffers allocated"); -SYSCTL_INT(_hw_contigmem, OID_AUTO, buffer_size, CTLFLAG_RD, +SYSCTL_QUAD(_hw_contigmem, OID_AUTO, buffer_size, CTLFLAG_RD, &contigmem_buffer_size, 0, "Size of each contiguous buffer"); static SYSCTL_NODE(_hw_contigmem, OID_AUTO, physaddr, CTLFLAG_RD, 0, @@ -133,7 +133,7 @@ contigmem_load() if (contigmem_buffer_size < PAGE_SIZE || (contigmem_buffer_size & (contigmem_buffer_size - 1)) != 0) { - printf("buffer size 0x%x is not greater than PAGE_SIZE and " + printf("buffer size 0x%lx is not greater than PAGE_SIZE and " "power of two\n", contigmem_buffer_size); return (EINVAL); } diff --git a/lib/librte_eal/bsdapp/eal/eal_hugepage_info.c b/lib/librte_eal/bsdapp/eal/eal_hugepage_info.c index 24248fb..8a33c30 100644 --- a/lib/librte_eal/bsdapp/eal/eal_hugepage_info.c +++ b/lib/librte_eal/bsdapp/eal/eal_hugepage_info.c @@ -70,7 +70,8 @@ int eal_hugepage_info_init(void) { size_t sysctl_size; - int buffer_size, num_buffers, fd, error; + int num_buffers, fd, error; + int64_t buffer_size; /* re-use the linux "internal config" structure for our memory data */ struct hugepage_info *hpi = &internal_config.hugepage_info[0]; struct hugepage_info *tmp_hpi; @@ -101,13 +102,13 @@ eal_hugepage_info_init(void) if (buffer_size >= 1<<30) RTE_LOG(INFO, EAL, "Contigmem driver has %d buffers, each of size %dGB\n", - num_buffers, buffer_size>>30); + num_buffers, (int)(buffer_size>>30)); else if (buffer_size >= 1<<20) RTE_LOG(INFO, EAL, "Contigmem driver has %d buffers, each of size %dMB\n", - num_buffers, buffer_size>>20); + num_buffers, (int)(buffer_size>>20)); else RTE_LOG(INFO, EAL, "Contigmem driver has %d buffers, each of size %dKB\n", - num_buffers, buffer_size>>10); + num_buffers, (int)(buffer_size>>10)); internal_config.num_hugepage_sizes = 1; hpi->hugedir = CONTIGMEM_DEV; -- 2.1.0