NetBSD Problem Report #45671

From gson@gson.org  Tue Nov 29 16:33:04 2011
Return-Path: <gson@gson.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id B285463B848
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 29 Nov 2011 16:33:04 +0000 (UTC)
Message-Id: <20111129163302.1A06175E5D@guava.gson.org>
Date: Tue, 29 Nov 2011 18:33:01 +0200 (EET)
From: gson@gson.org (Andreas Gustafsson)
Reply-To: gson@gson.org (Andreas Gustafsson)
To: gnats-bugs@gnats.NetBSD.org
Subject: Current NetBSD/i386 does not install under current qemu
X-Send-Pr-Version: 3.95

>Number:         45671
>Category:       kern
>Synopsis:       Current NetBSD/i386 does not install under current qemu
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Nov 29 16:35:00 +0000 2011
>Closed-Date:    Sun Oct 20 21:08:51 +0000 2013
>Last-Modified:  Wed May 21 22:10:00 +0000 2014
>Originator:     Andreas Gustafsson
>Release:        NetBSD-current >= 2011.02.10.00.43.20
>Organization:
>Environment:
System: NetBSD
Architecture: i386
Machine: i386
>Description:

Attempting to install NetBSD-current in qemu version 1.0-rc4 fails:

  NetBSD 5.99.57 (GENERIC) #0: Sun Nov 27 07:41:56 UTC 2011
	  builds@b8.netbsd.org:/home/builds/ab/HEAD/i386/201111270050Z-obj/home/builds/ab/HEAD/src/sys/arch/i386/compile/GENERIC
  total memory = 127 MB
  avail memory = 112 MB
  cprng kernel: WARNING insufficient entropy at creation.
  mainbus0 (root)
  cpu0 at mainbus0 apid 0: QEMU Virtual CPU version 0.15.93, id 0x633
  ioapic0 at mainbus0 apid 1
  acpi0 at mainbus0: Intel ACPICA 20110623
  panic: pci_make_tag: bad request
  fatal breakpoint trap in supervisor mode
  trap type 1 code 0 eip c0269b04 cs 8 eflags 282 cr2 0 ilevel 8
  Stopped in pid 0.1 (system) at  netbsd:breakpoint+0x4:  popl    %ebp
  db{0}>  t
  breakpoint(c0c04c75,c0cc2f80,c0bc91a4,c0e358e4,2,c11b70d6,c0e35908,c053999d,c0cdef20,0) at netbsd:breakpoint+0x4
  vpanic(c0bc91a4,c0e358e4,c117d068,f,c11e6fcc,0,c0e35918,c0665969,c0bc91a4,c0b1bf4c) at netbsd:vpanic+0x1e2
  printf_nolog(c0bc91a4,c0b1bf4c,c0e35908,c010d957,8,c0c1f2c0,0,0,c0d08e20,0) at netbsd:printf_nolog
  pci_decompose_tag(c0e3599c,0,0,10,0,ca675898,c0e35988,c0d08e20,c11b9200,0) at netbsd:pci_decompose_tag
  acpi_pci_link_add_reference(c12011c0,0,0,10,0,ca41eb90,0,3,0,4) at netbsd:acpi_pci_link_add_reference+0xb2
  mpacpi_find_interrupts(ca41eb90,c0116a4a,c0116a5e,0,ca41eb90,c0e35b50,c0e35aa8,c01180c7,c,c0116a4a) at netbsd:mpacpi_find_interrupts+0x5ea
  acpi_md_callback(c,c0116a4a,c0116a5e,0,1,ca3fd7cc,1,c078e2e4,c0cb6ce0,ca435ea0) at netbsd:acpi_md_callback+0x1c
  acpi_attach(ca660500,ca660d00,c0e35b50,0,c0e35b50,80,f,10,c0b5dcd9,c0e35b42) at netbsd:acpi_attach+0x14a
  config_attach_loc(ca660500,c0c1d7a0,0,c0e35b50,0,0,2589,58421301,4350,53445842) at netbsd:config_attach_loc+0x176
  config_found_ia(ca660500,c0b59f3c,c0e35b50,0,4f424101,20534843,80,f,c0c2bbe0,c0c2bc00) at netbsd:config_found_ia+0x36
  mainbus_rescan(ca660500,c0b59f3c,0,ca660500,c0cb6ce0,c0bd71ce,c0e35bd8,c093575c,ca437f28,c0b8e0a1) at netbsd:mainbus_rescan+0x1c2
  mainbus_attach(0,ca660500,0,c078f4b7,c0b59187,c0b59187,636f4200,7368,3001403,101) at netbsd:mainbus_attach+0xb4
  config_attach_loc(0,c0c1bbb0,0,0,0,7368,f10,0,c0b59187,e3b000) at netbsd:config_attach_loc+0x176
  config_attach(0,c0c1bbb0,0,0,1984,c0cc5680,c0e35cd8,c01f224e,c0b59187,0) at netbsd:config_attach+0x2e
  config_rootfound(c0b59187,0,0,8,1984,1984,c0e35d40,c04b78d8,c0ba59a1,6) at netbsd:config_rootfound+0x42
  cpu_configure(c0ba59a1,6,3,0,ffff,f9b00,ffff,f9300,0,0) at netbsd:cpu_configure+0x2a
  main(0,0,0,0,0,0,0,0,0,0) at netbsd:main+0x2ba
  db{0}> 

>How-To-Repeat:

Get qemu 1.0-rc4 from <http://wiki.qemu.org/Download> and install it
on a host of your choice (not necessarily a NetBSD one).

Then download a NetBSD-current/i386 install ISO from

  http://nyftp.netbsd.org/pub/NetBSD-daily/HEAD/201111270050Z/i386/installation/cdrom/boot-com.iso

or if that has expired, from

  http://www.gson.org/netbsd/bugs/qemu/boot-com-201111270050Z.iso

and try to boot it:

  qemu-system-i386 -nographic -cdrom boot-com.iso 

>Fix:

>Release-Note:

>Audit-Trail:
From: Andreas Gustafsson <gson@gson.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/45671: Current NetBSD/i386 does not install under current qemu
Date: Wed, 14 Dec 2011 21:22:06 +0200

 There is now also a corresponding qemu bug ticket:

   https://bugs.launchpad.net/bugs/897771

 The comments in that ticket identify the exact qemu commit that
 triggered the regression, but it's not clear to me from the diffs how
 that commit broke interoperability with NetBSD.

 On the NetBSD side, all versions newer than CVS date
 2011.02.10.00.43.20 are effected; the commit message for the commit in
 case says "Reinstate INSTALL kernel for embedded ramdisk installs".
 I assume the reason earlier versions are not affected is that their
 installation kernels do not support ACPI.

 In any case, it would be useful to fix both NetBSD and qemu: NetBSD
 should be fixed so that future versions of NetBSD will run under
 today's qemu, and qemu should be fixed so that future version of qemu
 will run today's version of NetBSD.

 I have also obtained a more detailed stack trace by attaching a
 remote gdb to qemu's built-in gdb server; the relevant parts
 read as follows:

   #11 0xc0994bb1 in vpanic (fmt=3D0xc0e0a530 "%s: bad request",=20
       ap=3D0xc1170854 "=5F#=E0=C0x\b\027\301{=DA\020\300`pP=C1=C0\022\3=
 53\300@#\361\300")
       at /bracket/i386-debug/work/2011.12.08.15.35.34/src/sys/kern/subr=
 =5Fprf.c:288
   #12 0xc09949e5 in panic (fmt=3D0xc0e0a530 "%s: bad request")
       at /bracket/i386-debug/work/2011.12.08.15.35.34/src/sys/kern/subr=
 =5Fprf.c:205
   #13 0xc0801d7e in pci=5Fmake=5Ftag (pc=3D0x0, bus=3D0, device=3D16, f=
 unction=3D0)
       at /bracket/i386-debug/work/2011.12.08.15.35.34/src/sys/arch/x86/=
 pci/pci=5Fmachdep.c:420
   #14 0xc012d9ca in acpi=5Fpci=5Flink=5Fadd=5Ffunctions (sc=3D0xc15311c=
 0, link=3D0xc1509e00,=20
       bus=3D0, device=3D16, pin=3D0)
       at /bracket/i386-debug/work/2011.12.08.15.35.34/src/sys/dev/acpi/=
 acpi=5Fpci=5Flink.c:572
   #15 0xc012ddc8 in acpi=5Fpci=5Flink=5Fadd=5Freference (v=3D0xc15311c0=
 , index=3D0, bus=3D0,=20
       slot=3D16, pin=3D0)
       at /bracket/i386-debug/work/2011.12.08.15.35.34/src/sys/dev/acpi/=
 acpi=5Fpci=5Flink.c:684
   #16 0xc0741a21 in mpacpi=5Fpciroute (mpr=3D0xc14ab8c0)
       at /bracket/i386-debug/work/2011.12.08.15.35.34/src/sys/arch/x86/=
 x86/mpacpi.c:847
   #17 0xc0741efb in mpacpi=5Fconfig=5Firouting (acpi=3D0xca987d44)
       at /bracket/i386-debug/work/2011.12.08.15.35.34/src/sys/arch/x86/=
 x86/mpacpi.c:1021
   #18 0xc0742232 in mpacpi=5Ffind=5Finterrupts (self=3D0xca987d44)
       at /bracket/i386-debug/work/2011.12.08.15.35.34/src/sys/arch/x86/=
 x86/mpacpi.c:1150
   #19 0xc012c2ee in acpi=5Fmd=5Fcallback ()
       at /bracket/i386-debug/work/2011.12.08.15.35.34/src/sys/arch/x86/=
 acpi/acpi=5Fmachdep.c:292
   #20 0xc011a292 in acpi=5Fattach (parent=3D0xca987540, self=3D0xca72d0=
 00,=20
       aux=3D0xc1170b18)
       at /bracket/i386-debug/work/2011.12.08.15.35.34/src/sys/dev/acpi/=
 acpi.c:476
   #21 0xc097bbab in config=5Fattach=5Floc (parent=3D0xca987540, cf=3D0x=
 c0eb1050,=20
       locs=3D0x0, aux=3D0xc1170b18, print=3D0)
       at /bracket/i386-debug/work/2011.12.08.15.35.34/src/sys/kern/subr=
 =5Fautoconf.c:1457
   #22 0xc097acf4 in config=5Ffound=5Fsm=5Floc (parent=3D0xca987540,=20
       ifattr=3D0xc0de3616 "acpibus", locs=3D0x0, aux=3D0xc1170b18, prin=
 t=3D0, submatch=3D0)
       at /bracket/i386-debug/work/2011.12.08.15.35.34/src/sys/kern/subr=
 =5Fautoconf.c:1044
   #23 0xc097ad81 in config=5Ffound=5Fia (parent=3D0xca987540,=20
       ifattr=3D0xc0de3616 "acpibus", aux=3D0xc1170b18, print=3D0)
       at /bracket/i386-debug/work/2011.12.08.15.35.34/src/sys/kern/subr=
 =5Fautoconf.c:1059
   #24 0xc070c8e9 in mainbus=5Frescan (self=3D0xca987540,=20
       ifattr=3D0xc0de3616 "acpibus", locators=3D0x0)
       at /bracket/i386-debug/work/2011.12.08.15.35.34/src/sys/arch/i386=
 /i386/mainbus.c:354
   #25 0xc070c6de in mainbus=5Fattach (parent=3D0x0, self=3D0xca987540, =
 aux=3D0x0)
       at /bracket/i386-debug/work/2011.12.08.15.35.34/src/sys/arch/i386=
 /i386/mainbus.c:292
   #26 0xc097bbab in config=5Fattach=5Floc (parent=3D0x0, cf=3D0xc0eb105=
 0, locs=3D0x0,=20
       aux=3D0x0, print=3D0)
       at /bracket/i386-debug/work/2011.12.08.15.35.34/src/sys/kern/subr=
 =5Fautoconf.c:1457
   #27 0xc097bc2b in config=5Fattach (parent=3D0x0, cf=3D0xc0eaf1f0, aux=
 =3D0x0, print=3D0)
       at /bracket/i386-debug/work/2011.12.08.15.35.34/src/sys/kern/subr=
 =5Fautoconf.c:1472
   #28 0xc097ae07 in config=5Frootfound (rootname=3D0xc0bffc74 "mainbus"=
 , aux=3D0x0)
       at /bracket/i386-debug/work/2011.12.08.15.35.34/src/sys/kern/subr=
 =5Fautoconf.c:1078
   #29 0xc0233d40 in cpu=5Fconfigure ()
       at /bracket/i386-debug/work/2011.12.08.15.35.34/src/sys/arch/i386=
 /i386/autoconf.c:120
   #30 0xc05d232c in configure ()
       at /bracket/i386-debug/work/2011.12.08.15.35.34/src/sys/kern/init=
 =5Fmain.c:765
   #31 0xc05d1d80 in main ()
       at /bracket/i386-debug/work/2011.12.08.15.35.34/src/sys/kern/init=
 =5Fmain.c:522

 --=20
 Andreas Gustafsson, gson@gson.org

From: Andreas Gustafsson <gson@gson.org>
To: gnats-bugs@NetBSD.org
Cc: Jukka Ruohonen <jruohonen@iki.fi>, David Young <dyoung@pobox.com>
Subject: Re: kern/45671: Current NetBSD/i386 does not install under current qemu
Date: Wed, 11 Jan 2012 19:08:55 +0200

 I found the cause of this; thanks to Jukka Ruohonen and David Young
 for pointing me in the right direction.

 Qemu broke the emulation of the PCI configuration register at I/O port
 0xCF8, such that doing an outb to port 0xCFB or an outw to port 0xCFA
 now changes the value of the configuration register.  Because no real
 PCI configuration register behaves that way, NetBSD concludes that the
 emulated system doesn't support PCI configuration mode 1 and assumes
 it must therefore support configuration mode 2.  It then panics when
 it finds a PCI device with device number 16, because mode 2 only
 supports 4-bit device numbers.

 There is a simple patch to qemu which has been verified to fix the
 problem:

   http://thread.gmane.org/gmane.comp.emulators.qemu/130695

 but at the time of writing, it has not yet been applied to the qemu
 repository.

 Even though this is clearly a qemu bug, there is probably still
 some room for improvement on the NetBSD side in terms of failing
 more gracefully and/or providing better diagnostics.
 -- 
 Andreas Gustafsson, gson@gson.org

From: Andreas Gustafsson <gson@gson.org>
To: gnats-bugs@NetBSD.org
Cc: kern-bug-people@netbsd.org,
    gnats-admin@netbsd.org,
    netbsd-bugs@netbsd.org
Subject: Re: kern/45671: Current NetBSD/i386 does not install under current qemu
Date: Fri, 4 Oct 2013 19:16:39 +0300

 Dear gnats,

 Today, I attempted to install NetBSD 6.1.1 on a virtual server hosted
 by edis.at and based on the Linux KVM virtialization technology.
 Booting from the install ISO failed with a panic identical to that
 reported in PR 45671.

 I assume this means that although the qemu bug causing this has been fixed
 for more than a year now ( https://bugs.launchpad.net/qemu/+bug/897771 ),
 there are still versions of KVM in production use that are based on
 buggy versions of qemu.  Therefore, it would still be useful for
 NetBSD to work around the bug, as it would broaden the range of VPS
 hosting options available.
 -- 
 Andreas Gustafsson, gson@gson.org

From: "Andreas Gustafsson" <gson@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/45671 CVS commit: src/sys/arch/x86/pci
Date: Sat, 5 Oct 2013 11:20:35 +0000

 Module Name:	src
 Committed By:	gson
 Date:		Sat Oct  5 11:20:35 UTC 2013

 Modified Files:
 	src/sys/arch/x86/pci: pci_machdep.c

 Log Message:
 Force PCI mode 1 when running under QEMU, to work around QEMU bug 897771.
 This should also make it possible to boot NetBSD under versions of KVM
 that have inherited said QEMU bug.  Fixes PR kern/45671.


 To generate a diff of this commit:
 cvs rdiff -u -r1.60 -r1.61 src/sys/arch/x86/pci/pci_machdep.c

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

State-Changed-From-To: open->feedback
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sun, 06 Oct 2013 08:18:40 +0000
State-Changed-Why:
did you mean to close this? :-)


State-Changed-From-To: feedback->pending-pullups
State-Changed-By: gson@NetBSD.org
State-Changed-When: Sun, 06 Oct 2013 09:12:28 +0000
State-Changed-Why:
Waiting for a pullup to netbsd-6 before closing.


From: "Manuel Bouyer" <bouyer@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/45671 CVS commit: [netbsd-6] src/sys/arch/x86/pci
Date: Sun, 20 Oct 2013 13:16:57 +0000

 Module Name:	src
 Committed By:	bouyer
 Date:		Sun Oct 20 13:16:57 UTC 2013

 Modified Files:
 	src/sys/arch/x86/pci [netbsd-6]: pci_machdep.c

 Log Message:
 Apply patch, requested by riastradh in ticket #962:
 sys/arch/x86/pci/pci_machdep.c			1.61 via patch

 	Force PCI mode 1 when running under QEMU, to work around
 	QEMU bug 897771.
 	This should also make it possible to boot NetBSD under versions of KVM
 	that have inherited said QEMU bug.  Fixes PR kern/45671.


 To generate a diff of this commit:
 cvs rdiff -u -r1.54 -r1.54.2.1 src/sys/arch/x86/pci/pci_machdep.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/45671 CVS commit: [netbsd-6-0] src/sys/arch/x86/pci
Date: Sun, 20 Oct 2013 13:18:48 +0000

 Module Name:	src
 Committed By:	bouyer
 Date:		Sun Oct 20 13:18:48 UTC 2013

 Modified Files:
 	src/sys/arch/x86/pci [netbsd-6-0]: pci_machdep.c

 Log Message:
 Apply patchm requested by gson in ticket #963:
 sys/arch/x86/pci/pci_machdep.c                  1.61 via patch

 	Force PCI mode 1 when running under QEMU, to work around
 	QEMU bug 897771.
 	This should also make it possible to boot NetBSD under versions of KVM
 	that have inherited said QEMU bug.  Fixes PR kern/45671.


 To generate a diff of this commit:
 cvs rdiff -u -r1.54 -r1.54.6.1 src/sys/arch/x86/pci/pci_machdep.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/45671 CVS commit: [netbsd-6-1] src/sys/arch/x86/pci
Date: Sun, 20 Oct 2013 13:18:50 +0000

 Module Name:	src
 Committed By:	bouyer
 Date:		Sun Oct 20 13:18:50 UTC 2013

 Modified Files:
 	src/sys/arch/x86/pci [netbsd-6-1]: pci_machdep.c

 Log Message:
 Apply patchm requested by gson in ticket #963:
 sys/arch/x86/pci/pci_machdep.c			1.61 via patch

 	Force PCI mode 1 when running under QEMU, to work around
 	QEMU bug 897771.
 	This should also make it possible to boot NetBSD under versions of KVM
 	that have inherited said QEMU bug.  Fixes PR kern/45671.


 To generate a diff of this commit:
 cvs rdiff -u -r1.54 -r1.54.8.1 src/sys/arch/x86/pci/pci_machdep.c

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

State-Changed-From-To: pending-pullups->closed
State-Changed-By: bouyer@NetBSD.org
State-Changed-When: Sun, 20 Oct 2013 21:08:51 +0000
State-Changed-Why:
pullups done


From: "Manuel Bouyer" <bouyer@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/45671 CVS commit: [netbsd-5] src/sys/arch/x86/pci
Date: Wed, 21 May 2014 22:05:40 +0000

 Module Name:	src
 Committed By:	bouyer
 Date:		Wed May 21 22:05:40 UTC 2014

 Modified Files:
 	src/sys/arch/x86/pci [netbsd-5]: pci_machdep.c

 Log Message:
 Pull up following revision(s) (requested by sborrill in ticket #1903):
 	sys/arch/x86/pci/pci_machdep.c: revision 1.61 via patch
 	sys/arch/x86/pci/pci_machdep.c: revision 1.66 via patch
 Force pci_mode 1 when running as Xen HVM domU to allow cd* to be
 detected correctly. Fixes kern/48770. Thanks to cube@
 Force PCI mode 1 when running under QEMU, to work around QEMU bug 897771.
 This should also make it possible to boot NetBSD under versions of KVM
 that have inherited said QEMU bug.  Fixes PR kern/45671.


 To generate a diff of this commit:
 cvs rdiff -u -r1.34.10.1 -r1.34.10.2 src/sys/arch/x86/pci/pci_machdep.c

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

>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-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.