Skip to content

Benchmark: can't create mobj for timestamp buffer #16

@Arslan8

Description

@Arslan8

Hi,

I am trying to benchmark op-tee on hikey 620. Firstly, I faced some build issues. Just using the command-line option CFG_TEE_BENCHMARK=y results in buildroot not being able to find the optee-benchmark folder. Upon further investigation, it looks like the source site (BR2_PACKAGE_OPTEE_BENCHMARK_EXT_SITE) is not defined properly in the makefile. Setting the source site on the command line resolves the build issue, however the benchmarking app results in a missing TA error. To overcome this I updated the makefile instead.

After fixing the missing ta and build issue. I see the following error while benchmarking my target app:

E/TC:? 0 alloc_benchmark_buffer:72 Benchmark: can't create mobj for timestamp buffer

I have tried increasing the memory by increasing both PGT_CACHE_SIZE and the configurable heap size option. Furthermore, instead of the intended app, I have tried using a helloworld TA with minimum stack and heap requirements (1K in total). However, I still see the same issue, which hinted that it might not be an overall memory constraint issue, so I skimmed through the code to see the reason.

Going through the code, the error is triggered when the PTA makes an RPC call to the op-tee driver which fails. The exact failing line is in handle_rpc_func_cmd_shm_alloc:

                if (!pages || !page_num) {
                        arg->ret = TEEC_ERROR_OUT_OF_MEMORY;
                        printk(KERN_EMERG "Bad alloc");
                        goto bad;
                }

Here both the pages and page_num are zero or null. The driver call stack in the driver looks like this: handle_rpc_func_cmd_shm_alloc-> tee_shm_alloc->pool_op_alloc->optee_shm_register. Going through the functions I don't see any code updating the pages or page_num field so it was bound to fail. It is possible that I might be missing something here. However, adding a print shows that this kind of allocation (OPTEE_MSG_RPC_SHM_TYPE_GLOBAL) only happens once when I use the benchmark app so quite possible that this code is missing.
Based on my findings I have a couple of questions:

  1. Based on the build issues, I am wondering Is the benchmarking suite supported on hikey?
  2. Who is responsible for fixing up the pages and page_num field?
  3. Possible fix?

Also, I wasn't sure if this is the right place for this issue so please let me know if this is not the case. I can move it to the relevant project...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions