linaro-swg / optee_benchmark

OP-TEE Latency benchmark application
Other
5 stars 21 forks source link

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

Closed mystictot closed 5 years ago

mystictot commented 5 years ago

I'm trying to run benchmark on optee_examples but it always throw below mentioned errors: I've already set CFG_TEE_BENCHMARK=y in optee_os.

Not sure why this error is appearing. @igoropaniuk @jenswi-linaro @etienne-lms

$ benchmark /usr/bin/secure_storage 
[Benchmark] INFO: 1. Opening BencD/TC:3 0 core_mmu_alloc_l2:238 L2 table used: 2/4
hmark Static TA...
D/TC:? 0 tee_ta_init_pseudo_ta_session:273 Lookup pseudo TA 0b9a63b0-b4c6-4c85-a284-a228ef547b4e
D/TC:? 0 tee_ta_init_pseudo_ta_session:285 Open benchmark.ta
D/TC:? 0 tee_ta_init_pseudo_ta_session:299 benchmark.ta : 0b9a63b0-b4c6-4c85-a284-a228ef547b4e
[Benchmark] INFO: 2. Allocating pE/TC:? 0 alloc_benchmark_buffer:80 Benchmark: can't create mobj for timestamp buffer
er-core buffers, cores detected =D/TC:? 0 tee_ta_invoke_command:625 Error: ffff000c of 4
 4
[Benchmark] ERROR: TEEC_InvokeCommand: 0xffff000c

$ benchmark /usr/bin/hello_world 
[Benchmark] INFO: 1. Opening BencD/TC:? 0 tee_ta_init_session_with_context:459 Re-open TA 0b9a63b0-b4c6-4c85-a284-a228ef547b4e
hmark Static TA...
E/TC:? 0 alloc_benchmark_buffer:80 Benchmark: can't create mobj for timestamp buffer
[Benchmark] INFO: 2. Allocating pD/TC:? 0 tee_ta_invoke_command:625 Error: ffff000c of 4
er-core buffers, cores detected =D/TC:? 0 tee_ta_close_session:380 tee_ta_close_session(0x2c261990)
D/TC:? 0 tee_ta_close_session:399 Destroy session
 4
[Benchmark] ERROR: TEEC_InvokeCommand: 0xffff000c

$ benchmark /usr/bin/acipher 35783842 "sjksjhdgjshjhvd"
[Benchmark] INFO: 1. Opening BencD/TC:? 0 tee_ta_init_session_with_context:459 Re-open TA 0b9a63b0-b4c6-4c85-a284-a228ef547b4e
hmark Static TA...
E/TC:? 0 alloc_benchmark_buffer:80 Benchmark: can't create mobj for timestamp buffer
[Benchmark] INFO: 2. Allocating pD/TC:? 0 tee_ta_invoke_command:625 Error: ffff000c of 4
er-core buffers, cores detected =D/TC:? 0 tee_ta_close_session:380 tee_ta_close_session(0x2c261990)
 4
[Benchmark] ERROR: TEEC_InvokD/TC:? 0 tee_ta_close_session:399 Destroy session
eCommand: 0xffff000c

$ benchmark /usr/bin/hotp 
[Benchmark] INFO: 1. Opening BencD/TC:? 0 tee_ta_init_session_with_context:459 Re-open TA 0b9a63b0-b4c6-4c85-a284-a228ef547b4e
hmark Static TA...
E/TC:? 0 alloc_benchmark_buffer:80 Benchmark: can't create mobj for timestamp buffer
[Benchmark] INFO: 2. Allocating pD/TC:? 0 tee_ta_invoke_command:625 Error: ffff000c of 4
er-core buffers, cores detected =D/TC:? 0 tee_ta_close_session:380 tee_ta_close_session(0x2c261990)
 4
[Benchmark] ERROR: TEEC_InvokD/TC:? 0 tee_ta_close_session:399 Destroy session
eCommand: 0xffff000c

$ benchmark /usr/bin/aes 
[Benchmark] INFO: 1. Opening BencD/TC:? 0 tee_ta_init_session_with_context:459 Re-open TA 0b9a63b0-b4c6-4c85-a284-a228ef547b4e
hmark Static TA...
E/TC:? 0 alloc_benchmark_buffer:80 Benchmark: can't create mobj for timestamp buffer
[Benchmark] INFO: 2. Allocating pD/TC:? 0 tee_ta_invoke_command:625 Error: ffff000c of 4
er-core buffers, cores detected =D/TC:? 0 tee_ta_close_session:380 tee_ta_close_session(0x2c261990)
 4
[Benchmark] ERROR: TEEC_InvokD/TC:? 0 tee_ta_close_session:399 Destroy session
eCommand: 0xffff000c

 $ benchmark /usr/bin/random 
[Benchmark] INFO: 1. Opening BencD/TC:? 0 tee_ta_init_session_with_context:459 Re-open TA 0b9a63b0-b4c6-4c85-a284-a228ef547b4e
hmark Static TA...
E/TC:? 0 alloc_benchmark_buffer:80 Benchmark: can't create mobj for timestamp buffer
D/TC:? 0 tee_ta_invoke_command:625 Error: ffff000c of 4
[Benchmark] INFO: 2. Allocating pD/TC:? 0 tee_ta_close_session:380 tee_ta_close_session(0x2c261990)
er-core buffers, cores detected =D/TC:? 0 tee_ta_close_session:399 Destroy session
 4
[Benchmark] ERROR: TEEC_InvokeCommand: 0xffff000c
igoropaniuk commented 5 years ago

Hi @mysticTot,

both optee_client, optee_os and linux should be built with benchmark support. In your case you enabled it only in optee_os core. I suggest to set this flag in the build/common.mk file instead providing it manually in all these projects.

 28 # default disable latency benchmarks (over all OP-TEE layers)                   
 29 CFG_TEE_BENCHMARK               ?= n 
mystictot commented 5 years ago

Hi @mysticTot,

Hi @igoropaniuk

Thanks a lot for replying.

both optee_client, optee_os and linux should be built with benchmark support. In your case you enabled it only in optee_os core. I suggest to set this flag in the build/common.mk file instead providing it manually in all these projects.

 28 # default disable latency benchmarks (over all OP-TEE layers)                   
 29 CFG_TEE_BENCHMARK               ?= n 

I did enabled benchmark support both in optee_os and optee_client using: make CFG_TEE_BENCHMARK=y

I found It build successfully. Please see below

$ find . -name *.o
./out/tee-supplicant/hmac_sha2.o
./out/tee-supplicant/tee_supplicant.o
./out/tee-supplicant/rpmb.o
./out/tee-supplicant/teec_ta_load.o
./out/tee-supplicant/handle.o
./out/tee-supplicant/tee_supp_fs.o
./out/tee-supplicant/sha2.o
./out/tee-supplicant/tee_socket.o
./out/libteec/teec_benchmark.o
./out/libteec/tee_client_api.o
./out/libteec/teec_trace.o

But, I'm still getting same error.

# benchmark ./optee_example_hello_world 
[Benchmark] INFO: 1. Opening BencD/TC:? 0 tee_ta_init_session_with_context:459 Re-open TA 0b9a63b0-b4c6-4c85-a284-a228ef547b4e
hmark Static TA...
[Benchmark] INFO: 2. Allocating pD/TC:? 0 tee_ta_init_session_with_context:459 Re-open TA 0b9a63b0-b4c6-4c85-a284-a228ef547b4e
er-core buffers, cores detected =D/TC:? 0 get_benchmark_memref:126 Benchmark: Sending back timestamp buffer paddr = 0x0
 4
D/TC:? 0 tee_ta_close_session:380 tee_ta_close_session(0x2c2552d0)
D/TC:? 0 tee_ta_close_session:399 Destroy session
E/TC:? 0 alloc_benchmark_buffer:80 Benchmark: can't create mobj for timestamp buffer
D/TC:? 0 tee_ta_invoke_command:625 Error: ffff000c of 4
D/TC:? 0 tee_ta_init_session_with_context:459 Re-open TA 0b9a63b0-b4c6-4c85-a284-a228ef547b4e
D/TC:? 0 get_benchmark_memref:126 Benchmark: Sending back timestamp buffer paddr = 0x0
D/TC:? 0 tee_ta_close_session:380 tee_ta_close_session(0x2c2552d0)
D/TC:? 0 tee_ta_close_session:399 Destroy session
[Benchmark] ERROR: TEEC_InvokeComD/TC:? 0 tee_ta_close_session:380 tee_ta_close_session(0x2c255388)
D/TC:? 0 tee_ta_close_session:399 Destroy session
mand: 0xffff000c
igoropaniuk commented 5 years ago

Hi @mysticTot,

optee_client, optee_os and linux should be built

mystictot commented 5 years ago

Hi @mysticTot,

optee_client, optee_os and linux should be built

which specific option in linux?

igoropaniuk commented 5 years ago

https://github.com/linaro-swg/linux/blob/optee/drivers/tee/optee/Kconfig#L17

mystictot commented 5 years ago

https://github.com/linaro-swg/linux/blob/optee/drivers/tee/optee/Kconfig#L17 Sorry, I was looking into the mainline kernel.

@igoropaniuk Now it is working

# benchmark ./optee_example_hello_world 
[Benchmark] INFO: 1. Opening BencD/TC:? 0 tee_ta_init_session_with_context:459 Re-open TA 0b9a63b0-b4c6-4c85-a284-a228ef547b4e
hmark Static TA...
[Benchmark] INFO: 2. Allocating pD/TC:? 0 tee_ta_init_session_with_context:459 Re-open TA 0b9a63b0-b4c6-4c85-a284-a228ef547b4e
er-core buffers, cores detected =D/TC:? 0 get_benchmark_memref:126 Benchmark: Sending back timestamp buffer paddr = 0x0
 4
D/TC:? 0 tee_ta_close_session:380 tee_ta_close_session(0x2c2552d0)
D/TC:? 0 tee_ta_close_session:399 Destroy session
D/TC:? 0 alloc_benchmark_buffer:98 Benchmark: allocated timestamp buffer, addr = 0x30c01000
D/TC:? 0 tee_ta_init_session_with_context:459 Re-open TA 0b9a63b0-b4c6-4c85-a284-a228ef547b4e
D/TC:? 0 get_benchmark_memref:126 Benchmark: Sending back timestamp buffer paddr = 0x2e001000
D/TC:? 0 tee_ta_close_session:380 tee_ta_close_session(0x2c255260)
D/TC:? 0 tee_ta_close_session:399 Destroy session
[Benchmark] INFO: ts buffer paddr = 2e001000, size = 3144

[Benchmark] INFO: 3. Starting origin host app /optee_example_hello_world ...
[Benchmark] INFO: Dumping timestamps to /optee_example_D/TC:? 0 tee_ta_init_pseudo_ta_session:273 Lookup pseudo TA 8aaaf200-2450-11e4-abe2-0002a5d5c51b
hello_world.ts ...
=============D/TC:? 0 load_elf:842 Lookup user TA ELF 8aaaf200-2450-11e4-abe2-0002a5d5c51b (Secure Storage TA)
=================================================================================================D/TC:? 0 load_elf:842 Lookup user TA ELF 8aaaf200-2450-11e4-abe2-0002a5)
=====
D/TC:? 0 load_elf_from_store:810 ELF load address 0x103000
D/TC:? 0 tee_ta_init_user_ta_session:1029 Processing relocations in 8aaaf200-2450-11e4-abe2-0002a5d5c51b
F/TC:? 0 trace_syscall:128 syscall #1 (syscall_log)
D/TA:  TA_CreateEntryPoint:39 has been called
F/TC:? 0 trace_syscall:128 syscall #1 (syscall_log)
D/TA:  TA_OpenSessionEntryPoint:68 has been called
F/TC:? 0 trace_syscall:128 syscall #1 (syscall_log)
I/TA: Hello World!
Invoking TA to increment 42
D/TC:? 0 tee_ta_init_session_with_context:459 Re-open TA 0b9a63b0-b4c6-4c85-a284-a228ef547b4e
D/TC:? 0 get_benchmark_memref:126 Benchmark: Sending back timestamp buffer paddr = 0x2e001000
D/TC:? 0 tee_ta_close_session:380 tee_ta_close_session(0x2c2547f0)
D/TC:? 0 tee_ta_close_session:399 Destroy session
F/TC:? 0 trace_syscall:128 syscall #1 (syscall_log)
D/TA:  inc_value:105 has been called
F/TC:? 0 trace_syscall:128 syscall #1 (syscall_log)
I/TA: Got value: 42 from NW
F/TC:? 0 trace_syscall:128 syscall #1 (syscall_log)
I/TA: Increase value to: 43
TA incremented value to 43
D/TC:? 0 tee_ta_close_session:380 tee_ta_close_session(0x2c255260)
D/TC:? 0 tee_ta_close_session:399 Destroy session
F/TC:? 0 trace_syscall:128 syscall #1 (syscall_log)
I/TA: Goodbye!
F/TC:? 0 trace_syscall:128 syscall #1 (syscall_log)
D/TA:  TA_DestroyEntryPoint:50 has been called
D/TC:? 0 tee_ta_close_session:425 Destroy TA ctx
[Benchmark] INFO: 4. Done benchmaD/TC:? 0 unregister_benchmark:155 Benchmark: Unregister benchmark ts buffer paddr = 0x2e001000
rk
D/TC:? 0 tee_ta_close_session:380 tee_ta_close_session(0x2c255388)
D/TC:? 0 tee_ta_close_session:399 Destroy session

Thanks a lot for all your help

If you want I can send the a proper build instructions patch here https://github.com/OP-TEE/optee_os/blob/master/documentation/benchmark.md.

Please let me know.

jbech-linaro commented 5 years ago

If you want I can send the a proper build instructions patch here https://github.com/OP-TEE/optee_os/blob/master/documentation/benchmark.md.

Please do, anything that makes things easier to understand is welcome! Thanks!

mystictot commented 5 years ago

If you want I can send the a proper build instructions patch here https://github.com/OP-TEE/optee_os/blob/master/documentation/benchmark.md.

Please do, anything that makes things easier to understand is welcome! Thanks!

Thanks, will send the patch asap.

vschiavoni commented 5 years ago

@mysticTot can you share with us your patch ? Thanks.

mystictot commented 5 years ago

@mysticTot can you share with us your patch ? Thanks.

Hi @vschiavoni,

I haven't prepared patch yet but it would only mention that CFG_BENCHMARK should be enabled in optee_client, optee_os and linux. Further linaro-swg version of linux should be used. This one

Do you have any other issue ?