Skip to content

Conversation

@Leo-mediatek
Copy link

Currently, tee-supplicant appends to an existing prof file if OP-TEE provides a non-zero id in the rpc call parameter. However, for ftrace data, there is always a header in the buffer.

This patch makes tee-supplicant not to write duplicate header by locating the ftrace magic and discarding data before it when tee-supplicant receives a non-zero ftrace id.

This is required for OP-TEE/optee_os#7657 to produce correct ftrace data.

…ace file

Currently, tee-supplicant appends to an existing prof file if OP-TEE
provides a non-zero id in the rpc call parameter. However, for ftrace
data, there is always a header in the buffer.

This patch makes tee-supplicant not to write duplicate header by
locating the ftrace magic and discarding data before it when
tee-supplicant receives a non-zero ftrace id.

Signed-off-by: Leo Chen <shf.chen@mediatek.com>
@jforissier
Copy link
Contributor

This introduces some knowledge on the ftrace format into tee-supplicant (the "FTRACE\0\1" magic). I'd like to avoid that is possible. Could OP-TEE OS be updated to avoid sending the magic twice instead?

@Leo-mediatek
Copy link
Author

I cannot remember why I chose to remove the ftrace header here.

I think we can make the header not to be copied to the tee-supplicant by adding an if at optee_os to check whether fbuf->dump_id == 0.

https://github.com/OP-TEE/optee_os/blob/ce964642bf4580d8ab1914b6c4d4bcf7bd055928/ldelf/ftrace.c#L109-L110

@jforissier
Copy link
Contributor

I cannot remember why I chose to remove the ftrace header here.

😁

I think we can make the header not to be copied to the tee-supplicant by adding an if at optee_os to check whether fbuf->dump_id == 0.

https://github.com/OP-TEE/optee_os/blob/ce964642bf4580d8ab1914b6c4d4bcf7bd055928/ldelf/ftrace.c#L109-L110

It should work, yes. Can you please try it and push an update to OP-TEE/optee_os#7657 if it works well? Thanks!

@Leo-mediatek
Copy link
Author

I remembered that why I handle the header in tee-supplicant.

Since the header is written at many location:

Therefore, handle this in tee-supplicant is easier. But I think it is ok to add an if statement to all of them.

@jforissier
Copy link
Contributor

Therefore, handle this in tee-supplicant is easier. But I think it is ok to add an if statement to all of them.

Yes please fix in optee_os, it makes more sense.

@Leo-mediatek
Copy link
Author

Okay, I will try to modify that in optee_os and test if the ftrace output is correct.

@Leo-mediatek
Copy link
Author

I tested handling the header in optee_os and it works as expected now.

I think this PR is no longer needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants