eal: minor changes
Signed-off-by: Intel
This commit is contained in:
parent
277ff5bb75
commit
a9fb536570
@ -51,7 +51,6 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "arch/rte_atomic.h"
|
||||
|
||||
|
||||
|
@ -285,15 +285,16 @@ eal_usage(const char *prgname)
|
||||
printf("\nUsage: %s -c COREMASK -n NUM [-m NB] [-r NUM] [-b <domain:bus:devid.func>]"
|
||||
"[--proc-type primary|secondary|auto] \n\n"
|
||||
"EAL options:\n"
|
||||
" -c COREMASK: A hexadecimal bitmask of cores to run on\n"
|
||||
" -n NUM : Number of memory channels\n"
|
||||
" -v : Display version information on startup\n"
|
||||
" -b <domain:bus:devid.func>: to prevent EAL from using specified PCI device\n"
|
||||
" (multiple -b options are alowed)\n"
|
||||
" -m MB : memory to allocate (default = size of hugemem)\n"
|
||||
" -r NUM : force number of memory ranks (don't detect)\n"
|
||||
" --"OPT_HUGE_DIR" : directory where hugetlbfs is mounted\n"
|
||||
" --"OPT_PROC_TYPE": type of this process\n"
|
||||
" -c COREMASK : A hexadecimal bitmask of cores to run on\n"
|
||||
" -n NUM : Number of memory channels\n"
|
||||
" -v : Display version information on startup\n"
|
||||
" -b <domain:bus:devid.func>: to prevent EAL from using specified "
|
||||
"PCI device\n"
|
||||
" (multiple -b options are allowed)\n"
|
||||
" -m MB : memory to allocate (see also --"OPT_SOCKET_MEM")\n"
|
||||
" -r NUM : force number of memory ranks (don't detect)\n"
|
||||
" --"OPT_HUGE_DIR" : directory where hugetlbfs is mounted\n"
|
||||
" --"OPT_PROC_TYPE" : type of this process\n"
|
||||
" --"OPT_FILE_PREFIX": prefix for hugepage filenames\n"
|
||||
"\nEAL options for DEBUG use only:\n"
|
||||
" --"OPT_NO_HUGE" : use malloc instead of hugetlbfs\n"
|
||||
|
@ -221,7 +221,7 @@ map_all_hugepages(struct hugepage *hugepg_tbl,
|
||||
|
||||
fd = open(hugepg_tbl[i].filepath, O_CREAT | O_RDWR, 0755);
|
||||
if (fd < 0) {
|
||||
RTE_LOG(ERR, EAL, "%s(): open failed: %s", __func__,
|
||||
RTE_LOG(ERR, EAL, "%s(): open failed: %s\n", __func__,
|
||||
strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
@ -229,11 +229,12 @@ map_all_hugepages(struct hugepage *hugepg_tbl,
|
||||
virtaddr = mmap(vma_addr, hugepage_sz, PROT_READ | PROT_WRITE,
|
||||
MAP_SHARED, fd, 0);
|
||||
if (virtaddr == MAP_FAILED) {
|
||||
RTE_LOG(ERR, EAL, "%s(): mmap failed: %s", __func__,
|
||||
RTE_LOG(ERR, EAL, "%s(): mmap failed: %s\n", __func__,
|
||||
strerror(errno));
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (orig) {
|
||||
hugepg_tbl[i].orig_va = virtaddr;
|
||||
memset(virtaddr, 0, hugepage_sz);
|
||||
@ -281,7 +282,7 @@ find_physaddr(struct hugepage *hugepg_tbl, struct hugepage_info *hpi)
|
||||
|
||||
fd = open("/proc/self/pagemap", O_RDONLY);
|
||||
if (fd < 0) {
|
||||
RTE_LOG(ERR, EAL, "%s(): cannot open /proc/self/pagemap: %s",
|
||||
RTE_LOG(ERR, EAL, "%s(): cannot open /proc/self/pagemap: %s\n",
|
||||
__func__, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
@ -292,13 +293,13 @@ find_physaddr(struct hugepage *hugepg_tbl, struct hugepage_info *hpi)
|
||||
page_size;
|
||||
offset = sizeof(uint64_t) * virt_pfn;
|
||||
if (lseek(fd, offset, SEEK_SET) != offset){
|
||||
RTE_LOG(ERR, EAL, "%s(): seek error in /proc/self/pagemap: %s",
|
||||
RTE_LOG(ERR, EAL, "%s(): seek error in /proc/self/pagemap: %s\n",
|
||||
__func__, strerror(errno));
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
if (read(fd, &page, sizeof(uint64_t)) < 0) {
|
||||
RTE_LOG(ERR, EAL, "%s(): cannot read /proc/self/pagemap: %s",
|
||||
RTE_LOG(ERR, EAL, "%s(): cannot read /proc/self/pagemap: %s\n",
|
||||
__func__, strerror(errno));
|
||||
close(fd);
|
||||
return -1;
|
||||
@ -332,7 +333,7 @@ find_numasocket(struct hugepage *hugepg_tbl, struct hugepage_info *hpi)
|
||||
f = fopen("/proc/self/numa_maps", "r");
|
||||
if (f == NULL) {
|
||||
RTE_LOG(INFO, EAL, "cannot open /proc/self/numa_maps,"
|
||||
"consider that all memory is in socket_id 0");
|
||||
" consider that all memory is in socket_id 0\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -441,7 +442,7 @@ sort_by_physaddr(struct hugepage *hugepg_tbl, struct hugepage_info *hpi)
|
||||
|
||||
/*
|
||||
* Uses mmap to create a shared memory area for storage of data
|
||||
*Used in this file to store the hugepage file map on disk
|
||||
* Used in this file to store the hugepage file map on disk
|
||||
*/
|
||||
static void *
|
||||
create_shared_memory(const char *filename, const size_t mem_size)
|
||||
|
@ -47,27 +47,27 @@
|
||||
* mount points of hugepages
|
||||
*/
|
||||
struct hugepage_info {
|
||||
uint64_t hugepage_sz; /**< size of a huge page */
|
||||
const char *hugedir; /**< dir where hugetlbfs is mounted */
|
||||
uint32_t num_pages; /**< number of hugepages of that size */
|
||||
uint64_t hugepage_sz; /**< size of a huge page */
|
||||
const char *hugedir; /**< dir where hugetlbfs is mounted */
|
||||
uint32_t num_pages; /**< number of hugepages of that size */
|
||||
};
|
||||
|
||||
/**
|
||||
* internal configuration
|
||||
*/
|
||||
struct internal_config {
|
||||
volatile uint64_t memory; /* amount of asked memory */
|
||||
volatile unsigned force_nchannel; /* force number of channels */
|
||||
volatile unsigned force_nrank; /* force number of ranks */
|
||||
volatile unsigned no_hugetlbfs; /* true to disable hugetlbfs */
|
||||
volatile unsigned no_pci; /* true to disable PCI */
|
||||
volatile unsigned no_hpet; /* true to disable HPET */
|
||||
volatile unsigned no_shconf; /* true if there is no shared config */
|
||||
volatile uint64_t memory; /**< amount of asked memory */
|
||||
volatile unsigned force_nchannel; /**< force number of channels */
|
||||
volatile unsigned force_nrank; /**< force number of ranks */
|
||||
volatile unsigned no_hugetlbfs; /**< true to disable hugetlbfs */
|
||||
volatile unsigned no_pci; /**< true to disable PCI */
|
||||
volatile unsigned no_hpet; /**< true to disable HPET */
|
||||
volatile unsigned no_shconf; /**< true if there is no shared config */
|
||||
volatile enum rte_proc_type_t process_type; /* multi-process proc type */
|
||||
const char *hugefile_prefix; /* the base filename of hugetlbfs files */
|
||||
const char *hugepage_dir; /* specific hugetlbfs directory to use */
|
||||
const char *hugefile_prefix; /**< the base filename of hugetlbfs files */
|
||||
const char *hugepage_dir; /**< specific hugetlbfs directory to use */
|
||||
|
||||
unsigned num_hugepage_sizes; /* how many sizes on this system */
|
||||
unsigned num_hugepage_sizes; /**< how many sizes on this system */
|
||||
struct hugepage_info hugepage_info[MAX_HUGEPAGE_SIZES];
|
||||
};
|
||||
extern struct internal_config internal_config; /**< Global EAL configuration. */
|
||||
|
Loading…
Reference in New Issue
Block a user