Reviewed-by: Brian Brooks <brian.bro...@linaro.org>
On 08/20 09:45:50, Christophe Milard wrote: > Since v2: Fixed failure when running as root when no huge page are > available but the hugetlbfs is writable > (Failure as mostly visible on 32 bit systems) (Bill) > > Since v1: Fixed error when compiling with clang (Bill) > > This patch series introduces a new ODP memory allocator and then uses it > on the driver interface: > > The first 3 patches introduces barriers on the driver interface. > This is based on its equivalent from the API side. > > Then comes the definition of the shmen programing functions for the DRV > interface: This should look very familiar, as it is based on its API side as > well, with extension to perform lookup and free directely by name or by > address, as most drivers will probably want that. > In that sence, the well known API shmem interface will look like a subset > of the DRV shmem interface. > > Then comes the file descriptor server: its goal is to enable sharing of > file desriptors between linux processes, regardless of fork time. > This will be needed by the memory allocator (following patches), but will > likely also be needed when file-descriptor based pktios will be written as > "process mode runnable". It is therefore written as a standalone service > where clients can register file descriptors and others clients can query for > those. The servers holds a table {context, key} ->fd. > The ODP memory allocator will register its files descriptors using the > memory block index as key and "ISHM" as context. The context is meant to > enable > the usage of the server from different users, without key clash: if pktio > uses its pktio index as key, it won't clash with ISHM keys as the context > (ISHM vs PKTIO) will be different. > > Then comes the internal memory allocator itself: Though its interface is > a superset of the current shared memory API, its internal differs largely: > The new internal memory allocator (ishm) is not using ANONYMOUS mapping > but file descriptor based mapping instead: this is to enable its usage > from different processes, regardless of fork time. > Also, this memory allocator supports a flag, called SINGLE_VA: when allocated > with this flag, memory is guaranted to be mapped at the same virtual address > in all ODP threads (i.e linux threads or processes, regardless of fork time). > This is done by prealocating plenty of virtual address space (not memory > -just address space) at global init time and mapping the SINGLE_VA'd blocks > there (using MAP_FIXED) on demand. > Ishm maintains the virtual space memory map. > > Blocks allocated without this flag are mapped using the normal linux strategy, > and will likely end-up at different virtual addresses in different linux > processes (when allocated after fork) > > IMPORTANT NOTE: ishm supports huge pages BUT because the mapping is no longer > anonymous, the hugetlbfs mount point must be writable by the ODP process: > Either run as root or fix the permissions! > ishm will fall back to normal pages if it fails allocationg huge pages- as > before. > > Then comes a patch adding a debug funtion to ishm: as it was fully separable > it became its own patch... > > Then commes the linux implementation of the driver shm interface. This, > of course, use ishm. It is just a wrapper around it. > If this ishm way of allocating memory is "approved", such a wrapper should be > written for the API side as well (replacing the current shared_memory.c) > so that the API interface , the driver interface and ODP internals make > use of a unique memory allocator: ishm. > > At least comes the definition a a series of tests to test the driver > interface shared memory. These tests are runnable in thread or process mode > (using the usual --odph_proc flag) > > Thanks for reading so far... and happy review! > > Christophe > > > *** BLURB HERE *** > > Christophe Milard (13): > linux-gen: cosmetic changes on barrier > drv: adding barrier.h > linux-gen: drv: adding barrier > linux-generic: drv: strong typing > drv: adding shared memory > linux-gen: fdserver: new fdserver added > linux-generic: system_info: adding huge page dir > linux-gen: ishm: internal shared memory allocator (ishm) added > linux-gen: ishm: adding debug function > linux-gen: drv: shm > test: validation: drv: shmem: basic tests > test: validation: drv: shmem: testing SINGLE_VA flag > test: validation: drv: shmem: stress tests > > include/odp/api/spec/barrier.h | 2 - > include/odp/drv/spec/barrier.h | 66 + > include/odp/drv/spec/shm.h | 231 ++++ > include/odp_drv.h | 2 + > platform/Makefile.inc | 2 + > platform/linux-generic/Makefile.am | 15 +- > platform/linux-generic/_fdserver.c | 655 +++++++++ > platform/linux-generic/_ishm.c | 1460 > ++++++++++++++++++++ > platform/linux-generic/_ishmphy.c | 185 +++ > platform/linux-generic/arch/arm/odp/api/cpu_arch.h | 25 +- > platform/linux-generic/arch/arm/odp_cpu_arch.c | 49 +- > .../linux-generic/arch/arm/odp_sysinfo_parse.c | 28 +- > platform/linux-generic/arch/powerpc/odp_cpu_arch.c | 49 +- > platform/linux-generic/drv_barrier.c | 50 + > platform/linux-generic/drv_shm.c | 102 ++ > .../linux-generic/include/_fdserver_internal.h | 39 + > platform/linux-generic/include/_ishm_internal.h | 46 + > platform/linux-generic/include/_ishmphy_internal.h | 25 + > platform/linux-generic/include/ishmphy_internal.h | 24 + > .../include/odp/api/plat/barrier_types.h | 1 - > platform/linux-generic/include/odp/drv/barrier.h | 30 + > .../include/odp/drv/plat/barrier_types.h | 38 + > .../linux-generic/include/odp/drv/plat/shm_types.h | 46 + > .../include/odp/drv/plat/strong_types.h | 35 + > platform/linux-generic/include/odp/drv/shm.h | 36 + > .../linux-generic/include/odp_config_internal.h | 16 + > platform/linux-generic/include/odp_internal.h | 17 +- > platform/linux-generic/odp_barrier.c | 2 +- > platform/linux-generic/odp_init.c | 39 + > platform/linux-generic/odp_system_info.c | 181 ++- > test/common_plat/m4/configure.m4 | 3 +- > test/common_plat/validation/drv/Makefile.am | 3 +- > .../common_plat/validation/drv/drvshmem/.gitignore | 1 + > .../validation/drv/drvshmem/Makefile.am | 10 + > .../common_plat/validation/drv/drvshmem/drvshmem.c | 794 +++++++++++ > .../common_plat/validation/drv/drvshmem/drvshmem.h | 27 + > .../validation/drv/drvshmem/drvshmem_main.c | 12 + > test/linux-generic/Makefile.am | 1 + > 38 files changed, 4332 insertions(+), 15 deletions(-) > create mode 100644 include/odp/drv/spec/barrier.h > create mode 100644 include/odp/drv/spec/shm.h > create mode 100644 platform/linux-generic/_fdserver.c > create mode 100644 platform/linux-generic/_ishm.c > create mode 100644 platform/linux-generic/_ishmphy.c > mode change 120000 => 100644 > platform/linux-generic/arch/arm/odp/api/cpu_arch.h > mode change 120000 => 100644 platform/linux-generic/arch/arm/odp_cpu_arch.c > mode change 120000 => 100644 > platform/linux-generic/arch/arm/odp_sysinfo_parse.c > mode change 120000 => 100644 > platform/linux-generic/arch/powerpc/odp_cpu_arch.c > create mode 100644 platform/linux-generic/drv_barrier.c > create mode 100644 platform/linux-generic/drv_shm.c > create mode 100644 platform/linux-generic/include/_fdserver_internal.h > create mode 100644 platform/linux-generic/include/_ishm_internal.h > create mode 100644 platform/linux-generic/include/_ishmphy_internal.h > create mode 100644 platform/linux-generic/include/ishmphy_internal.h > create mode 100644 platform/linux-generic/include/odp/drv/barrier.h > create mode 100644 > platform/linux-generic/include/odp/drv/plat/barrier_types.h > create mode 100644 platform/linux-generic/include/odp/drv/plat/shm_types.h > create mode 100644 platform/linux-generic/include/odp/drv/plat/strong_types.h > create mode 100644 platform/linux-generic/include/odp/drv/shm.h > create mode 100644 test/common_plat/validation/drv/drvshmem/.gitignore > create mode 100644 test/common_plat/validation/drv/drvshmem/Makefile.am > create mode 100644 test/common_plat/validation/drv/drvshmem/drvshmem.c > create mode 100644 test/common_plat/validation/drv/drvshmem/drvshmem.h > create mode 100644 test/common_plat/validation/drv/drvshmem/drvshmem_main.c > > -- > 2.7.4 >