Shared Memory in tz_vmm demo

Martin Stein martin.stein at ...1...
Tue Apr 5 12:53:57 CEST 2016

Hi Joseph,

Am 05.04.2016 um 11:19 schrieb Joseph Lee:
> Hi Stefan,
> Thanks a lot for your response.
> I have another questions. I have tried to measure the time for the
> context switch between the worlds. I make an /SMC/ call in the normal
> world (Linux) and modified the VMM to return to the normal world without
> doing any operation. I take time t1 before calling the SMC instruction
> and time t2 after the secure world switches back to the normal world.
> Then the difference (t2 - t1) is the time for the context switch. i am
> getting around /0.05/ milliseconds. Is that the right way to measure the
> time for the context switch? FYI, i use /getrusage( )/ function in Linux
> to measure t1 and t2.
> How do we measure time for a process in Genode. Is there a method to get
> time in Genode?  Thanks again for you help and time.

In general, your set-up looks reasonable to me. It is not granted that
the scheduling order in your test case is exactly 'guest os -> vmm ->
guest os'. You have to ensure that the secure world kernel doesn't mix
in other subjects.

Personally, I also would directly use a hardware timer instead of
'getrusage' to measure such small intervals. You could sample the timer
via assembly instructions located directly before and after the SMC
call, so no other instructions interfere. Make sure to prevent
instruction re-ordering here also. The hardware as well as the compiler
may under given circumstances re-order.

You may already know, but if you like to do more detailed measurements,
a timer that is configured non-secure allows you to sample from both worlds.


More information about the users mailing list