Page MenuHomeFreeBSD

bhyve: virtio-net: disable receive until features are negotiated
ClosedPublic

Authored by vmaffione on Nov 18 2019, 9:39 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 23, 9:49 AM
Unknown Object (File)
Fri, Nov 22, 4:36 AM
Unknown Object (File)
Fri, Nov 22, 1:02 AM
Unknown Object (File)
Wed, Nov 13, 2:21 AM
Unknown Object (File)
Tue, Nov 12, 12:52 AM
Unknown Object (File)
Mon, Nov 11, 4:04 PM
Unknown Object (File)
Sat, Nov 9, 9:22 AM
Unknown Object (File)
Sat, Nov 9, 9:14 AM

Details

Summary

This patch fixes a race condition where the receive callback is called while the device is being reset. Since the rx_merge variable may change during reset, the receive callback may operate inconsistently with what the guest expects.
Also, get rid of the unused rx_vhdrlen variable.

Test Plan

Tested with FreeBSD guests with both TAP and VALE net backends.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

markj added inline comments.
usr.sbin/bhyve/pci_virtio_net.c
576

The initialization is not needed.

589–590

Fix comment style while you're here?

This revision is now accepted and ready to land.Nov 18 2019, 9:51 PM
vmaffione marked 2 inline comments as done.

Addressed comment.

This revision now requires review to proceed.Nov 18 2019, 9:56 PM
This revision is now accepted and ready to land.Nov 18 2019, 9:58 PM
usr.sbin/bhyve/pci_virtio_net.c
515

My only thought is perhaps we should assume rx_merge is not supported until we negotiate that it is. The race would not have been fatal (but is still good to fix) if the default been the more compatible behavior. That is, maybe 'rx_merge' should be 0 by default instead of 1.

This revision now requires review to proceed.Nov 19 2019, 5:43 PM
vmaffione added inline comments.
usr.sbin/bhyve/pci_virtio_net.c
515

Agreed.

This revision is now accepted and ready to land.Nov 19 2019, 5:51 PM

The race would not have been fatal (but is still good to fix) if the default been the more compatible behavior.

I observed a situation that the virtio queue is in an inconsistent state (FreeBSD guest, https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=242023).

Il giorno mar 19 nov 2019 alle ore 19:21 aleksandr.fedorov_itglobal.com
(Aleksandr Fedorov) <phabric-noreply@freebsd.org> ha scritto:

aleksandr.fedorov_itglobal.com added a comment.

> The race would not have been fatal (but is still good to fix) if the

default been the more compatible behavior.

I observed a situation that the virtio queue is in an inconsistent state

(FreeBSD guest, https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=242023).

Do you mean that you observed additional issues after this patch?

CHANGES SINCE LAST ACTION

https://reviews.freebsd.org/D22440/new/

REVISION DETAIL

https://reviews.freebsd.org/D22440

EMAIL PREFERENCES

https://reviews.freebsd.org/settings/panel/emailpreferences/

To: vmaffione, jhb, markj, bhyve
Cc: imp, aleksandr.fedorov_itglobal.com, rgrimes, woodsb02, bcran