On Fri, 15 Feb 2019, 18:41 Andrii Anisov, wrote: > > On 15.02.19 19:13, Julien Grall wrote: > > Not really... This is an implementation details that does not matter > > on the OS side. > And on hypervisor side? > My point is the interface should be the same whether we decide to keep the runstate mapped or not. This is just an implementation details. > > If you want accurate number, then the NOW() macro is not sufficient > > enough. Read to CNTPCTL_EL0 can occur speculatively and out of order > > relative to other instructions executed on the same PE. So the PE can > > potentially execute CNTPCTL_EL0 before update_runstate_area(...). > > > > You would want to add an isb() at least before NOW() and potentially > > after (unless you have register dependency). > > I have a patch for adding an isb() in the NOW() macro. I will send it > later on.Good hint. > > > > >> update_runstate_area(current); > >> > >> + if (current->domain->domain_id == 1) > >> + printk("cp = %"PRI_stime"\n", NOW()-t); > > > > That's only one number. Did you do an average over multiple context > > switch (say 1000) ? > No, just got them on the console to see the numbers. They seems to not > change significantly during a minute run. > This does not really tell me a rough number of context switch... The more, I still don't have the full pictures on your setup as you haven't answered to my question on the previous e-mail... Can you please get the number of context switch and the average value? That's why I did not answer about context switches number Couldn't you have said that from the beginning? This is rather annoying to have question ignored. If you want meaningful feedback, then please start answering *all* questions. I would have been happy if you said "I didn't do it". I can do it in a bit more complicated way. But I do not expect I would > encounter differences. > A grep and sed should help to confirm your finding. I want to be sure that the numbers are correct and not just an impression. Cheers, -- Julien Grall