<div dir="ltr"><div>Hi Martin,<br><br></div>Thank you so much. <br><br><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 5, 2016 at 12:53 PM, Martin Stein <span dir="ltr"><<a href="mailto:martin.stein@...1..." target="_blank">martin.stein@...1...</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Joseph,<br>
<span><br>
Am 05.04.2016 um 11:19 schrieb Joseph Lee:<br>
> Hi Stefan,<br>
><br>
> Thanks a lot for your response.<br>
><br>
> I have another questions. I have tried to measure the time for the<br>
</span>> context switch between the worlds. I make an /SMC/ call in the normal<br>
<span>> world (Linux) and modified the VMM to return to the normal world without<br>
> doing any operation. I take time t1 before calling the SMC instruction<br>
> and time t2 after the secure world switches back to the normal world.<br>
> Then the difference (t2 - t1) is the time for the context switch. i am<br>
</span>> getting around /0.05/ milliseconds. Is that the right way to measure the<br>
> time for the context switch? FYI, i use /getrusage( )/ function in Linux<br>
<span>> to measure t1 and t2.<br>
><br>
> How do we measure time for a process in Genode. Is there a method to get<br>
> time in Genode? Thanks again for you help and time.<br>
<br>
</span>In general, your set-up looks reasonable to me. It is not granted that<br>
the scheduling order in your test case is exactly 'guest os -> vmm -><br>
guest os'. You have to ensure that the secure world kernel doesn't mix<br>
in other subjects.<br></blockquote><div><br>I just only commented out line 118 (<span>i.e.,</span><i><span> if</span> (<span>_handle_vm</span>())</i>) in <a href="https://github.com/genodelabs/genode/blob/15.11/repos/os/src/server/tz_vmm/spec/imx53/main.cc" target="_blank">https://github.com/genodelabs/genode/blob/15.11/repos/os/src/server/tz_vmm/spec/imx53/main.cc</a><br>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? <br> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Personally, I also would directly use a hardware timer instead of<br>
'getrusage' to measure such small intervals. You could sample the timer<br>
via assembly instructions located directly before and after the SMC<br>
call, so no other instructions interfere. Make sure to prevent<br>
instruction re-ordering here also. The hardware as well as the compiler<br>
may under given circumstances re-order.<br></blockquote><div><br>I wonder if you could tell me assembly instructions to measure small intervals? i have tried the following but i got 0 value.<br><br><div><i> asm volatile ("MRC p15, 0, %0, c9, c13, 0\t\n": "=r"(t1));<br></i></div><div><i> // smc call<br></i><i> asm volatile ("MRC p15, 0, %0, c9, c13, 0\t\n": "=r"(t2));<br></i></div><div><i> interval = t2 - t1;<br></i></div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
You may already know, but if you like to do more detailed measurements,<br>
a timer that is configured non-secure allows you to sample from both worlds.<br>
<br></blockquote><div> how do we measure the time taken to execute some instructions in the secure world? <br> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Cheers,<br>
Martin<br><div><div></div></div></blockquote><div><br></div><div><br>Thanks,<br></div><div><br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div>
------------------------------------------------------------------------------<br>
_______________________________________________<br>
genode-main mailing list<br>
<a href="mailto:genode-main@lists.sourceforge.net" target="_blank">genode-main@lists.sourceforge.net</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/genode-main" rel="noreferrer" target="_blank">https://lists.sourceforge.net/lists/listinfo/genode-main</a><br>
</div></div></blockquote></div><br></div></div>