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

crash with virtio-net + UEFI #164

Open
adaugherity opened this issue Apr 2, 2019 · 5 comments
Open

crash with virtio-net + UEFI #164

adaugherity opened this issue Apr 2, 2019 · 5 comments

Comments

@adaugherity
Copy link
Contributor

I tried to see if I could use UEFI to load GRUB 2 from within the guest, to avoid having to copy the kernel/initrd from the guest to host after every kernel patch. Unfortunately, xhyve immediately crashes:

Assertion failed: (v.vm_pkt_size >= vms->max_packet_size), function vmn_read, file src/pci_virtio_net_vmnet.c, line 337.

./xhyverun-suse.sh: line 68: 11365 Abort trap: 6 sudo xhyve -AHP -U $UUID -m 1G -c 2 -s 0:0,hostbridge -s 2:0,ahci-cd,$ISO -s 2:1,virtio-blk,"$IMG" -s 4,virtio-net -s 31,lpc -l com1,stdio -l bootrom,$FIRMWARE

(FIRMWARE=BHYVE_UEFI.fd copied from FreeBSD, of course; I was previously using -f kexec,$KERNEL,$INITRD,"$CMDLINE" instead of -l bootrom,$FIRMWARE.)

If I change virtio-net to e1000, then everything works properly, at least with a serial console. I'm having issues with VNC but that's unrelated to vmnet.

@labrnth
Copy link

labrnth commented Jun 28, 2019

I'm getting the same issue when running OpenBSD 6.5 using UEFI and the virtio-net interface.

Assertion failed: (v.vm_pkt_size >= vms->max_packet_size), function vmn_read, file src/pci_virtio_net_vmnet.c, line 337.

./xhyve-openbsd-32667A64-67E6-4C32-A045-B7E2B2413A6E.sh: line 20: 237 Abort trap: 6 xhyve $ACPI $MEM $SMP -w -u -H $PCI_DEV $LPC_DEV $NET $IMG_CD $IMG_HDD $UEFI

Like @adaugherity if I use the e1000 interface it works. Oddly, I can occasionally get it to work but only if I have another xhyve VM running using the e1000 interface. So I have successfully been able to run the VM with the virtio-net interface but I can't consistently reproduce it.

Here is the script I used for OpenBSD 6.5 xhyve VM.

#!/bin/sh

UUID="-U 32667A64-67E6-4C32-A045-B7E2B2413A6E"

#MEDIA="../../media/install65.fs"
IMG="hdd-32667A64-67E6-4C32-A045-B7E2B2413A6E.img"
FIRMWARE="../firmware/BHYVE_UEFI.fd"

MEM="-m 2G"
#SMP="-c 2"
#IMG_CD="-s 3,ahci-hd,$MEDIA"
IMG_HDD="-s 3,ahci-hd,$IMG"
NET="-s 5,virtio-net"
#NET="-s 5,e1000"
PCI_DEV="-s 0,amd_hostbridge"
LPC_DEV="-s 31,lpc -l com1,stdio"
ACPI="-A"
UEFI="-l bootrom,$FIRMWARE"

xhyve $ACPI $MEM $SMP -w -u -H $PCI_DEV $LPC_DEV $NET $IMG_CD $IMG_HDD $UEFI

Here are the boot messages of one of the successful times it booted.

https://pastebin.com/raw/uS78AWjt

@mike-pt
Copy link

mike-pt commented Oct 13, 2019

same here:

Assertion failed: (v.vm_pkt_size >= vms->max_packet_size), function vmn_read, file src/pci_virtio_net_vmnet.c, line 337.
 ./xhyverun-windows.sh: line 19:  2066 Abort trap: 6   

@mike-pt
Copy link

mike-pt commented Oct 14, 2019

hum maybe related to #define BLOCKIF_IOV_MAX 33 /* not practical to be IOV_MAX */

this was raised upstream a while ago:
https://reviews.freebsd.org/D10581

@mike-pt
Copy link

mike-pt commented Oct 14, 2019

 git diff include/
diff --git a/include/xhyve/block_if.h b/include/xhyve/block_if.h
index fecfdbc..8937787 100644
--- a/include/xhyve/block_if.h
+++ b/include/xhyve/block_if.h
@@ -38,7 +38,7 @@
 #include <sys/uio.h>
 #include <sys/unistd.h>
 
-#define BLOCKIF_IOV_MAX 33 /* not practical to be IOV_MAX */
+#define BLOCKIF_IOV_MAX 128 /* not practical to be IOV_MAX */
 
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wpadded"

This seems to fix the crash while loading the driver on install at least :)

EDIT: Actually I was confusing this with a "similar" issue get with the block driver but the GHI is originaly for virtio-net

@adaugherity
Copy link
Contributor Author

I can confirm @Autonomic's report that virtio-net+UEFI works if another VM is already running using e1000. Tested with both openSUSE Leap 15.1 and OpenBSD 6.6.

However... that only applies to booting from disk or cd. If the UEFI attempts to boot from the network, it crashes in the same way!

I discovered this by trying to figure out why my openSUSE VM would only boot from CD, not its hard disk, when using EFI. Turns out it was installed in BIOS mode and lacks an EFI System Partition, so that explains it. If I remove the CD from the VM config, it attempts to boot the hard disk (which fails), and then falls back to network booting... which crashes xhyve.

amartinunowhy pushed a commit to amartinunowhy/hyperkit that referenced this issue May 17, 2020
When using virtio-net with an UEFI firmware (-f bootrom),
hyperkit crashes on an assertion. See the related bug on
xhyve: machyve/xhyve#164

The complete details are not clear to me, but it seems
that during boot, the firmware reads on the interface but
doesn't provide big enough read buffers. It seems that
the space for VLAN headers is missing.

This patch drops the related reads, so normal booting can
occur. Network boot probably doesn't work, though.
amartinunowhy pushed a commit to amartinunowhy/hyperkit that referenced this issue May 17, 2020
When using virtio-net with an UEFI firmware (-f bootrom),
hyperkit crashes on an assertion. See the related bug on
xhyve: machyve/xhyve#164

The complete details are not clear to me, but it seems
that during boot, the firmware reads on the interface but
doesn't provide big enough read buffers. It seems that
the space for VLAN headers is missing.

This patch drops the related reads, so normal booting can
occur. Network boot probably doesn't work, though.

Signed-off-by: Antoine Martin <[email protected]>
amartinunowhy pushed a commit to amartinunowhy/xhyve that referenced this issue May 17, 2020
When using virtio-net with an UEFI firmware (bootrom),
xhyve crashes on an assertion. See the related bug
machyve#164

The complete details are not clear to me, but it seems
that during boot, the firmware reads on the interface but
doesn't provide big enough read buffers. It seems that
the space for VLAN headers is missing.

This patch drops the related reads, so normal booting can
occur. Network boot probably doesn't work, though.

Signed-off-by: Antoine Martin [email protected]
dch pushed a commit to skunkwerks/xhyve that referenced this issue Oct 17, 2020
When using virtio-net with an UEFI firmware (bootrom),
xhyve crashes on an assertion. See the related bug
machyve#164

The complete details are not clear to me, but it seems
that during boot, the firmware reads on the interface but
doesn't provide big enough read buffers. It seems that
the space for VLAN headers is missing.

This patch drops the related reads, so normal booting can
occur. Network boot probably doesn't work, though.

Signed-off-by: Antoine Martin [email protected]
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

3 participants