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 c237528646417ba4056118b9e95ca1f690489274 (commit) via 82fe6add4af42dcbc44ffc14a7b693004791d03f (commit) from 913d9b1a83ddd6a03daa181eeb6f62fd70f506e8 (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 c237528646417ba4056118b9e95ca1f690489274 Author: Christophe Milard christophe.milard@linaro.org Date: Wed Dec 21 12:11:33 2016 +0100
test: shm: checking exported vs imported block length
Checking that the block size returned by odp_shm_info() matches the exported block length.
Signed-off-by: Christophe Milard christophe.milard@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/test/linux-generic/validation/api/shmem/shmem_odp2.c b/test/linux-generic/validation/api/shmem/shmem_odp2.c index e39dc76..7d8c682 100644 --- a/test/linux-generic/validation/api/shmem/shmem_odp2.c +++ b/test/linux-generic/validation/api/shmem/shmem_odp2.c @@ -28,6 +28,7 @@ int main(int argc, char *argv[]) odp_instance_t odp1; odp_instance_t odp2; odp_shm_t shm; + odp_shm_info_t info; test_shared_data_t *test_shared_data;
/* odp init: */ @@ -59,6 +60,13 @@ int main(int argc, char *argv[]) return 1; }
+ /* check that the read size matches the allocated size (in other ODP):*/ + if ((odp_shm_info(shm, &info)) || + (info.size != sizeof(*test_shared_data))) { + fprintf(stderr, "error: odp_shm_info failed.\n"); + return 1; + } + test_shared_data = odp_shm_addr(shm); if (test_shared_data == NULL) { fprintf(stderr, "error: odp_shm_addr failed.\n");
commit 82fe6add4af42dcbc44ffc14a7b693004791d03f Author: Christophe Milard christophe.milard@linaro.org Date: Wed Dec 21 12:11:32 2016 +0100
linux-gen: _ishm: exporting/importing user len and flags
The size of the shared memory and its user flag set, as given at reserve time, are exported and imported so that odp_shm_info() return proper values on imported blocks
Signed-off-by: Christophe Milard christophe.milard@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/platform/linux-generic/_ishm.c b/platform/linux-generic/_ishm.c index efdb7bc..6d5b752 100644 --- a/platform/linux-generic/_ishm.c +++ b/platform/linux-generic/_ishm.c @@ -125,7 +125,9 @@ #define EXPORT_FILE_LINE3_FMT "file: %s" #define EXPORT_FILE_LINE4_FMT "length: %" PRIu64 #define EXPORT_FILE_LINE5_FMT "flags: %" PRIu32 -#define EXPORT_FILE_LINE6_FMT "align: %" PRIu32 +#define EXPORT_FILE_LINE6_FMT "user_length: %" PRIu64 +#define EXPORT_FILE_LINE7_FMT "user_flags: %" PRIu32 +#define EXPORT_FILE_LINE8_FMT "align: %" PRIu32 /* * A fragment describes a piece of the shared virtual address space, * and is allocated only when allocation is done with the _ODP_ISHM_SINGLE_VA @@ -481,7 +483,11 @@ static int create_file(int block_index, huge_flag_t huge, uint64_t len, new_block->filename); fprintf(export_file, EXPORT_FILE_LINE4_FMT "\n", len); fprintf(export_file, EXPORT_FILE_LINE5_FMT "\n", flags); - fprintf(export_file, EXPORT_FILE_LINE6_FMT "\n", align); + fprintf(export_file, EXPORT_FILE_LINE6_FMT "\n", + new_block->user_len); + fprintf(export_file, EXPORT_FILE_LINE7_FMT "\n", + new_block->user_flags); + fprintf(export_file, EXPORT_FILE_LINE8_FMT "\n", align);
fclose(export_file); } @@ -806,6 +812,10 @@ int _odp_ishm_reserve(const char *name, uint64_t size, int fd, else new_block->name[0] = 0;
+ /* save user data: */ + new_block->user_flags = user_flags; + new_block->user_len = size; + /* If a file descriptor is provided, get the real size and map: */ if (fd >= 0) { fstat(fd, &statbuf); @@ -921,9 +931,11 @@ int _odp_ishm_find_exported(const char *remote_name, pid_t external_odp_pid, FILE *export_file; uint64_t len; uint32_t flags; + uint64_t user_len; + uint32_t user_flags; uint32_t align; int fd; - int ret; + int block_index;
/* try to read the block description file: */ snprintf(export_filename, ISHM_FILENAME_MAXLEN, @@ -953,7 +965,13 @@ int _odp_ishm_find_exported(const char *remote_name, pid_t external_odp_pid, if (fscanf(export_file, EXPORT_FILE_LINE5_FMT " ", &flags) != 1) goto error_exp_file;
- if (fscanf(export_file, EXPORT_FILE_LINE6_FMT " ", &align) != 1) + if (fscanf(export_file, EXPORT_FILE_LINE6_FMT " ", &user_len) != 1) + goto error_exp_file; + + if (fscanf(export_file, EXPORT_FILE_LINE7_FMT " ", &user_flags) != 1) + goto error_exp_file; + + if (fscanf(export_file, EXPORT_FILE_LINE8_FMT " ", &align) != 1) goto error_exp_file;
fclose(export_file); @@ -970,13 +988,17 @@ int _odp_ishm_find_exported(const char *remote_name, pid_t external_odp_pid, flags &= ~(uint32_t)_ODP_ISHM_EXPORT;
/* reserve the memory, providing the opened file descriptor: */ - ret = _odp_ishm_reserve(local_name, 0, fd, align, flags, 0); - if (ret < 0) { + block_index = _odp_ishm_reserve(local_name, 0, fd, align, flags, 0); + if (block_index < 0) { close(fd); - return ret; + return block_index; }
- return ret; + /* set inherited info: */ + ishm_tbl->block[block_index].user_flags = user_flags; + ishm_tbl->block[block_index].user_len = user_len; + + return block_index;
error_exp_file: fclose(export_file); diff --git a/test/linux-generic/validation/api/shmem/shmem_linux.c b/test/linux-generic/validation/api/shmem/shmem_linux.c index 39473f3..2f4c762 100644 --- a/test/linux-generic/validation/api/shmem/shmem_linux.c +++ b/test/linux-generic/validation/api/shmem/shmem_linux.c @@ -102,7 +102,8 @@ */ static int read_shmem_attribues(uint64_t ext_odp_pid, const char *blockname, char *filename, uint64_t *len, - uint32_t *flags, uint32_t *align) + uint32_t *flags, uint64_t *user_len, + uint32_t *user_flags, uint32_t *align) { char shm_attr_filename[PATH_MAX]; FILE *export_file; @@ -130,6 +131,12 @@ static int read_shmem_attribues(uint64_t ext_odp_pid, const char *blockname, if (fscanf(export_file, "flags: %" PRIu32 " ", flags) != 1) goto export_file_read_err;
+ if (fscanf(export_file, "user_length: %" PRIu64 " ", user_len) != 1) + goto export_file_read_err; + + if (fscanf(export_file, "user_flags: %" PRIu32 " ", user_flags) != 1) + goto export_file_read_err; + if (fscanf(export_file, "align: %" PRIu32 " ", align) != 1) goto export_file_read_err;
@@ -192,6 +199,8 @@ int main(int argc __attribute__((unused)), char *argv[]) char shm_filename[PATH_MAX];/* shared mem device name, under /dev/shm */ uint64_t len; uint32_t flags; + uint64_t user_len; + uint32_t user_flags; uint32_t align; int shm_fd; test_shared_linux_data_t *addr; @@ -231,7 +240,8 @@ int main(int argc __attribute__((unused)), char *argv[])
/* read the shared memory attributes (includes the shm filename): */ if (read_shmem_attribues(odp_app1, ODP_SHM_NAME, - shm_filename, &len, &flags, &align) != 0) + shm_filename, &len, &flags, + &user_len, &user_flags, &align) != 0) test_failure(fifo_name, fifo_fd, odp_app1);
/* open the shm filename (which is either on /tmp or on hugetlbfs)
-----------------------------------------------------------------------
Summary of changes: platform/linux-generic/_ishm.c | 38 +++++++++++++++++----- .../validation/api/shmem/shmem_linux.c | 14 ++++++-- .../validation/api/shmem/shmem_odp2.c | 8 +++++ 3 files changed, 50 insertions(+), 10 deletions(-)
hooks/post-receive