Hi, I want to benchmark the execution of a function running in the secure world of the TZ_VMM scenario in the i.MX53 QSB.
I have added a syscall to Linux which allows me to trigger a world switch from a user program running in Linux. In this program I have a function which allocates a buffer and processes it (each buffer position is changed in some way). This same function is coded inside TZ_VMM.
This is what I'm testing:
1. Inside my user program in Linux I use gettimeofday before and after the execution of the function in order to get the amount of milliseconds in between. This is my NW test. 2. Inside my user program in Linux I use gettimeofday to get the start time, then I execute the syscall which in turn does a world switch. Then the function is executed inside the SW and it returns to the user program inside Linux. After this I call another gettimeofday in order to get the amount of milliseconds of execution.
The problem is that test 1 is giving me about 90 ms of real time execution, but test 2 gives me about 40 ms.
I suspect it might be a problem with Linux virtualization in the TZ_VMM example, which may be causing a drift in Linux's clock once it loses control to the SW. What I mean is, when there isn't a syscall triggering the SMC, Linux can count time just fine, but once the control is lost to the secure world the clock inside Linux becomes inconsistent and doesn't count time while the secure world is executing. Is this right?
Since I really need to benchmark a scenario similar to this I think that the best alternative is to offload the time functionality to Genode (SW). I create another syscall which is responsible for starting a timer inside Genode, then I call the SMC syscall which processes the buffer in the SW, then I call the time syscall again and check the difference. When I want to benchmark the NW function I follow the same steps as before. Will this work as intended?
I'm thinking that this alternative may suffer from the same problem as before if Genode's time clock becomes inconsistent whenever Linux is being executed in NW.
Do you know any other way to benchmark a world switch + processing + world switch scenario? Is there any timer I can execute inside TZ_VMM?
Thanks in advance, Tiago