PCI passthrough stops working at certain conditions

aragats

Daemon

Reaction score: 684
Messages: 1,596

I have several bhyve guest OSs in FreeBSD 11-CURRENT. I never run two guests with the same PCI pass-through device.

I pass trough a PCI device (USB controller) to a Linux guest. It works properly. Then I halt the VM, make sure that bhyve destroyed it and run Windows guest with the same PCI device passed-through.

Windows device manager does show the device, however, e.g. a flash drive, plugged in is not presented to Windows, instead it's being processed by FreeBSD (a mass storage device is created).

The ppt device still exists:
Code:
pciconf -l
....
ppt0@pci0:0:20:0:  class=0x0c0330 card=0x21f317aa chip=0x1e318086 rev=0x04 hdr=0x00
....
After that it does not work in Linux guest as well. Kernel module (vmm) unloading and reloading does not help.

Thanks for advises,
Sergey
 
OP
aragats

aragats

Daemon

Reaction score: 684
Messages: 1,596

Sure, that's why I want to report it. If it's not a known issue maybe it makes sense to file a bug.
Actually I found that even in the same VM when it's restarted, the pass-through device doesn't work although appears in the device list. This one is more critical, since the initially reported situation is rather exotic: who wants to keep switching a device between VMs?
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 11,255
Messages: 37,429

If the same VM is shutdown correctly the device should be picked up again when it's started. It sounds like there may be some initialization that's not working properly or the shutdown leaves the device in some weird state. In any case I'd try the mailing-lists first. There aren't a lot of developers on this board but they're all on the mailing-lists so you'll have a much greater chance of getting a reasonable response.

If you can get a setup to reliably fail (so it's easy to test/verify) then a PR would be much appreciated (as this is with -CURRENT, make sure you have the latest sources and note the revision when submitting a PR).
 
OP
aragats

aragats

Daemon

Reaction score: 684
Messages: 1,596

Now I can confirm that the issue is 100% reproducible with the latest -CURRENT. I've checked out the sources and recompiled the whole system today. Even with a single guest VM, right after it exits, the pass-through device becomes controlled by the host FreeBSD. Will file a PR.
 
Top