From a9fb536570e0cb93692606a76328d627fd84fc74 Mon Sep 17 00:00:00 2001 From: Intel Date: Thu, 20 Dec 2012 00:00:00 +0100 Subject: [PATCH] eal: minor changes Signed-off-by: Intel --- lib/librte_eal/common/include/rte_atomic.h | 1 - lib/librte_eal/linuxapp/eal/eal.c | 19 +++++++------- lib/librte_eal/linuxapp/eal/eal_memory.c | 15 ++++++----- .../linuxapp/eal/include/eal_internal_cfg.h | 26 +++++++++---------- 4 files changed, 31 insertions(+), 30 deletions(-) diff --git a/lib/librte_eal/common/include/rte_atomic.h b/lib/librte_eal/common/include/rte_atomic.h index 512241c261..f4e7abdb36 100644 --- a/lib/librte_eal/common/include/rte_atomic.h +++ b/lib/librte_eal/common/include/rte_atomic.h @@ -51,7 +51,6 @@ extern "C" { #endif #include - #include "arch/rte_atomic.h" diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c index 22db385bf4..9096a5d6ca 100644 --- a/lib/librte_eal/linuxapp/eal/eal.c +++ b/lib/librte_eal/linuxapp/eal/eal.c @@ -285,15 +285,16 @@ eal_usage(const char *prgname) printf("\nUsage: %s -c COREMASK -n NUM [-m NB] [-r NUM] [-b ]" "[--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 : 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 : 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" diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c index d76ebd90b4..511c0a7258 100644 --- a/lib/librte_eal/linuxapp/eal/eal_memory.c +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c @@ -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) diff --git a/lib/librte_eal/linuxapp/eal/include/eal_internal_cfg.h b/lib/librte_eal/linuxapp/eal/include/eal_internal_cfg.h index 4d143c8ade..fc7da3edb5 100644 --- a/lib/librte_eal/linuxapp/eal/include/eal_internal_cfg.h +++ b/lib/librte_eal/linuxapp/eal/include/eal_internal_cfg.h @@ -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. */