Page MenuHomeFreeBSD

bhyve: change vq_getchain to return iovecs in both directions
ClosedPublic

Authored by khng on Mar 26 2021, 5:25 PM.

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
R10 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

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
200–201

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

215

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
347

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
272

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.

282

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
217–219

“vs” argument is unused.

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