NetBSD Problem Report #45961

From riz@wintermute.localdomain  Fri Feb 10 02:42:17 2012
Return-Path: <riz@wintermute.localdomain>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id 6862563BCF4
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 10 Feb 2012 02:42:17 +0000 (UTC)
Message-Id: <20120210024215.95AFF11C976@wintermute.localdomain>
Date: Thu,  9 Feb 2012 18:42:15 -0800 (PST)
From: riz@NetBSD.org
Reply-To: riz@NetBSD.org
To: gnats-bugs@gnats.NetBSD.org
Subject: panic: kernel diagnostic assertion "err == 0" failed: file "/usr/src/sys/arch/xen/xen/clock.c", line 465 
X-Send-Pr-Version: 3.95

>Number:         45961
>Category:       port-xen
>Synopsis:       panic: kernel diagnostic assertion "err == 0" failed: file "/usr/src/sys/arch/xen/xen/clock.c", line 465
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bouyer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Feb 10 02:45:00 +0000 2012
>Closed-Date:    Fri Jan 04 03:29:21 +0000 2013
>Last-Modified:  Fri Jan 04 03:29:21 +0000 2013
>Originator:     Jeff Rizzo
>Release:        NetBSD 5.99.64
>Organization:

>Environment:


System: 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
Architecture: x86_64
Machine: amd64
>Description:

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 
fatal breakpoint trap in supervisor mode
trap type 1 code 0 rip ffffffff801345c5 cs e030 rflags 246 cr2  21e176f000 cpl 0 rsp ffffffff8182fd50
Stopped in pid 0.1 (system) at  netbsd:breakpoint+0x5:  leave
breakpoint() at netbsd:breakpoint+0x5
vpanic() at netbsd:vpanic+0x1f2
kern_assert() at netbsd:kern_assert+0xae
xen_initclocks() at netbsd:xen_initclocks+0x1e0
initclocks() at netbsd:initclocks+0x2d
main() at netbsd:main+0x2b3
ds          0
es          fd90
fs          100
gs          c180
rdi         0
rsi         d
rbp         ffffffff8182fd50
rbx         104
rdx         0
rcx         0
rax         1
r8          1
r9          1
r10         1
r11         e033
r12         ffffffff8048f250    copyright+0x18d50
r13         ffffffff8182fd90
r14         0
r15         0
rip         ffffffff801345c5    breakpoint+0x5
cs          e030
rflags      246
rsp         ffffffff8182fd50
ss          e02b
netbsd:breakpoint+0x5:  leave
db{0}> 
>How-To-Repeat:
	Boot a XEN3_DOMU kernel on an Amazon EC2 hypervisor that
	reports being Xen 3.0 (I've seen some that are 3.1, 3.3
	and 3.4 as well)
>Fix:
	None given.

>Release-Note:

>Audit-Trail:
From: Manuel Bouyer <bouyer@antioche.eu.org>
To: gnats-bugs@NetBSD.org
Cc: port-xen-maintainer@NetBSD.org, gnats-admin@NetBSD.org,
        netbsd-bugs@NetBSD.org
Subject: Re: port-xen/45961: panic: kernel diagnostic assertion "err == 0"
 failed: file "/usr/src/sys/arch/xen/xen/clock.c", line 465
Date: Fri, 10 Feb 2012 17:30:17 +0100

 --rwEMma7ioTxnRzrJ
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline

 On Fri, Feb 10, 2012 at 02:45:00AM +0000, riz@NetBSD.org 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>
      NetBSD: 26 ans d'experience feront toujours la difference
 --

 --rwEMma7ioTxnRzrJ
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="xenclock.diff"

 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();

 --rwEMma7ioTxnRzrJ--

Responsible-Changed-From-To: port-xen-maintainer->bouyer
Responsible-Changed-By: bouyer@NetBSD.org
Responsible-Changed-When: Sun, 12 Feb 2012 19:19:27 +0000
Responsible-Changed-Why:
I proposed a patch


State-Changed-From-To: open->feedback
State-Changed-By: bouyer@NetBSD.org
State-Changed-When: Sun, 12 Feb 2012 19:19:27 +0000
State-Changed-Why:
Please test the patch; I don't have a Xen 3.0 installation any more.
I tested it on 4.1 and 3.3 with no regression


From: "Manuel Bouyer" <bouyer@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/45961 CVS commit: src/sys/arch/xen
Date: Fri, 17 Feb 2012 18:42:19 +0000

 Module Name:	src
 Committed By:	bouyer
 Date:		Fri Feb 17 18:42:19 UTC 2012

 Modified Files:
 	src/sys/arch/xen/include: hypervisor.h
 	src/sys/arch/xen/xen: hypervisor.c

 Log Message:
 - make xen_version globally available, with macros to access major and
   minor xen version.
 - In xen_initclocks(), do a VCPUOP_stop_periodic_timer only for Xen 3.1
   and later
 Should fix PR port-xen/45961


 To generate a diff of this commit:
 cvs rdiff -u -r1.37 -r1.38 src/sys/arch/xen/include/hypervisor.h
 cvs rdiff -u -r1.60 -r1.61 src/sys/arch/xen/xen/hypervisor.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Manuel Bouyer" <bouyer@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/45961 CVS commit: src/sys/arch/xen/xen
Date: Fri, 17 Feb 2012 19:00:45 +0000

 Module Name:	src
 Committed By:	bouyer
 Date:		Fri Feb 17 19:00:45 UTC 2012

 Modified Files:
 	src/sys/arch/xen/xen: clock.c

 Log Message:
 - make xen_version globally available, with macros to access major and
   minor xen version.
 - In xen_initclocks(), do a VCPUOP_stop_periodic_timer only for Xen 3.1
   and later
 Should fix PR port-xen/45961


 To generate a diff of this commit:
 cvs rdiff -u -r1.61 -r1.62 src/sys/arch/xen/xen/clock.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Jeff Rizzo" <riz@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/45961 CVS commit: [netbsd-6] src/sys/arch/xen
Date: Wed, 22 Feb 2012 18:48:46 +0000

 Module Name:	src
 Committed By:	riz
 Date:		Wed Feb 22 18:48:45 UTC 2012

 Modified Files:
 	src/sys/arch/xen/include [netbsd-6]: hypervisor.h
 	src/sys/arch/xen/xen [netbsd-6]: clock.c hypervisor.c

 Log Message:
 Pull up following revision(s) (requested by bouyer in ticket #28):
 	sys/arch/xen/include/hypervisor.h: revision 1.38
 	sys/arch/xen/xen/hypervisor.c: revision 1.61
 	sys/arch/xen/xen/clock.c: revision 1.62
 - make xen_version globally available, with macros to access major and
   minor xen version.
 - In xen_initclocks(), do a VCPUOP_stop_periodic_timer only for Xen 3.1
   and later
 Should fix PR port-xen/45961
 - make xen_version globally available, with macros to access major and
   minor xen version.
 - In xen_initclocks(), do a VCPUOP_stop_periodic_timer only for Xen 3.1
   and later
 Should fix PR port-xen/45961


 To generate a diff of this commit:
 cvs rdiff -u -r1.36 -r1.36.2.1 src/sys/arch/xen/include/hypervisor.h
 cvs rdiff -u -r1.61 -r1.61.2.1 src/sys/arch/xen/xen/clock.c
 cvs rdiff -u -r1.60 -r1.60.2.1 src/sys/arch/xen/xen/hypervisor.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: feedback->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Fri, 04 Jan 2013 03:29:21 +0000
State-Changed-Why:
Feedback timeout.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.