Port-xen archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: NetBSD and Xen 2.0



Give this a spin (please try these as separate tests):

1) Remove "options NTP" from your NetBSD/xen kernel config files.

2) Try adding "options HZ=50" to your NetBSD/xen kernel config files
   (in addition to removing "options NTP").

3) If neither of those do any good, leave both the above changes in
   place and try applying this patch:

Index: i386/locore.S
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/i386/locore.S,v
retrieving revision 1.6
retrieving revision 1.5
diff -u -r1.6 -r1.5
--- i386/locore.S       23 Sep 2004 02:24:22 -0000      1.6
+++ i386/locore.S       26 Apr 2004 22:05:04 -0000      1.5
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.S,v 1.6 2004/09/23 02:24:22 tls Exp $   */
+/*     $NetBSD: locore.S,v 1.5 2004/04/26 22:05:04 cl Exp $    */
 /*     NetBSD: locore.S,v 1.26 2004/04/12 13:17:46 yamt Exp    */
 
 /*-
@@ -1588,7 +1588,6 @@
        pushl   $IPL_NONE
        call    _C_LABEL(Xspllower)
        addl    $4,%esp
-       jmp     idle_start
 4:
        call    _C_LABEL(uvm_pageidlezero)
        CLI(%eax)
Index: xen/clock.c
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/xen/clock.c,v
retrieving revision 1.7
retrieving revision 1.6
diff -u -r1.7 -r1.6
--- xen/clock.c 23 Sep 2004 02:24:22 -0000      1.7
+++ xen/clock.c 16 Jul 2004 22:36:33 -0000      1.6
@@ -1,4 +1,4 @@
-/*     $NetBSD: clock.c,v 1.7 2004/09/23 02:24:22 tls Exp $    */
+/*     $NetBSD: clock.c,v 1.6 2004/07/16 22:36:33 tls Exp $    */
 
 /*
  *
@@ -34,7 +34,7 @@
 #include "opt_xen.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.7 2004/09/23 02:24:22 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.6 2004/07/16 22:36:33 tls Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -54,17 +54,13 @@
 static int xen_timer_handler(void *, struct trapframe *);
 
 /* These are peridically updated in shared_info, and then copied here. */
-static uint64_t shadow_tsc_stamp;
-static uint64_t shadow_system_time;
+static unsigned long shadow_tsc_stamp;
+static u_int64_t shadow_system_time;
 static unsigned long shadow_time_version;
 static struct timeval shadow_tv;
 
 static int timeset;
 
-static uint64_t processed_system_time;
-
-#define NS_PER_TICK (1000000000ULL/hz)
-
 /*
  * Reads a consistent set of time-base values from Xen, into a shadow data
  * area.  Must be called at splclock.
@@ -77,23 +73,12 @@
                __insn_barrier();
                shadow_tv.tv_sec = HYPERVISOR_shared_info->wc_sec;
                shadow_tv.tv_usec = HYPERVISOR_shared_info->wc_usec;
-               shadow_tsc_stamp = HYPERVISOR_shared_info->tsc_timestamp <<
-                   HYPERVISOR_shared_info->rdtsc_bitshift;
+               shadow_tsc_stamp = HYPERVISOR_shared_info->tsc_timestamp;
                shadow_system_time = HYPERVISOR_shared_info->system_time;
                __insn_barrier();
        } while (shadow_time_version != HYPERVISOR_shared_info->time_version1);
 }
 
-static uint64_t
-get_tsc_offset_ns(void)
-{
-       uint32_t tsc_delta;
-       struct cpu_info *ci = curcpu();
-
-       tsc_delta = cpu_counter32() - shadow_tsc_stamp;
-       return tsc_delta * 1000000000 / cpu_frequency(ci);
-}
-
 void
 inittodr(time_t base)
 {
@@ -204,9 +189,6 @@
 xen_initclocks()
 {
 
-       get_time_values_from_xen();
-       processed_system_time = shadow_system_time;
-       
        event_set_handler(_EVENT_TIMER, (int (*)(void *))xen_timer_handler,
            NULL, IPL_CLOCK);
        hypervisor_enable_event(_EVENT_TIMER);
@@ -215,8 +197,6 @@
 static int
 xen_timer_handler(void *arg, struct trapframe *regs)
 {
-       int64_t delta;
-
 #if defined(I586_CPU) || defined(I686_CPU)
        static int microset_iter; /* call cc_microset once/sec */
        struct cpu_info *ci = curcpu();
@@ -242,13 +222,7 @@
 
        get_time_values_from_xen();
 
-       delta = (int64_t)(shadow_system_time + get_tsc_offset_ns() -
-                         processed_system_time);
-       while (delta >= NS_PER_TICK) {
-               hardclock((struct clockframe *)regs);
-               delta -= NS_PER_TICK;
-               processed_system_time += NS_PER_TICK;
-       }
+       hardclock((struct clockframe *)regs);
 
        return 0;
 }



Home | Main Index | Thread Index | Old Index