Reentrancy fixes#24
Conversation
|
+1 |
|
Nice code, easy to read :) Could you explain briefly in the commit message what this patch fixes/improves at a higher level maybe? Here is my understanding.
While you're at it, add a reference to the driver patch: 'This patch needs the associated driver update: "Allow parallel entries to secure world"'. Since we have 2 separate projects I think this can be useful. |
There was a problem hiding this comment.
Is it needed to ifdef around this? I cannot see that it is defined anywhere else? Configurable from make?
There was a problem hiding this comment.
64 is a reasonable limit, but in case we'd like to override it the ifndef will help. If we end up with mutexes in dynamic structures the number of needed mutexes will likely depend on how much memory is available. It could be nice to be able configure a larger number for some platforms.
|
I'm happy with Jens motivations for our comments, so +1 from me. |
|
+1 from me, too. |
|
One more simple bugfix (but hard to find). I'll squash and rebase once Pascal is happy with it. |
|
+1 |
|
I would have been nice to have this merged, but waiting another day is OK for me. |
|
So please go on. Squash on top of master, and I'll merge. On 1 September 2014 13:04, Jens Wiklander [email protected] wrote:
|
Before this patch: The normal world was only allowed to enter secure world with one thread at a time. After this patch: The normal world may try to enter secure world with as many threads as it likes, secure world will return busy when no more threads can be allowed. Secure world still only allows one active thread at a time, but during RPC another thread may enter and do some work. This is needed for cancellation to work. * Adds a mutex that waits in normal world if busy * Adds a new RPC service to wait in normal world * Imports bitstring.h from FreeBSD to aid mutex implementation * Adds a critical section in tee_ta_init_session * Unmaps TA before RPC exit and maps it again on return to handle rescheduling of threads during RPC * Doesn't clear a1-a3 when returning busy * Bugfixes vector_std_smc_entry This patch depends on the "Allow parallel entries to secure world" patch in optee_linuxdriver.
7e00f32 to
f1c74b4
Compare
|
Squashed on top of master |
Tracing the log syscall is of very little value since it will generate some output to the console anyways. Worse, it pollutes the TA output in case of a panic or an abort. For example: o regression_4005.1 AE case 0 algo 0x40000710 line 2819 F/TC:?? 0 trace_syscall:132 syscall #27 (syscall_cryp_obj_alloc) F/TC:?? 0 trace_syscall:132 syscall #15 (syscall_cryp_state_alloc) F/TC:?? 0 trace_syscall:132 syscall #27 (syscall_cryp_obj_alloc) F/TC:?? 0 trace_syscall:132 syscall #24 (syscall_cryp_obj_get_info) F/TC:?? 0 trace_syscall:132 syscall #30 (syscall_cryp_obj_populate) F/TC:?? 0 trace_syscall:132 syscall #24 (syscall_cryp_obj_get_info) F/TC:?? 0 trace_syscall:132 syscall #24 (syscall_cryp_obj_get_info) F/TC:?? 0 trace_syscall:132 syscall #29 (syscall_cryp_obj_reset) F/TC:?? 0 trace_syscall:132 syscall #24 (syscall_cryp_obj_get_info) F/TC:?? 0 trace_syscall:132 syscall #24 (syscall_cryp_obj_get_info) F/TC:?? 0 trace_syscall:132 syscall #31 (syscall_cryp_obj_copy) F/TC:?? 0 trace_syscall:132 syscall #24 (syscall_cryp_obj_get_info) F/TC:?? 0 trace_syscall:132 syscall #28 (syscall_cryp_obj_close) F/TC:?? 0 trace_syscall:132 syscall #34 (syscall_authenc_init) F/TC:?? 0 trace_syscall:132 syscall #2 (syscall_panic) E/TC:?? 0 E/TC:?? 0 TA panicked with code 0xffff0006 F/TC:?? 0 trace_syscall:132 syscall #1 (syscall_log) E/LD: Status of TA cb3e5ba0-adf1-11e0-998b-0002a5d5c51b F/TC:?? 0 trace_syscall:132 syscall #1 (syscall_log) E/LD: arch: aarch64 F/TC:?? 0 trace_syscall:132 syscall #1 (syscall_log) E/LD: region 0: va 0x40004000 pa 0x100062d000 size 0x002000 flags rw-s (ldelf) F/TC:?? 0 trace_syscall:132 syscall #1 (syscall_log) E/LD: region 1: va 0x40006000 pa 0x100062f000 size 0x00d000 flags r-xs (ldelf) ... Therefore, skip the trace if the syscall number it TEE_SCN_LOG. Signed-off-by: Jerome Forissier <[email protected]>
Tracing the log syscall is of very little value since it will generate some output to the console anyways. Worse, it pollutes the TA output in case of a panic or an abort. For example: o regression_4005.1 AE case 0 algo 0x40000710 line 2819 F/TC:?? 0 trace_syscall:132 syscall #27 (syscall_cryp_obj_alloc) F/TC:?? 0 trace_syscall:132 syscall #15 (syscall_cryp_state_alloc) F/TC:?? 0 trace_syscall:132 syscall #27 (syscall_cryp_obj_alloc) F/TC:?? 0 trace_syscall:132 syscall #24 (syscall_cryp_obj_get_info) F/TC:?? 0 trace_syscall:132 syscall #30 (syscall_cryp_obj_populate) F/TC:?? 0 trace_syscall:132 syscall #24 (syscall_cryp_obj_get_info) F/TC:?? 0 trace_syscall:132 syscall #24 (syscall_cryp_obj_get_info) F/TC:?? 0 trace_syscall:132 syscall #29 (syscall_cryp_obj_reset) F/TC:?? 0 trace_syscall:132 syscall #24 (syscall_cryp_obj_get_info) F/TC:?? 0 trace_syscall:132 syscall #24 (syscall_cryp_obj_get_info) F/TC:?? 0 trace_syscall:132 syscall #31 (syscall_cryp_obj_copy) F/TC:?? 0 trace_syscall:132 syscall #24 (syscall_cryp_obj_get_info) F/TC:?? 0 trace_syscall:132 syscall #28 (syscall_cryp_obj_close) F/TC:?? 0 trace_syscall:132 syscall #34 (syscall_authenc_init) F/TC:?? 0 trace_syscall:132 syscall #2 (syscall_panic) E/TC:?? 0 E/TC:?? 0 TA panicked with code 0xffff0006 F/TC:?? 0 trace_syscall:132 syscall #1 (syscall_log) E/LD: Status of TA cb3e5ba0-adf1-11e0-998b-0002a5d5c51b F/TC:?? 0 trace_syscall:132 syscall #1 (syscall_log) E/LD: arch: aarch64 F/TC:?? 0 trace_syscall:132 syscall #1 (syscall_log) E/LD: region 0: va 0x40004000 pa 0x100062d000 size 0x002000 flags rw-s (ldelf) F/TC:?? 0 trace_syscall:132 syscall #1 (syscall_log) E/LD: region 1: va 0x40006000 pa 0x100062f000 size 0x00d000 flags r-xs (ldelf) ... Therefore, skip the trace if the syscall number it TEE_SCN_LOG. Signed-off-by: Jerome Forissier <[email protected]> Reviewed-by: Jens Wiklander <[email protected]>
Tracing the log syscall is of very little value since it will generate some output to the console anyways. Worse, it pollutes the TA output in case of a panic or an abort. For example: o regression_4005.1 AE case 0 algo 0x40000710 line 2819 F/TC:?? 0 trace_syscall:132 syscall #27 (syscall_cryp_obj_alloc) F/TC:?? 0 trace_syscall:132 syscall #15 (syscall_cryp_state_alloc) F/TC:?? 0 trace_syscall:132 syscall #27 (syscall_cryp_obj_alloc) F/TC:?? 0 trace_syscall:132 syscall #24 (syscall_cryp_obj_get_info) F/TC:?? 0 trace_syscall:132 syscall #30 (syscall_cryp_obj_populate) F/TC:?? 0 trace_syscall:132 syscall #24 (syscall_cryp_obj_get_info) F/TC:?? 0 trace_syscall:132 syscall #24 (syscall_cryp_obj_get_info) F/TC:?? 0 trace_syscall:132 syscall #29 (syscall_cryp_obj_reset) F/TC:?? 0 trace_syscall:132 syscall #24 (syscall_cryp_obj_get_info) F/TC:?? 0 trace_syscall:132 syscall #24 (syscall_cryp_obj_get_info) F/TC:?? 0 trace_syscall:132 syscall #31 (syscall_cryp_obj_copy) F/TC:?? 0 trace_syscall:132 syscall #24 (syscall_cryp_obj_get_info) F/TC:?? 0 trace_syscall:132 syscall #28 (syscall_cryp_obj_close) F/TC:?? 0 trace_syscall:132 syscall #34 (syscall_authenc_init) F/TC:?? 0 trace_syscall:132 syscall #2 (syscall_panic) E/TC:?? 0 E/TC:?? 0 TA panicked with code 0xffff0006 F/TC:?? 0 trace_syscall:132 syscall #1 (syscall_log) E/LD: Status of TA cb3e5ba0-adf1-11e0-998b-0002a5d5c51b F/TC:?? 0 trace_syscall:132 syscall #1 (syscall_log) E/LD: arch: aarch64 F/TC:?? 0 trace_syscall:132 syscall #1 (syscall_log) E/LD: region 0: va 0x40004000 pa 0x100062d000 size 0x002000 flags rw-s (ldelf) F/TC:?? 0 trace_syscall:132 syscall #1 (syscall_log) E/LD: region 1: va 0x40006000 pa 0x100062f000 size 0x00d000 flags r-xs (ldelf) ... Therefore, skip the trace if the syscall number it TEE_SCN_LOG. Signed-off-by: Jerome Forissier <[email protected]> Reviewed-by: Jens Wiklander <[email protected]>
Tracing the log syscall is of very little value since it will generate some output to the console anyways. Worse, it pollutes the TA output in case of a panic or an abort. For example: o regression_4005.1 AE case 0 algo 0x40000710 line 2819 F/TC:?? 0 trace_syscall:132 syscall OP-TEE#27 (syscall_cryp_obj_alloc) F/TC:?? 0 trace_syscall:132 syscall OP-TEE#15 (syscall_cryp_state_alloc) F/TC:?? 0 trace_syscall:132 syscall OP-TEE#27 (syscall_cryp_obj_alloc) F/TC:?? 0 trace_syscall:132 syscall OP-TEE#24 (syscall_cryp_obj_get_info) F/TC:?? 0 trace_syscall:132 syscall OP-TEE#30 (syscall_cryp_obj_populate) F/TC:?? 0 trace_syscall:132 syscall OP-TEE#24 (syscall_cryp_obj_get_info) F/TC:?? 0 trace_syscall:132 syscall OP-TEE#24 (syscall_cryp_obj_get_info) F/TC:?? 0 trace_syscall:132 syscall OP-TEE#29 (syscall_cryp_obj_reset) F/TC:?? 0 trace_syscall:132 syscall OP-TEE#24 (syscall_cryp_obj_get_info) F/TC:?? 0 trace_syscall:132 syscall OP-TEE#24 (syscall_cryp_obj_get_info) F/TC:?? 0 trace_syscall:132 syscall OP-TEE#31 (syscall_cryp_obj_copy) F/TC:?? 0 trace_syscall:132 syscall OP-TEE#24 (syscall_cryp_obj_get_info) F/TC:?? 0 trace_syscall:132 syscall OP-TEE#28 (syscall_cryp_obj_close) F/TC:?? 0 trace_syscall:132 syscall OP-TEE#34 (syscall_authenc_init) F/TC:?? 0 trace_syscall:132 syscall OP-TEE#2 (syscall_panic) E/TC:?? 0 E/TC:?? 0 TA panicked with code 0xffff0006 F/TC:?? 0 trace_syscall:132 syscall OP-TEE#1 (syscall_log) E/LD: Status of TA cb3e5ba0-adf1-11e0-998b-0002a5d5c51b F/TC:?? 0 trace_syscall:132 syscall OP-TEE#1 (syscall_log) E/LD: arch: aarch64 F/TC:?? 0 trace_syscall:132 syscall OP-TEE#1 (syscall_log) E/LD: region 0: va 0x40004000 pa 0x100062d000 size 0x002000 flags rw-s (ldelf) F/TC:?? 0 trace_syscall:132 syscall OP-TEE#1 (syscall_log) E/LD: region 1: va 0x40006000 pa 0x100062f000 size 0x00d000 flags r-xs (ldelf) ... Therefore, skip the trace if the syscall number it TEE_SCN_LOG. Signed-off-by: Jerome Forissier <[email protected]> Reviewed-by: Jens Wiklander <[email protected]>
Consume upstream cpu on
rescheduling of threads during RPC