WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] A clocksource question

On 03/10/2010 05:19 PM, Joanna Rutkowska wrote:
On 11/03/2010 02:06, Jeremy Fitzhardinge wrote:
On 03/10/2010 04:52 PM, Joanna Rutkowska wrote:
BTW, how does the clocksource=jiffies work on a pvops kernel in Dom0?

Not very well.  clocksource=jiffies just sets up timer interrupts at
approx 100ms intervals and assumes that's 100ms.  You get very low res
timers and timekeeping.

So, how to explain that there is no wallclock drift *at all*, even in a
long run -- uptime of a few days, in Dom0, when it uses the jiffies source?

You said earlier that you were seeing clock drift with clocksource=jiffies in dom0.

Anyway, I assume that the "xen" clock source is much more fine grained
(1ms?)

The xen clocksource has nanosecond resolution. But clocksources are different from event sources, and so the ns resolution of time measurement doesn't have much relationship to the timer precision (which is always going to use the xen event source, which is also ns resolution, but it will tend to fold together timer events which are closer than 50us).

  and so, maybe my kbd hiccups are caused by some code executed by
the timer interrupt too frequently (maybe too much code executes per
each timer interrupt, because of some other bug)? Just a though...

Possibly, but doesn't seem too likely. Can you tell if your hiccups are accompanied by bursts of timer interrupts in /proc/interrupts?

There is another possibility, which is that the scheduler is getting confused by xen's scheduler clock. Rather than just scheduling based on real time, we try to take into account time stolen from a vcpu so that it isn't credited against the process (which may have had all its time stolen by another domain). But that could just be confusing things.

Does this help?

diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
index 0d3f07c..9029885 100644
--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -161,6 +161,9 @@ static void do_stolen_accounting(void)
  */
 unsigned long long xen_sched_clock(void)
 {
+#if 1
+       return xen_clocksource_read();
+#else
        struct vcpu_runstate_info state;
        cycle_t now;
        u64 ret;
@@ -190,6 +193,7 @@ unsigned long long xen_sched_clock(void)
        preempt_enable();

        return ret;
+#endif
 }





    J

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel