> *Buffer management*
> It looks that temporary buffers are now managed in the client API, not in
> the driver anymore. The positive point is that it makes the driver
> lighter. But the drawbacks is the number of extra ioctl used when using a
> temporary buffer: 1 to allocate, 1 to map, and 1 to unmap. So a
> TEEC_InvokeCommand could lead to 13 ioctls.
> What about the performances? Could not it be optimized in some way? Could
> we manage temporary buffers, dma buffers and "other" buffers in different
> ways?
Temporary buffers should be avoided completely if the client is
concerned about performance. Allocated shared memory is the most
efficient way of shared memory. DMA buffers should be treated in the
same way as allocated shared memory.
Well, I agree that temporary buffers should be avoided when performances
is required. However, they are widely used when the user is using small
buffers, used to pass a struct for example. In such a case, the struct may
be on the stack, and you pass it in a temporary buffer. The extra copy does
not really affect performances in our current optee_linuxdriver. But performances
may be more affected with the Generic Driver.
The kernel API isn't there right now because it's not used by anything.
This patch-set is kept as small as possible while still being useful, to
avoid making it harder than necessary to upstream. Once this patch-set
is upstream we can start to add different features, for instance a
kernel API.
All right.
We should just not forget that this is something quite important for us.
Would this be OK?
struct tee_shm_pool_res_mem_info {
unsigned long priv_vaddr;
unsigned long priv_paddr;
size_t priv_size;
unsigned long dma_buf_vaddr;
unsigned long dma_buf_paddr;
size_t dma_buf_size;
};
struct tee_shm_pool *tee_shm_pool_alloc_res_mem(struct device *dev,
struct tee_shm_pool_res_mem_info *info);
Yes.
+1 on b)
- it would also add more generic arguments
- I wonder if it could not be used to solve the temporary buffers perf issues.
For use cases where a client gets hold of a dma_buf without AllocateSharedMemory,
we could implement it using implement-specific TEEC_MEM_DMABUF flag, as
currently performed in optee_client.
We also have an extra review comment, on optee_client. In the supplicant (optee_client),
Pascal.