NetBSD-Bugs archive

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

Re: port-xen/45961: panic: kernel diagnostic assertion "err == 0" failed: file "/usr/src/sys/arch/xen/xen/clock.c", line 465



On Fri, Feb 10, 2012 at 02:45:00AM +0000, riz%NetBSD.org@localhost wrote:
> I got the following crash on Amazon EC2.  I assume it had
> something to do with the fact that this hypervisor
> says it's 3.0.
> 
> 
> Loaded initial symtab at 0xffffffff807fb204, strtab at 0xffffffff80850e68, # 
> entries 14537
> Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
>     2006, 2007, 2008, 2009, 2010, 2011, 2012
>     The NetBSD Foundation, Inc.  All rights reserved.
> Copyright (c) 1982, 1986, 1989, 1991, 1993
>     The Regents of the University of California.  All rights reserved.
> 
> NetBSD 5.99.64 (EC2) #0: Thu Feb  9 17:10:50 PST 2012
>       riz@wintermute:/space/build/obj.amd64/sys/arch/amd64/compile/EC2
> total memory = 7680 MB
> avail memory = 7427 MB
> cprng kernel: WARNING insufficient entropy at creation.
> mainbus0 (root)
> hypervisor0 at mainbus0: Xen version 3.0
> vcpu0 at hypervisor0: Intel(R) Xeon(R) CPU           E5430  @ 2.66GHz, id 
> 0x1067a
> vcpu1 at hypervisor0pmap_kenter_pa: mapping already present
> vcpu1: feature mismatch: cpu_feature[0] is 0xbeebcbf7, but CPU reported 
> 0xbfebfbff
> : Intel(R) Xeon(R) CPU           E5430  @ 2.66GHz, id 0x1067a
> xenbus0 at hypervisor0: Xen Virtual Bus Interface
> xencons0 at hypervisor0: Xen Virtual Console Driver
> panic: kernel diagnostic assertion "err == 0" failed: file 
> "/usr/src/sys/arch/xen/xen/clock.c", line 465 

I assumed there wouldn't be Xen 3.0 installation around any more; it looks
like I was wrong :(

Can you try the attached patch ?

-- 
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--
Index: sys/arch/xen/include/hypervisor.h
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/include/hypervisor.h,v
retrieving revision 1.36
diff -u -p -u -r1.36 hypervisor.h
--- sys/arch/xen/include/hypervisor.h   7 Dec 2011 15:47:42 -0000       1.36
+++ sys/arch/xen/include/hypervisor.h   10 Feb 2012 16:29:11 -0000
@@ -133,6 +133,10 @@ struct cpu_info;
 void do_hypervisor_callback(struct intrframe *regs);
 void hypervisor_enable_event(unsigned int);
 
+extern int xen_version;
+#define XEN_MAJOR(x) (((x) & 0xffff0000) >> 16)
+#define XEN_MINOR(x) ((x) & 0x0000ffff)
+
 /* hypervisor_machdep.c */
 void hypervisor_send_event(struct cpu_info *, unsigned int);
 void hypervisor_unmask_event(unsigned int);
Index: sys/arch/xen/xen/clock.c
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/xen/clock.c,v
retrieving revision 1.60
diff -u -p -u -r1.60 clock.c
--- sys/arch/xen/xen/clock.c    9 Jan 2012 13:35:42 -0000       1.60
+++ sys/arch/xen/xen/clock.c    10 Feb 2012 16:29:11 -0000
@@ -458,11 +458,14 @@ xen_initclocks(void)
         * after a while. Use the one-shot timer every NS_PER_TICK
         * and rearm it from the event handler.
         */
-       err = HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer,
-                                ci->ci_cpuid,
-                                NULL);
+       if (XEN_MAJOR(xen_version) > 3 || XEN_MINOR(xen_version) > 0) {
+               /* exists only on Xen 3.1 and later */
+               err = HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer,
+                                        ci->ci_cpuid,
+                                        NULL);
 
-       KASSERT(err == 0);
+               KASSERT(err == 0);
+       }
        err = HYPERVISOR_set_timer_op(
            vcpu_system_time[ci->ci_cpuid] + NS_PER_TICK);
        KASSERT(err == 0);
Index: sys/arch/xen/xen/hypervisor.c
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/xen/hypervisor.c,v
retrieving revision 1.60
diff -u -p -u -r1.60 hypervisor.c
--- sys/arch/xen/xen/hypervisor.c       9 Dec 2011 11:47:49 -0000       1.60
+++ sys/arch/xen/xen/hypervisor.c       10 Feb 2012 16:29:11 -0000
@@ -169,6 +169,8 @@ struct  x86_isa_chipset x86_isa_chipset;
 #endif
 #endif
 
+int xen_version;
+
 /* power management, for save/restore */
 static bool hypervisor_suspend(device_t, const pmf_qual_t *);
 static bool hypervisor_resume(device_t, const pmf_qual_t *);
@@ -201,7 +203,6 @@ hypervisor_vcpu_print(void *aux, const c
 void
 hypervisor_attach(device_t parent, device_t self, void *aux)
 {
-       int xen_version;
 
 #if NPCI >0
 #ifdef PCI_BUS_FIXUP
@@ -213,8 +214,8 @@ hypervisor_attach(device_t parent, devic
        xenkernfs_init();
 
        xen_version = HYPERVISOR_xen_version(XENVER_version, NULL);
-       aprint_normal(": Xen version %d.%d\n", (xen_version & 0xffff0000) >> 16,
-              xen_version & 0x0000ffff);
+       aprint_normal(": Xen version %d.%d\n", XEN_MAJOR(xen_version),
+              XEN_MINOR(xen_version));
 
        xengnt_init();
        events_init();


Home | Main Index | Thread Index | Old Index