]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
bhyve: vtnet: simplify thread synchronization
authorvmaffione <vmaffione@FreeBSD.org>
Sun, 9 Jun 2019 12:41:21 +0000 (12:41 +0000)
committervmaffione <vmaffione@FreeBSD.org>
Sun, 9 Jun 2019 12:41:21 +0000 (12:41 +0000)
commite5906c2293fac945f62124fa3c355f21c425f499
treebd7335ebe699e0fa021c1a6d8df112e5d9ce8970
parentaf823c22958c52e53e393d844fdf28ccbb44435d
bhyve: vtnet: simplify thread synchronization

On vtnet device reset it is necessary to wait for threads to stop TX and
RX processing. However, the rx_in_progress variable (used for to wait for
RX processing to stop) is actually useless, and can be removed. Acquiring
and releasing the RX lock is enough to synchronize correctly. Moreover,
it is possible to reset the device while holding both TX and RX locks, so
that the "resetting" variable becomes unnecessary for the RX thread, and
can be protected by the TX lock (instead of being volatile).

Reviewed by: jhb, markj
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D20543
usr.sbin/bhyve/pci_virtio_net.c