Page MenuHomeFreeBSD

bhyve: virtio: introduce vq_kick_enable() and vq_kick_disable()
ClosedPublic

Authored by vmaffione on Jun 9 2019, 9:41 PM.

Details

Summary

The VirtIO standard supports two schemes for notification suppression: a notification enable bit and
a more sophisticated one (event_idx) that also supports delayed notifications.
Currently bhyve fully supports only the first scheme. This patch hides the notification
suppression internals by means of two inline routines, vq_kick_enable() and vq_kick_disable(),
and makes the code more readable.
Moreover, further improve readability by replacing the call to mb() with a call to
atomic_thread_fence_seq_cst(), which is already used in virtio.c

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

vmaffione created this revision.Jun 9 2019, 9:41 PM
vmaffione updated this revision to Diff 58461.Jun 9 2019, 9:41 PM
pmooney_pfmooney.com added inline comments.
usr.sbin/bhyve/pci_virtio_block.c
42 ↗(On Diff #58461)

Worth adding the include to virtio.h rather than requiring it in each of the consumers?

vmaffione added inline comments.Jun 10 2019, 7:47 PM
usr.sbin/bhyve/pci_virtio_block.c
42 ↗(On Diff #58461)

Agree, that was also my idea. But I observed that virtio.h does not include anything, so I assumed there was a reason for that.
Does anyone have objections on adding include <machine/atomic.h> in virtio.h?

vmaffione updated this revision to Diff 58490.Jun 10 2019, 8:20 PM

Moved include <machine/atomic.h> to virtio.h.

In D20581#445096, @v.maffione_gmail.com wrote:

Moved include <machine/atomic.h> to virtio.h.

I am ok with this, but could you please produce your diff relative to /usr/src?

This revision is now accepted and ready to land.Jun 10 2019, 8:34 PM
vmaffione updated this revision to Diff 58492.Jun 10 2019, 8:35 PM

Provide patch relative to /usr/src/.

This revision now requires review to proceed.Jun 10 2019, 8:35 PM
This revision is now accepted and ready to land.Jun 10 2019, 8:40 PM
bryanv accepted this revision as: bryanv.Jun 11 2019, 2:13 AM
This revision was automatically updated to reflect the committed changes.