Subject: port-i386/18159: problem running NetBSD inside NetBSD using VMWare 2.0.4
To: None <>
From: None <>
List: netbsd-bugs
Date: 09/03/2002 16:39:12
>Number:         18159
>Category:       port-i386
>Synopsis:       problem running NetBSD inside NetBSD using VMWare 2.0.4
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    port-i386-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Sep 03 14:40:00 PDT 2002
>Originator:     Marcello Balduccini
>Release:        NetBSD 1.5.1
	Knowledge Representation Lab
	Dept. of Computer Science
	Texas Tech University
	Lubbock, TX
	System: NetBSD cucciolo 1.5.3 NetBSD 1.5.3 (MAIL-floppy) #5: Tue Sep  3 11:40:43 CDT 2002 i386

	also tested on:

	NetBSD 1.5.1/i386
	NetBSD 1.5.2/i386

	NetBSD is unusable when run as guest OS of VMWare 2.0.4. For my tests, I always had NetBSD as host OS.
	The problem appeared when I moved to a new Pentium 4.4GHz, with ASUS 533 MotherBoard. Everything
	worked fine with my old Dell Pentium 3, 933MHz. Also, the problem does not appear if the guest
	OS is Windows 2000/NT (I didnt't try any other version).

	With NetBSD 1.5.X, the boot sequence hangs for minutes after pciide0 has been detected, right before
	the wd0 is shown on the screen. If the emulation is allowed to run for some minutes, it eventually
	detects wd0, atapibus0, cd0, le0 and hangs again right after isa0 has been detected. Here is a
	sample output. Notice that the clock frequency is completely wrong.

	The simplest way is to create a new virtual machine and let it boot off a NetBSD
	boot disk image. 
	None known. My guess is that there is a problem in either delay() or rdtsc().

	My VERY WILD workaround has been to add a statement
	at the entry of delay(), in sys/arch/i386/isa/clock.c. This removes the problem
	of NetBSD hanging. The emulated system was able to complete the boot sequence.
	The scale factor was picked to match the difference between the actual clock
	frequency and the one measured by the guest OS. The correct factor would be
	about 200, but I preferred 300 because with 200 the system was still slower
	than it should.
 >> NetBSD/i386 BIOS Boot, Revision 2.7
 >> (, Tue Sep  3 11:19:53 CDT 2002)
 >> Memory: 637/60416 k
 Use hd1a:netbsd to boot sd0 when wd0 is also installed
 Press return to boot now, any other key for boot menu
 booting fd0a:netbsd - starting in 0 
 open netbsd: No such file or directory
 boot: fd0a:netbsd: No such file or directory
 booting fd0a:netbsd.gz
 1330121+82460+174376 [65+108352+83183]=0x1b355c
 [ preserving 192056 bytes of netbsd ELF symbol table ]
 Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001
     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 1.5.3 (MAIL-floppy) #5: Tue Sep  3 11:40:43 CDT 2002
 cpu0: Intel (null) (686-class), 444154.66 MHz  <================ WRONG CLOCK FREQUENCY
 total memory = 61056 KB
 avail memory = 54636 KB
 using 788 buffers containing 3152 KB of memory
 BIOS32 rev. 0 found at 0xfd8c0
 mainbus0 (root)
 pci0 at mainbus0 bus 0: configuration mode 1
 pci0: i/o space, memory space enabled
 pchb0 at pci0 dev 0 function 0
 pchb0: Intel 82439TX System Controller (MTXC) (rev. 0x01)
 pcib0 at pci0 dev 7 function 0
 pcib0: Intel 82371AB PCI-to-ISA Bridge (PIIX4) (rev. 0x08)
 pciide0 at pci0 dev 7 function 1: Intel 82371AB IDE controller (PIIX4) (rev. 0x01)
 pciide0: bus-master DMA support present
 pciide0: primary channel wired to compatibility mode
 ===============> SYSTEM HANGS HERE FOR MINUTES <==================
 wd0 at pciide0 channel 0 drive 0: <VMware Virtual IDE Hard Drive>
 wd0: drive supports 64-sector pio transfers, lba addressing
 wd0: 8000 MB, 16254 cyl, 16 head, 63 sec, 512 bytes/sect x 16384032 sectors
 wd0: 32-bit data port
 wd0: drive supports PIO mode 4, DMA mode 2
 pciide0: primary channel interrupting at irq 14
 wd0(pciide0:0:0): using PIO mode 4, DMA mode 2 (using DMA data transfers)
 pciide0: secondary channel wired to compatibility mode
 atapibus0 at pciide0 channel 1
 cd0 at atapibus0 drive 0: <VMware Virtual IDE CDROM Drive, 1000000000000000000, 0000000> type 5 cdrom removable
 cd0: 32-bit data port
 cd0: drive supports PIO mode 4
 pciide0: secondary channel interrupting at irq 15
 cd0(pciide0:1:0): using PIO mode 4
 unknown vendor 0x15ad product 0x0710 (miscellaneous display) at pci0 dev 15 function 0 not configured
 le0 at pci0 dev 16 function 0: PCnet-PCI Ethernet
 le0: address 00:50:56:fb:91:65
 le0: 8 receive buffers, 2 transmit buffers
 le0: interrupting at irq 9
 isa0 at pcib0
 ===============> SYSTEM HANGS HERE FOR MINUTES <==================
 	With NetBSD 1.6, the boot sequence is different, but the system still prints the
 	wrong clock frequency and hangs after a while.