Page MenuHomeFreeBSD

bhyve: change vq_getchain to return iovecs in both directions
ClosedPublic

Authored by khng on Mar 26 2021, 5:25 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 1, 10:41 AM
Unknown Object (File)
Thu, Oct 31, 6:19 PM
Unknown Object (File)
Mon, Oct 28, 4:02 PM
Unknown Object (File)
Sun, Oct 20, 4:31 AM
Unknown Object (File)
Sat, Oct 19, 11:11 PM
Unknown Object (File)
Oct 8 2024, 3:13 AM
Unknown Object (File)
Oct 4 2024, 6:08 AM
Unknown Object (File)
Oct 4 2024, 12:49 AM

Details

Summary

bhyve: change vq_getchain to return read and write iovecs

The old prototype requires callers to inspect flags of each descriptors
to get the starting position of host-to-guest iovecs.

vq_getchain() is changed to return a virtio request with both the
guest-to-host iovecs and host-to-guest iovecs recorded instead.
Callers can obtain the host-to-guest iovecs directly.

Sponsored by: The FreeBSD Foundation
MFC after: 3 weeks

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 38090
Build 34979: arc lint + arc unit

Event Timeline

khng requested review of this revision.Mar 26 2021, 5:25 PM
  • Fixed loopy check fallout out when num of descs are equal to maximum number
  • No need to use memset in vq_getchain
afedorov added inline comments.
usr.sbin/bhyve/pci_virtio_9p.c
201–202

It looks like the flags[] array is no longer used.

216

Debug output doesn't make sense anymore.

  • Remove unused flags from pci_vt9p_notify
khng marked 2 inline comments as done.Mar 27 2021, 8:33 AM
afedorov added inline comments.
usr.sbin/bhyve/pci_virtio_scsi.c
623–624

enqueuedvi -> enqueued

This revision is now accepted and ready to land.Mar 28 2021, 8:59 AM
khng retitled this revision from bhyve: vq_getchain returns read iovecs and write iovecs to bhyve: change vq_getchain to return iovecs in both directions.Mar 29 2021, 5:57 PM
khng marked an inline comment as done.

Refactor the prototype to match vq_ring_enqueue_segments in sys/dev/virtio/virtqueue.c.

This revision now requires review to proceed.Mar 29 2021, 5:59 PM

@afedorov I would like to have some comments on this again.

usr.sbin/bhyve/pci_virtio_block.c
348

The previous comment inside the loop (deleted lines 348-354 in this diff) was a little clearer. I agree that the assertion should be outside the loop but the comment could be a little clearer. To a casual reader, the assertion is inverted.

usr.sbin/bhyve/virtio.c
277

It would look very slightly neater to initialise this further down, rather than where it's declared. None of the other stack variables are initialised at the top of this function.

286

E.g. initialise req = { 0 }; here.

Great! Thank you.

Approved by: philip (mentor)

This revision is now accepted and ready to land.Mar 30 2021, 2:48 AM
afedorov added inline comments.
usr.sbin/bhyve/virtio.c
216–218

“vs” argument is unused.

khng marked 2 inline comments as done.Mar 30 2021, 7:55 AM