2017-12-19 15:49:03 +00:00
|
|
|
/* SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
* Copyright(c) 2010-2014 Intel Corporation
|
2012-09-04 13:54:00 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* Holds the structures for the eal internal configuration
|
|
|
|
*/
|
|
|
|
|
2014-11-21 15:26:17 +01:00
|
|
|
#ifndef EAL_INTERNAL_CFG_H
|
|
|
|
#define EAL_INTERNAL_CFG_H
|
2012-09-04 13:54:00 +01:00
|
|
|
|
2012-12-20 00:00:00 +01:00
|
|
|
#include <rte_eal.h>
|
2014-06-13 15:52:46 +01:00
|
|
|
#include <rte_pci_dev_feature_defs.h>
|
2012-12-20 00:00:00 +01:00
|
|
|
|
2012-09-04 13:54:00 +01:00
|
|
|
#define MAX_HUGEPAGE_SIZES 3 /**< support up to 3 page sizes */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* internal configuration structure for the number, size and
|
|
|
|
* mount points of hugepages
|
|
|
|
*/
|
|
|
|
struct hugepage_info {
|
2014-12-10 18:46:41 +08:00
|
|
|
uint64_t hugepage_sz; /**< size of a huge page */
|
2018-04-11 13:30:33 +01:00
|
|
|
char hugedir[PATH_MAX]; /**< dir where hugetlbfs is mounted */
|
2012-12-20 00:00:00 +01:00
|
|
|
uint32_t num_pages[RTE_MAX_NUMA_NODES];
|
mem: replace memseg with memseg lists
Before, we were aggregating multiple pages into one memseg, so the
number of memsegs was small. Now, each page gets its own memseg,
so the list of memsegs is huge. To accommodate the new memseg list
size and to keep the under-the-hood workings sane, the memseg list
is now not just a single list, but multiple lists. To be precise,
each hugepage size available on the system gets one or more memseg
lists, per socket.
In order to support dynamic memory allocation, we reserve all
memory in advance (unless we're in 32-bit legacy mode, in which
case we do not preallocate memory). As in, we do an anonymous
mmap() of the entire maximum size of memory per hugepage size, per
socket (which is limited to either RTE_MAX_MEMSEG_PER_TYPE pages or
RTE_MAX_MEM_MB_PER_TYPE megabytes worth of memory, whichever is the
smaller one), split over multiple lists (which are limited to
either RTE_MAX_MEMSEG_PER_LIST memsegs or RTE_MAX_MEM_MB_PER_LIST
megabytes per list, whichever is the smaller one). There is also
a global limit of CONFIG_RTE_MAX_MEM_MB megabytes, which is mainly
used for 32-bit targets to limit amounts of preallocated memory,
but can be used to place an upper limit on total amount of VA
memory that can be allocated by DPDK application.
So, for each hugepage size, we get (by default) up to 128G worth
of memory, per socket, split into chunks of up to 32G in size.
The address space is claimed at the start, in eal_common_memory.c.
The actual page allocation code is in eal_memalloc.c (Linux-only),
and largely consists of copied EAL memory init code.
Pages in the list are also indexed by address. That is, in order
to figure out where the page belongs, one can simply look at base
address for a memseg list. Similarly, figuring out IOVA address
of a memzone is a matter of finding the right memseg list, getting
offset and dividing by page size to get the appropriate memseg.
This commit also removes rte_eal_dump_physmem_layout() call,
according to deprecation notice [1], and removes that deprecation
notice as well.
On 32-bit targets due to limited VA space, DPDK will no longer
spread memory to different sockets like before. Instead, it will
(by default) allocate all of the memory on socket where master
lcore is. To override this behavior, --socket-mem must be used.
The rest of the changes are really ripple effects from the memseg
change - heap changes, compile fixes, and rewrites to support
fbarray-backed memseg lists. Due to earlier switch to _walk()
functions, most of the changes are simple fixes, however some
of the _walk() calls were switched to memseg list walk, where
it made sense to do so.
Additionally, we are also switching locks from flock() to fcntl().
Down the line, we will be introducing single-file segments option,
and we cannot use flock() locks to lock parts of the file. Therefore,
we will use fcntl() locks for legacy mem as well, in case someone is
unfortunate enough to accidentally start legacy mem primary process
alongside an already working non-legacy mem-based primary process.
[1] http://dpdk.org/dev/patchwork/patch/34002/
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Tested-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Tested-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Tested-by: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
2018-04-11 13:30:24 +01:00
|
|
|
/**< number of hugepages of that size on each socket */
|
2012-12-20 00:00:00 +01:00
|
|
|
int lock_descriptor; /**< file descriptor for hugepage dir */
|
2012-09-04 13:54:00 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* internal configuration
|
|
|
|
*/
|
|
|
|
struct internal_config {
|
2013-06-03 00:00:00 +00:00
|
|
|
volatile size_t memory; /**< amount of asked memory */
|
2012-12-20 00:00:00 +01:00
|
|
|
volatile unsigned force_nchannel; /**< force number of channels */
|
|
|
|
volatile unsigned force_nrank; /**< force number of ranks */
|
|
|
|
volatile unsigned no_hugetlbfs; /**< true to disable hugetlbfs */
|
2015-11-04 11:50:36 +01:00
|
|
|
unsigned hugepage_unlink; /**< true to unlink backing files */
|
2012-12-20 00:00:00 +01:00
|
|
|
volatile unsigned no_pci; /**< true to disable PCI */
|
|
|
|
volatile unsigned no_hpet; /**< true to disable HPET */
|
2012-09-21 11:36:40 +00:00
|
|
|
volatile unsigned vmware_tsc_map; /**< true to use VMware TSC mapping
|
|
|
|
* instead of native TSC */
|
2012-12-20 00:00:00 +01:00
|
|
|
volatile unsigned no_shconf; /**< true if there is no shared config */
|
2018-07-13 13:48:03 +01:00
|
|
|
volatile unsigned in_memory;
|
|
|
|
/**< true if DPDK should operate entirely in-memory and not create any
|
|
|
|
* shared files or runtime data.
|
|
|
|
*/
|
2014-01-28 15:26:00 +01:00
|
|
|
volatile unsigned create_uio_dev; /**< true to create /dev/uioX devices */
|
2013-03-22 16:34:54 +01:00
|
|
|
volatile enum rte_proc_type_t process_type; /**< multi-process proc type */
|
|
|
|
/** true to try allocating memory on specific sockets */
|
2012-12-20 00:00:00 +01:00
|
|
|
volatile unsigned force_sockets;
|
2014-02-12 13:38:45 +00:00
|
|
|
volatile uint64_t socket_mem[RTE_MAX_NUMA_NODES]; /**< amount of memory per socket */
|
2018-05-31 18:35:33 +01:00
|
|
|
volatile unsigned force_socket_limits;
|
|
|
|
volatile uint64_t socket_limit[RTE_MAX_NUMA_NODES]; /**< limit amount of memory per socket */
|
2014-02-12 13:38:45 +00:00
|
|
|
uintptr_t base_virtaddr; /**< base address to try and reserve memory from */
|
2018-04-11 13:30:22 +01:00
|
|
|
volatile unsigned legacy_mem;
|
|
|
|
/**< true to enable legacy memory behavior (no dynamic allocation,
|
|
|
|
* IOVA-contiguous segments).
|
|
|
|
*/
|
2018-04-11 13:30:28 +01:00
|
|
|
volatile unsigned single_file_segments;
|
|
|
|
/**< true if storing all pages within single files (per-page-size,
|
|
|
|
* per-node) non-legacy mode only.
|
|
|
|
*/
|
2013-05-30 10:12:41 -07:00
|
|
|
volatile int syslog_facility; /**< facility passed to openlog() */
|
2014-06-13 15:52:46 +01:00
|
|
|
/** default interrupt mode for VFIO */
|
|
|
|
volatile enum rte_intr_mode vfio_intr_mode;
|
2012-12-20 00:00:00 +01:00
|
|
|
const char *hugefile_prefix; /**< the base filename of hugetlbfs files */
|
|
|
|
const char *hugepage_dir; /**< specific hugetlbfs directory to use */
|
2018-01-29 13:40:43 +05:30
|
|
|
const char *user_mbuf_pool_ops_name;
|
|
|
|
/**< user defined mbuf pool ops name */
|
2012-12-20 00:00:00 +01:00
|
|
|
unsigned num_hugepage_sizes; /**< how many sizes on this system */
|
2012-09-04 13:54:00 +01:00
|
|
|
struct hugepage_info hugepage_info[MAX_HUGEPAGE_SIZES];
|
2018-03-13 17:42:35 +00:00
|
|
|
volatile unsigned int init_complete;
|
|
|
|
/**< indicates whether EAL has completed initialization */
|
2012-09-04 13:54:00 +01:00
|
|
|
};
|
|
|
|
extern struct internal_config internal_config; /**< Global EAL configuration. */
|
|
|
|
|
2014-11-17 10:08:39 +01:00
|
|
|
void eal_reset_internal_config(struct internal_config *internal_cfg);
|
|
|
|
|
2014-11-21 15:26:17 +01:00
|
|
|
#endif /* EAL_INTERNAL_CFG_H */
|