Page MenuHomeFreeBSD

Raise BLOCKIF_IOV_MAX to 128. Windows uses at least 67 and qemu alsosupports 128.
AbandonedPublic

Authored by araujo on May 3 2017, 7:09 AM.

Details

Summary

A Windows 10 vm using virtio-blk throws the following error:
Assertion failed: (n >= 2 && n <= BLOCKIF_IOV_MAX + 2), function pci_vtblk_proc, file /freenas-9.10-clean/freenas9/_BE/os/usr.sbin/bhyve/pci_virtio_block.c, line 216

It was dicussed here[1] already, but Jakub didn't upstream the patch for review I guess.

[1] http://freebsd.1045724.x6.nabble.com/pci-virtio-block-c-Assertion-failed-line-216-td6155786.html

Diff Detail

Event Timeline

araujo created this revision.May 3 2017, 7:09 AM
araujo retitled this revision from Raise BLOCKIF_IOV_MAX to 128. Windows uses at least 67 and qemu also supports 128. to Raise BLOCKIF_IOV_MAX to 128. Windows uses at least 67 and qemu alsosupports 128..May 3 2017, 7:11 AM
araujo added reviewers: grehan, tychon, anish, rgrimes.
tychon edited edge metadata.May 18 2017, 7:24 PM

Seems reasonable to me.

rgrimes accepted this revision.May 18 2017, 10:23 PM
This revision is now accepted and ready to land.May 18 2017, 10:23 PM

Please be sure to flag this for MFC to 11 and 10

grehan requested changes to this revision.May 18 2017, 11:00 PM

I emailed Marcelo some changes I had to this - it doesn't work as is.

This revision now requires changes to proceed.May 18 2017, 11:00 PM

I emailed Marcelo some changes I had to this - it doesn't work as is.

When this languished I suspected there was more than meets the eye, but I thought about it can't figure it out. Just curious -- or will it be obvious from the reworked diff -- why didn't this work?

araujo abandoned this revision.May 19 2017, 1:06 AM

Yes, I got @grehan email with some changes that I'm still investigating. But I got another problem to run Windows 2016 Server on one of my machines, so I got distracted with that. I will come back to this patch soon.

Thanks guys,

Side band communications are not very helpful, that email should of been attached to this review, or at least a note that there was a side band issue raised would of saved a few man cycles.

There was already a review for this in D9033 where I pointed out the initial fix by myself that bumped the number of descs, and the subsequent backout when it broke Linux guests :(

IOV_MAX is used in a couple of places that aren't related to this change. The usage in pci_ahci.c should be changed to just 33, as in the previous commit, since that's all that is needed there, with a CTASSERT to make sure IOV_MAX is >= 33.

The problematic one is in pci_virtio_block.c where the maximum segs is reported to the guest. When IOV_MAX is > VTBLK_RINGSZ, it looked like some older Linux virtio code would end up attempting to queue up max-segs worth of data inline (and not use indirect descriptors) resulting in a crash.

Naturally, my latest attempt to fix this worked fine on Win10 but broke on Linux :( Still working on it.