From owner-freebsd-emulation@FreeBSD.ORG Sat Nov 17 13:23:29 2012 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 067B5E80 for ; Sat, 17 Nov 2012 13:23:29 +0000 (UTC) (envelope-from alexclear@gmail.com) Received: from mail-pa0-f54.google.com (mail-pa0-f54.google.com [209.85.220.54]) by mx1.freebsd.org (Postfix) with ESMTP id C6A4D8FC15 for ; Sat, 17 Nov 2012 13:23:28 +0000 (UTC) Received: by mail-pa0-f54.google.com with SMTP id kp6so2594309pab.13 for ; Sat, 17 Nov 2012 05:23:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=krdJm37jGGo5PQFU2gXuwhFqJGEQ8H9Vzy5etdq9piE=; b=NonOqE6ruwZUdM3e4nYHYyPN3ubjhOhPRburPnM1nwqS6bWhvzsepd0ZdcHWFXH/BP NmLL5pgVHOmI++k1m4na9+hR2X9d2CLb27I6G9eI5+o3AryOkGxEAuFgiACsXhF9/gX/ zx7bAiei6fUSgST3B+bsFYM0G7ksixW3HCx53TWV838W9kihbnWawiuRZT1RhVnF0AeB 7MP15BF/y3jpZNnfbFUd9PNs+zSlgImh/5jg30oOilXqVuXzApRdTCdv/aDSAEW/0uSW iVgAN32u7faI9J/xwL7mA2F21ZAFDgaWAjVjnscRQLY78/WoLKh340kuSXcXr0jMvsCU b/wA== MIME-Version: 1.0 Received: by 10.68.143.106 with SMTP id sd10mr23920042pbb.62.1353158602650; Sat, 17 Nov 2012 05:23:22 -0800 (PST) Received: by 10.66.227.166 with HTTP; Sat, 17 Nov 2012 05:23:22 -0800 (PST) In-Reply-To: <50A787A6.8050402@wp.pl> References: <50A67D9F.8040505@wp.pl> <50A787A6.8050402@wp.pl> Date: Sat, 17 Nov 2012 16:23:22 +0300 Message-ID: Subject: Re: VirtualBox 4.1.22 on FreeBSD 9.0-RELEASE problem: VBoxHeadless eats 100% CPU From: Alex Chistyakov To: Marek Salwerowicz Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-emulation@freebsd.org X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Nov 2012 13:23:29 -0000 On Sat, Nov 17, 2012 at 4:48 PM, Marek Salwerowicz wrote: > W dniu 2012-11-16 20:28, Alex Chistyakov pisze: > >> On Fri, Nov 16, 2012 at 9:53 PM, Marek Salwerowicz >> wrote: >>> >>> W dniu 2012-11-16 16:22, Alex Chistyakov pisze: >>> >>>> Hello, >>>> >>>> My system is an amd64 box running FreeBSD 9.0-RELEASE on top of ZFS. >>>> I try to setup a VirtualBox VM from an Ubuntu 12.04 Server >>>> installation CD in a headless mode using VNC. >>>> Top shows that VBoxHeadless process consumes 100% CPU almost all the >>>> time and it takes forever to boot from the CD image: >>>> >>>> PID USERNAME THR PRI NICE SIZE RES STATE C TIME WCPU >>>> COMMAND >>>> 1652 vbox 19 22 0 358M 170M IPRT S 3 7:18 100.00% >>>> VBoxHeadless >>>> >>>> I get lots of repeating "ioctl(7,0x200056c1 { IO 0x56('V'), 193, 0 >>>> },0x0) = 0 (0x0)" lines every time I try to run truss on the running >>>> VBoxHeadless process, like this: >>>> >>>> ioctl(7,0x200056c1 { IO 0x56('V'), 193, 0 },0x0) = 0 (0x0) >>>> ioctl(7,0x200056c1 { IO 0x56('V'), 193, 0 },0x0) = 0 (0x0) >>>> ioctl(7,0x200056c1 { IO 0x56('V'), 193, 0 },0x0) = 0 (0x0) >>>> ioctl(7,0x200056c1 { IO 0x56('V'), 193, 0 },0x0) = 0 (0x0) >>>> ioctl(7,0x200056c1 { IO 0x56('V'), 193, 0 },0x0) = 0 (0x0) >>>> ioctl(7,0x200056c1 { IO 0x56('V'), 193, 0 },0x0) = 0 (0x0) >>>> ioctl(7,0x200056c1 { IO 0x56('V'), 193, 0 },0x0) = 0 (0x0) >>>> ioctl(7,0x200056c1 { IO 0x56('V'), 193, 0 },0x0) = 0 (0x0) >>>> ioctl(7,0x200056c1 { IO 0x56('V'), 193, 0 },0x0) = 0 (0x0) >>>> ioctl(7,0x200056c1 { IO 0x56('V'), 193, 0 },0x0) = 0 (0x0) >>>> ioctl(7,0x200056c1 { IO 0x56('V'), 193, 0 },0x0) = 0 (0x0) >>>> >>>> and it looks like this system call prevails in truss stats: >>>> >>>> [root@ci ~]# wc -l truss.vbox.log >>>> 1174962 truss.vbox.log >>>> [root@ci ~]# cat truss.vbox.log | grep 'ioctl(7,0x200056c1' | wc -l >>>> 1013997 >>>> [root@ci ~]# >>>> >>>> FD 7 is /dev/vboxdrv0, does this indicate a problem in communicating >>>> with a kernel VirtualBox driver? >>>> What should I do to resolve this situation? > > I've noticed that in my FreeBSD there is /dev/vboxdrv (not vboxdrv0) > driver.. > Probably different kernel module versions.? Probably because I'm on VirtualBox 4.1 and you are on 4.2 >>> Could you write down the VBoxManage commands you use to create the VM ? >> >> Yeah sure: >> >> VBoxManage createhd --filename "st11.vdi" --size 30000 >> VBoxManage createvm --name Stage11 --ostype Ubuntu_64 --register >> VBoxManage modifyvm Stage11 --memory 1024 --boot1 dvd --nic1 bridged >> --bridgeadapter1 em0 >> VBoxManage storagectl Stage11 --name "SATA Controller" --add sata >> --controller IntelAHCI --hostiocache on >> VBoxManage storageattach Stage11 --storagectl "SATA Controller" --port >> 0 --device 0 --type hdd --medium "st11.vdi" >> VBoxManage storagectl Stage11 --name "IDE Controller" --add ide >> --controller PIIX4 >> VBoxManage storageattach Stage11 --storagectl "IDE Controller" --port >> 0 --device 0 --type dvddrive --medium ~/ubuntu-12.10-server-amd64.iso > > Why do you use 2 controllers? I'm almost sure you can plug the ISO file to > SATA controller > Have you tried booting the machine only with CD attached? Yes, I've tried various combinations: a SCSI controller, a SATA controller, an IDE controller, CD and HDD on a single and on two different controllers, CD only but the situation did not change. >>> And post the VBoxManage showvminfo VM_NAME output. >> >> [vbox@ci /usr/home/vbox]$ VBoxManage showvminfo Stage11 >> [snip] >> >> >> >> BTW I've tried to disable nested pages, IOAPIC and ACPI but to no avail. > > I've created (without HDD) VM only with CD: > > s14% VBoxManage showvminfo Ubuntu > Name: Ubuntu > Groups: / > > Guest OS: Ubuntu (64 bit) > UUID: a82f26cc-d223-4f51-8361-b1d3d06abd2c > Config file: ~/vm/Ubuntu/Ubuntu.vbox > Snapshot folder: ~/vm/Ubuntu/Snapshots > Log folder: ~/vm/Ubuntu/Logs > Hardware UUID: a82f26cc-d223-4f51-8361-b1d3d06abd2c > > Memory size: 1024MB > Page Fusion: off > VRAM size: 7MB > CPU exec cap: 100% > HPET: on > > Chipset: piix3 > Firmware: BIOS > Number of CPUs: 2 > Synthetic Cpu: off > CPUID overrides: None > Boot menu mode: message and menu > Boot Device (1): DVD > Boot Device (2): DVD > Boot Device (3): HardDisk > Boot Device (4): Not Assigned > ACPI: on > IOAPIC: on > PAE: on > Time offset: 0ms > RTC: local time > Hardw. virt.ext: on > Hardw. virt.ext exclusive: on > Nested Paging: on > Large Pages: on > VT-x VPID: on > State: powered off (since 2012-11-17T12:34:40.000000000) > > Monitor count: 1 > 3D Acceleration: off > 2D Video Acceleration: off > Teleporter Enabled: off > Teleporter Port: 0 > Teleporter Address: > Teleporter Password: > Tracing Enabled: off > Allow Tracing to Access VM: off > Tracing Configuration: > Autostart Enabled: off > Autostart Delay: 0 > Storage Controller Name (0): IDE Controller > Storage Controller Type (0): PIIX4 > > Storage Controller Instance Number (0): 0 > Storage Controller Max Port Count (0): 2 > Storage Controller Port Count (0): 2 > > Storage Controller Bootable (0): on > IDE Controller (0, 1): /ftp/pub/Linux/Ubuntu/ubuntu-12.10-server-amd64.iso > (UUID: 90e658c2-be30-4417-8a91-557b374fbaf5) > NIC 1: MAC: 080027CB7823, Attachment: Bridged Interface 'em0', > Cable connected: on, Trace: off (file: none), Type: 82545EM, Reported speed: > 0 Mbps, Boot priority: 0, Promisc Policy: deny, Bandwidth group: none > > NIC 2: disabled > NIC 3: disabled > NIC 4: disabled > NIC 5: disabled > NIC 6: disabled > NIC 7: disabled > NIC 8: disabled > Pointing Device: PS/2 Mouse > Keyboard Device: PS/2 Keyboard > UART 1: disabled > UART 2: disabled > LPT 1: disabled > LPT 2: disabled > > Audio: disabled > Clipboard Mode: disabled > Drag'n'drop Mode: disabled > VRDE: enabled (Address 0.0.0.0, Ports 5900, MultiConn: off, > ReuseSingleConn: off, Authentication type: null) > Video redirection: disabled > VRDE property: TCP/Ports = "5900" > VRDE property: TCP/Address = > USB: disabled > EHCI: disabled > > > USB Device Filters: > > > > Available remote USB devices: > > > > Currently Attached USB Devices: > > > > Bandwidth groups: > > > Shared folders: > > VRDE Connection: not active > Clients so far: 0 > > Guest: > > Configured memory balloon size: 0 MB > > > For me it works without any issues. > The thing is that I am using VirtualBox 4.2.4 (it works well on my > environment, under 9.1-PRERELEASE amd64). > I'd recommend you to upgrade to 4.2.4 I upgraded to 9.1-PRERELEASE already so my next step is to try 4.2.4 I also put pmcstat on the game and got some interesting samples. Sample 1: --------------------------- 15.12% [260] RTTimeNanoTSLFenceSync @ /usr/local/lib/virtualbox/VBoxRT.so 99.62% [259] TMVirtualGetNoCheck @ /usr/local/lib/virtualbox/VBoxVMM.so 100.0% [259] TMTimerPollVoid 100.0% [259] emR3HwAccExecute 00.38% [1] _Z19vmR3HaltGlobal1HaltP6UVMCPUjm 100.0% [1] VMR3WaitHalted 100.0% [1] EMR3ExecuteVM --------------------------- Well, this looked like a broken time source to me (I used to have hi-res timer problems on rigs like that under Linux so this looked familiar) so I switched the time source to ACPI-fast. This allowed me to get further than first two installer screens on the guest but I had to reorganize my network configuration so I restarted the guest and got the problem again. I collected the 2nd sample then: --------------------------- 24.61% [1520] RTTimeNanoTSLFenceSync @ /usr/local/lib/virtualbox/VBoxRT.so 99.47% [1512] TMVirtualGetNoCheck @ /usr/local/lib/virtualbox/VBoxVMM.so 99.93% [1511] TMTimerPollVoid 100.0% [1511] emR3HwAccExecute 00.07% [1] _Z28tmR3TimerQueueRunVirtualSyncP2VM 100.0% [1] TMR3TimerQueuesDo 00.26% [4] _Z19vmR3HaltGlobal1HaltP6UVMCPUjm 100.0% [4] VMR3WaitHalted 100.0% [4] EMR3ExecuteVM 00.13% [2] VMMR3YieldStop 100.0% [2] _Z19vmR3HaltGlobal1HaltP6UVMCPUjm 100.0% [2] VMR3WaitHalted 00.13% [2] RTTimeMilliTS @ /usr/local/lib/virtualbox/VBoxRT.so 50.00% [1] _Z17tmR3TimerQueueRunP2VMP12TMTIMERQUEUE @ /usr/local/lib/virtualbox/VBoxVMM.so 100.0% [1] TMR3TimerQueuesDo 50.00% [1] _Z17tmR3TimerCallbackP7RTTIMERPvm 100.0% [1] _Z13rttimerThreadP11RTTHREADINTPv @ /usr/local/lib/virtualbox/VBoxRT.so --------------------------- A pattern differed but the root of the problem was basically the same so I decided to dive deeper and to switch to i8254. And the sample was: --------------------------- 26.96% [388] _mtx_lock_spin @ /boot/kernel/kernel 100.0% [388] getit 100.0% [388] i8254_get_timecount 96.13% [373] binuptime 03.87% [15] tc_windup --------------------------- This does not look very promising so I probably need to investigate other timer-related kernel params if switching to 4.2.4 does not help me. > > >> >>> What is your hardware? >> >> Core i7-3930K on Intel DX79TO w/64 Gb RAM, ST33000651AS and ST3000DM001 >> HDDs > > Ok, that should be supporting virtualization well ;) > > Let me know about the results. Thank you! I will upgrade to 4.2.4 and let you know. -- SY, Alex