This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "".
The branch, api-next has been updated via b668182d6ea0cb942c2cf43771c618c9457bf146 (commit) via eb564bfb6f813ec3f2fe8a8d4ce0da25220b4215 (commit) via 8fea9ff7d8fde984981e681f49133dbda8429b7f (commit) from 15c97427d01c81dc9f4d0aafe9b0a99cdb2d1fc6 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- commit b668182d6ea0cb942c2cf43771c618c9457bf146 Author: Matias Elo matias.elo@nokia.com Date: Wed Jul 5 17:23:19 2017 +0300
validation: system_info: add test for odp_sys_huge_page_size_all()
Signed-off-by: Matias Elo matias.elo@nokia.com Reviewed-and-tested-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/test/common_plat/validation/api/system/system.c b/test/common_plat/validation/api/system/system.c index 5b7ca01a..4dfac550 100644 --- a/test/common_plat/validation/api/system/system.c +++ b/test/common_plat/validation/api/system/system.c @@ -13,6 +13,7 @@
#define DIFF_TRY_NUM 160 #define RES_TRY_NUM 10 +#define PAGESZ_NUM 10
void system_test_odp_version_numbers(void) { @@ -214,6 +215,25 @@ void system_test_odp_sys_huge_page_size(void) CU_ASSERT(0 < page); }
+void system_test_odp_sys_huge_page_size_all(void) +{ + uint64_t pagesz_tbs[PAGESZ_NUM]; + uint64_t prev_pagesz = 0; + int num; + int i; + + num = odp_sys_huge_page_size_all(NULL, 0); + CU_ASSERT(num >= 0); + + num = odp_sys_huge_page_size_all(pagesz_tbs, PAGESZ_NUM); + CU_ASSERT(num >= 0); + for (i = 0; i < num && i < PAGESZ_NUM; i++) { + CU_ASSERT(pagesz_tbs[i] > 0); + CU_ASSERT(pagesz_tbs[i] > prev_pagesz); + prev_pagesz = pagesz_tbs[i]; + } +} + int system_check_odp_cpu_hz(void) { if (odp_cpu_hz() == 0) { @@ -316,6 +336,7 @@ odp_testinfo_t system_suite[] = { ODP_TEST_INFO(system_test_odp_cpu_model_str_id), ODP_TEST_INFO(system_test_odp_sys_page_size), ODP_TEST_INFO(system_test_odp_sys_huge_page_size), + ODP_TEST_INFO(system_test_odp_sys_huge_page_size_all), ODP_TEST_INFO_CONDITIONAL(system_test_odp_cpu_hz, system_check_odp_cpu_hz), ODP_TEST_INFO_CONDITIONAL(system_test_odp_cpu_hz_id, diff --git a/test/common_plat/validation/api/system/system.h b/test/common_plat/validation/api/system/system.h index c33729b9..0ea72dcd 100644 --- a/test/common_plat/validation/api/system/system.h +++ b/test/common_plat/validation/api/system/system.h @@ -20,6 +20,7 @@ void system_test_odp_cpu_model_str(void); void system_test_odp_cpu_model_str_id(void); void system_test_odp_sys_page_size(void); void system_test_odp_sys_huge_page_size(void); +void system_test_odp_sys_huge_page_size_all(void); int system_check_odp_cpu_hz(void); void system_test_odp_cpu_hz(void); int system_check_odp_cpu_hz_id(void);
commit eb564bfb6f813ec3f2fe8a8d4ce0da25220b4215 Author: Matias Elo matias.elo@nokia.com Date: Wed Jul 5 17:23:18 2017 +0300
linux-gen: system_info: implement odp_sys_huge_page_size_all()
Directory /sys/kernel/mm/hugepages contains subdirectories for all huge page sizes supported by the running kernel. Loop through the contents of this directory to find the supported huge page sizes.
Signed-off-by: Matias Elo matias.elo@nokia.com Reviewed-and-tested-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/platform/linux-generic/odp_system_info.c b/platform/linux-generic/odp_system_info.c index 40ffca07..0495fb06 100644 --- a/platform/linux-generic/odp_system_info.c +++ b/platform/linux-generic/odp_system_info.c @@ -379,6 +379,42 @@ uint64_t odp_sys_huge_page_size(void) return odp_global_data.hugepage_info.default_huge_page_size; }
+static int pagesz_compare(const void *pagesz1, const void *pagesz2) +{ + return (*(const uint64_t *)pagesz1 - *(const uint64_t *)pagesz2); +} + +int odp_sys_huge_page_size_all(uint64_t size[], int num) +{ + DIR *dir; + struct dirent *entry; + int pagesz_num = 0; + int saved = 0; + + /* See: kernel.org: hugetlbpage.txt */ + dir = opendir("/sys/kernel/mm/hugepages"); + if (!dir) { + ODP_ERR("Failed to open huge page directory\n"); + return -1; + } + + while ((entry = readdir(dir)) != NULL) { + unsigned long sz; + + if (sscanf(entry->d_name, "hugepages-%8lukB", &sz) == 1) { + if (size != NULL && saved < num) + size[saved++] = sz * 1024; + pagesz_num++; + } + } + closedir(dir); + + if (size != NULL && saved > 1) + qsort(size, saved, sizeof(uint64_t), pagesz_compare); + + return pagesz_num; +} + uint64_t odp_sys_page_size(void) { return odp_global_data.system_info.page_size;
commit 8fea9ff7d8fde984981e681f49133dbda8429b7f Author: Matias Elo matias.elo@nokia.com Date: Wed Jul 5 17:23:17 2017 +0300
api: system_info: add function for fetching all supported huge page sizes
A system may simultaneously support multiple huge page sizes. Add a new API function odp_sys_huge_page_size_all() which returns all supported page sizes. odp_sys_huge_page_size() stays unmodified to maintain backward compatibility.
Signed-off-by: Matias Elo matias.elo@nokia.com Reviewed-and-tested-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/include/odp/api/spec/system_info.h b/include/odp/api/spec/system_info.h index ca4dcdc7..140db7b4 100644 --- a/include/odp/api/spec/system_info.h +++ b/include/odp/api/spec/system_info.h @@ -27,10 +27,29 @@ extern "C" { * Default system huge page size in bytes * * @return Default huge page size in bytes + * @retval 0 on no huge pages */ uint64_t odp_sys_huge_page_size(void);
/** + * System huge page sizes in bytes + * + * Returns the number of huge page sizes supported by the system. Outputs up to + * 'num' sizes when the 'size' array pointer is not NULL. If return value is + * larger than 'num', there are more supported sizes than the function was + * allowed to output. If return value (N) is less than 'num', only sizes + * [0 ... N-1] have been written. Returned values are ordered from smallest to + * largest. + * + * @param[out] size Points to an array of huge page sizes for output + * @param num Maximum number of huge page sizes to output + * + * @return Number of supported huge page sizes + * @retval <0 on failure + */ +int odp_sys_huge_page_size_all(uint64_t size[], int num); + +/** * Page size in bytes * * @return Page size in bytes
-----------------------------------------------------------------------
Summary of changes: include/odp/api/spec/system_info.h | 19 +++++++++++++ platform/linux-generic/odp_system_info.c | 36 +++++++++++++++++++++++++ test/common_plat/validation/api/system/system.c | 21 +++++++++++++++ test/common_plat/validation/api/system/system.h | 1 + 4 files changed, 77 insertions(+)
hooks/post-receive