Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Primus and VirtualBox update #29

Closed
ghost opened this issue Nov 27, 2012 · 4 comments
Closed

Primus and VirtualBox update #29

ghost opened this issue Nov 27, 2012 · 4 comments

Comments

@ghost
Copy link

ghost commented Nov 27, 2012

Hi there. I just read Bumblebee-Project/Bumblebee#278 and was testing some things based on that discussion. I noticed via dmesg that bbswitch was powering up then quickly powering back down the Nvidia card back down when I was trying ' primusrun vboxmanage startvm "Windows XP" ' and virtualbox --startvm "Windows XP". That post mentions root is needed to make it work so I tried some tricks with symbolic links that for whatever reason didn't work. So I imported the vbox disk... sudo virtualbox. I added root to the bumblebee, video, audio group, etc. - probably some things not needed but for experiment's sake to cover all bases. This is what I found:

[ 41.597638] bbswitch: enabling discrete graphics
[ 42.095936] pci 0000:01:00.0: power state changed by ACPI to D0
[ 42.234697] vgaarb: device changed decodes: PCI:0000:01:00.0,olddecodes=none,decodes=none:owns=none
[ 42.234903] NVRM: loading NVIDIA UNIX x86_64 Kernel Module 310.19 Thu Nov 8 00:52:03 PST 2012
[ 44.123729] NVRM: GPU at 0000:01:00: GPU-025de124-7fa3-daeb-b978-a80a7ff395c5
[ 50.043047] EMT-0[943]: segfault at 7fcff4424718 ip 00007fcff7d8a3e3 sp 00007fcfdcf70be0 error 4 in ld-2.16.so[7fcff7d81000+f000]
[ 94.369910] bbswitch: disabling discrete graphics
[ 94.382319] pci 0000:01:00.0: Refused to change power state, currently in D0
[ 94.382716] pci 0000:01:00.0: power state changed by ACPI to D3cold

Optirun works, however. (It's funny, I posted a while back that I couldn't get optirun to work with Windozey things).

I'm not sure how to diagnose the segfault so I just thought I'd offer the findings here.

@ghost
Copy link
Author

ghost commented Nov 27, 2012

And by 'symlink tricks' I only mean I created a "/root/VirtualBox VMs/Windows XP" symlink to the one in my home directory, since sudo primusrun virtualbox --startvm "/home/tod/VirtualBox VMs/Windows XP/Windows XP.vdi" didn't work.

@amonakov
Copy link
Owner

What is your Linux distribution and VirtualBox version? What if you run it like this:

CR_SYSTEM_GL_PATH=/usr/\$LIB/primus primusrun virtualbox --startvm "/home/tod/VirtualBox VMs/Windows XP/Windows XP.vdi"

(without root, or sudo)

@ghost
Copy link
Author

ghost commented Nov 28, 2012

I'm using Arch 64 bit and VirtualBox 4.2.4-2 (the latest in the community repository).

CR_SYSTEM_GL_PATH=/usr/$LIB/primus primusrun virtualbox --startvm "/home/tod/VirtualBox VMs/Windows XP/Windows XP.vdi"

I had to adjust that to

CR_SYSTEM_GL_PATH=/usr/$LIB/primus primusrun virtualbox --startvm "Windows XP"

VirtualBox errors like before, saying the host's 3d acceleration isn't configured properly... but there's more info in dmesg:

  [   83.428433] warning: `VirtualBox' uses 32-bit capabilities (legacy support in use)
  [  105.441459] hda-intel: IRQ timing workaround is activated for card #0. Suggest a bigger bdl_pos_adj.
  [  199.547762] VBoxTestOGL[904]: segfault at 3d4 ip 00007f90a0ca0061 sp 00007fff54c8d7e0 error 4 in ld-2.16.so[7f90a0c8c000+21000]
  [  199.729925] VBoxTestOGL[910]: segfault at 3d4 ip 00007f7bf6e4b061 sp 00007fffb649d860 error 4 in ld-2.16.so[7f7bf6e37000+21000]
  [  226.614857] VBoxTestOGL[945]: segfault at 3d4 ip 00007f3705249061 sp 00007fffdbb5fb10 error 4 in ld-2.16.so[7f3705235000+21000]
  [  226.708094] VBoxTestOGL[951]: segfault at 3d4 ip 00007fd0ff21b061 sp 00007fffb1322550 error 4 in ld-2.16.so[7fd0ff207000+21000]
  [  227.142054] VBoxTestOGL[969]: segfault at 3d4 ip 00007f9a99cf3061 sp 00007fff54dba1d0 error 4 in ld-2.16.so[7f9a99cdf000+21000]

@ghost
Copy link
Author

ghost commented Dec 1, 2012

Ah, my bad. I got it working with

 sudo chmod u+s /usr/lib/primus/libGL.so.1 
 CR_SYSTEM_GL_PATH=/usr/lib/primus/ primusrun virtualbox --startvm "Windows XP"

EDIT: forgot the trailing / in the GL_PATH, it doesn't work without

 [tod@Shirokuro ~]$ dmesg | tail -8
 [ 5927.537708] pci 0000:01:00.0: Refused to change power state, currently in D0
 [ 5927.538218] pci 0000:01:00.0: power state changed by ACPI to D3cold
 [ 5928.038993] bbswitch: enabling discrete graphics
 [ 5928.537688] pci 0000:01:00.0: power state changed by ACPI to D0
 [ 5928.570422] vgaarb: device changed decodes: PCI:0000:01:00.0,olddecodes=none,decodes=none:owns=none
 [ 5928.570711] NVRM: loading NVIDIA UNIX x86_64 Kernel Module  310.19  Thu Nov  8 00:52:03 PST 2012
 [ 5929.440163] NVRM: GPU at 0000:01:00: GPU-025de124-7fa3-daeb-b978-a80a7ff395c5

My Windows XP VM is 32-bit so i thought it'd be /usr/lib32/ setuid to do the trick, but no. It's still a work in
progress... some of the dxdiag tests were failing so I tried installing DirectX on top of the guest additions... after I ran the dxdiag tests again:

    primus: warning: dropping a frame to avoid deadlock
    primus: warning: killed a worker to proceed
    VirtualBox: libglfork.cpp:401: static void* TSPrimusInfo::R::work(void*): Assertion `!r.pbuffer' failed.
    Aborted

And then the VM crashed silently.

Over the last few days I've messed with Bumblebee quite a bit. I switched to 32-bit and tried a PAE kernel (I'm back on Arch's stock 64-bit now). A tip in case anybody needs it - I had to set vmalloc=256Mi (I eventually set it to 768Mi) kernel parameter to get Bumblebee to work. I also solved a problem I was having with spectrwm: basicallly, optirun would 'fail without child processes' on most things I tried to run. It turns out it's because spectrwm uses libswmhack.so~, which is used to make sure an application that is spawned on one virtual desktop stays there and doesn't wander to the desktop you've switched to while it loads. Anyway, I just did

   LD_PRELOAD="" optirun whatever

to allow the process to proceed.

@ArchangeGabriel
Copy link

Is there still an issue here?

@ghost
Copy link
Author

ghost commented Feb 25, 2013

I just tested on a new installf of XP and primusrun starts Virtualbox fine with CR_SYSTEM_GL_PATH="/usr/lib/primus/" primusrun vboxmanage startvm "Windows XP" and dmesg shows Nvidia's loaded. Unfortunately the fullscreen DirectX 9 test doesn't start or finish properly, leaving the resolution smaller and only the taskbar responding to clicks and such... at which point I just tell Virtualbox to power it down since I can't get my display back. It works with my Intel card.

And I still have to prepend LD_PRELOAD="" to optirun in spectrwm with 64 bit applications.

At least the segfaults are gone. Not sure if I should close this.

@ghost
Copy link

ghost commented Aug 10, 2013

I'm the ghost that originally opened this issue (sorry about that). I suspect that I could have gotten this working all along, but I didn't know to specify intel_iommu=on on the kernel cmd line. This is what it looks like on the same machine nowadays, and works without issue:

 [ 4454.487735] bbswitch: enabling discrete graphics
 [ 4454.987955] pci 0000:01:00.0: power state changed by ACPI to D0
 [ 4455.050598] vgaarb: device changed decodes: PCI:0000:01:00.0,olddecodes=none,decodes=none:owns=none
 [ 4455.051510] [drm] Initialized nvidia-drm 0.0.0 20130102 for 0000:01:00.0 on minor 1
 [ 4455.051536] NVRM: loading NVIDIA UNIX x86_64 Kernel Module  325.15  Wed Jul 31 18:50:56 PDT 2013
 [ 4455.150570] nvidia 0000:01:00.0: irq 47 for MSI/MSI-X
 [ 4458.604413] created IOMMU domain ffff88011ccf0100

So I'd like to request closure of this as user error. Note, I still had to specify CR_SYSTEM_GL_PATH=/usr/lib/primus/ to get past the VBoxTestOGL.

And it works even though I have this BIOS quirk:

 [    1.609937] DMAR: BIOS has allocated no shadow GTT; disabling IOMMU for graphics

@amonakov
Copy link
Owner

Thanks for the note.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants