Hi Martin,

Thank you so much.



On Tue, Apr 5, 2016 at 12:53 PM, Martin Stein <martin.stein@...1...> wrote:
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.

I just only commented out line 118 (i.e., if (_handle_vm())) in https://github.com/genodelabs/genode/blob/15.11/repos/os/src/server/tz_vmm/spec/imx53/main.cc
so that the TZ VMM switches to the normal world immediately by invoking the run function of the VM session interface. I don't know how to do with instruction re-ordering in secure world kernel. Can you please give me some hint?
 
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.

I wonder if you could tell me assembly instructions to measure small intervals? i have tried the following but i got 0 value.

      asm volatile ("MRC p15, 0, %0, c9, c13, 0\t\n": "=r"(t1));
        // smc call
      asm volatile ("MRC p15, 0, %0, c9, c13, 0\t\n": "=r"(t2));
      interval = t2 - t1;

 

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.

   how do we measure the time taken to execute some instructions in the secure world? 
 
Cheers,
Martin


Thanks,

 
------------------------------------------------------------------------------
_______________________________________________
genode-main mailing list
genode-main@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/genode-main